#! /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 "
    ";
    
    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 "
  1. ", 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 "
  2. \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