#! /usr/bin/env perl use strict; use warnings; use HTML::Entities; open (LOG, '<', "LOG"); open (INDEX, '>','index.html'); open (LOG_HTML, '>', "log.html"); print INDEX < EOF print LOG_HTML < EOF print LOG_HTML "
";

sub read_vars {
    my ($file) = @_;
    my %vars = ();
    if (open (VARS, "<", $file)) {
	while () {
	    chomp;
	    my ($key, $value) = /^([^=]+)=(.*)/ or next;
	    $vars{$key} = $value;
	}
	close (VARS);
    }
    return %vars;
}

my (%vars) = read_vars ('VARS');
print INDEX "

Build Properties

\n"; print INDEX "\n"; print INDEX "\n"; foreach my $key (sort (keys (%vars))) { print INDEX ""; print INDEX ""; print INDEX ""; print INDEX "\n"; } print INDEX "
NameValue
", encode_entities ($key), "", encode_entities ($vars{$key}), "
\n"; print INDEX "

Build Summary

\n"; print INDEX "
    \n"; my ($n_products) = 0; my ($n_steps) = 0; my ($new_page) = 0; while () { my $ln = $.; chomp; if (/^ $/) { $new_page = 1; print LOG_HTML "

\n";
	next;
    }

    my $log_class;
    if ($new_page) {
	$new_page = 0;
	$log_class = "step";
	if (my ($product) = /^Saving (.*)$/) {
	    print INDEX "\n  " if !$n_steps;
	    print INDEX "
  • ", encode_entities ($_); print INDEX " (log)"; $n_products = 0; } } else { if (my ($diagnostic) = /(error|warning):/) { if ($n_products) { print INDEX " \n"; $n_products = 0; } print INDEX "

    "; print INDEX ""; print INDEX encode_entities ($_); print INDEX "

    \n"; $log_class = "$diagnostic"; } } printf LOG_HTML "%4d ", $ln, $ln; if (defined ($log_class)) { print LOG_HTML "", encode_entities ($_), "\n"; } else { print LOG_HTML encode_entities ($_), "\n"; } } print INDEX " \n" if $n_products; print INDEX "
  • \n" if $n_steps; print INDEX < EOF print LOG_HTML < EOF open (CSS, '>', "build.css"); print CSS <p { margin: 0pt 0pt 0pt 0em } body>p + p { text-indent: 1.5em; } H1 { font-size: 150%; margin-left: -1.33em } H2 { font-size: 125%; font-weight: bold; margin-left: -.8em } H3 { font-size: 100%; font-weight: bold; margin-left: -.5em } H4 { font-size: 100%; margin-left: 0em } H1, H2, H3, H4, H5, H6 { font-family: sans-serif; color: blue } html { margin: 0 } a:link { color: blue; text-decoration: none; } a:visited { color: gray; text-decoration: none; } a:active { color: black; text-decoration: none; } a:hover { text-decoration: underline } .step { font-weight: bold } .warning { background: yellow; margin-top: 0; margin-bottom: 0 } .error { background: orange; margin-top: 0; margin-bottom: 0 } EOF