diff --git a/LDP/builder/ldp_print/README b/LDP/builder/ldp_print/README index 2aede516..948a2e4c 100644 --- a/LDP/builder/ldp_print/README +++ b/LDP/builder/ldp_print/README @@ -71,6 +71,8 @@ o I ran into a problem with htmldoc v1.8.8 which required a source < break; < + UPDATE (2001-10-10): It appears that later versions of htmldoc + have this problem corrected. The patch is not required. ==== Greg Ferguson / gferg (at) metalab.unc.edu diff --git a/LDP/builder/ldp_print/VERSION b/LDP/builder/ldp_print/VERSION index bf75a82d..07661c59 100644 --- a/LDP/builder/ldp_print/VERSION +++ b/LDP/builder/ldp_print/VERSION @@ -1 +1 @@ -0.3, 2001-07-05 +0.4, 2001-10-12 diff --git a/LDP/builder/ldp_print/fix_print_html.lib b/LDP/builder/ldp_print/fix_print_html.lib index 74f3e505..4e4dc943 100644 --- a/LDP/builder/ldp_print/fix_print_html.lib +++ b/LDP/builder/ldp_print/fix_print_html.lib @@ -8,9 +8,10 @@ # thru htmldoc. # # log: -# 16Oct2000 - 0.1 - initial entry -# 03Apr2001 - 0.2 - fix for -# 05Jul2001 - 0.3 - fix for and -f +# 16Oct2000 - 0.1 - initial entry +# 03Apr2001 - 0.2 - fix for +# 05Jul2001 - 0.3 - fix for and -f +# 12Oct2001 - 0.4 - fix for sections; loop thru both files (body/title) # sub fix_print_html { @@ -22,26 +23,22 @@ sub fix_print_html { return 0; }; - my($buf,$ttl_buf) = ''; + my($buf, $ttl_buf) = ''; my($indx) = -1; - my($is_article) = 0; + my($is_article) = 1; while() { if( $indx == 1 ) { # ignore everything until we see the chapter or sect # - if( $_ =~ /CLASS="CHAP/i || $_ =~ /CLASS="PREF/i ) { + if( $_ =~ /CLASS="CHAP/i || $_ =~ /CLASS="PREF/i + || + $_ =~ /CLASS="SECT/i ) { $buf .= $_; $indx++; - } elsif( $_ =~ /CLASS="SECT/ || $_ =~ /CLASS="sect/ ) { - - $buf .= $_; - $indx++; - $is_article = 1; - } else { next; } @@ -54,6 +51,8 @@ sub fix_print_html { $ttl_buf .= ">\n\n\n"; $ttl_buf =~ s/<\/H1\n/<\/H1\n>


<\/DIV\n>


/
<\/DIV\n>/ms; + &fix_html(\$ttl_buf, 1); open(TOC_FILE, "> $ttl") || do { print "fix_print_html: cannot open $ttl: $!\n"; @@ -71,6 +70,10 @@ sub fix_print_html { } elsif( $indx < 0 ) { + if( $_ =~ /CLASS="BOOK"/i ) { + $is_article = 0; + } + # up to this point, both buffers get the line # if( $_ =~ /CLASS="TITLEPAGE"/ ) { @@ -90,40 +93,57 @@ sub fix_print_html { } close(IN_FILE); + + # fix body file + # open(OUT_FILE, "> $out") || do { print "fix_print_html: cannot open $out: $!\n"; return 0; }; + &fix_html(\$buf, $is_article); - # make these corrections and write out the file + print OUT_FILE $buf; + close(OUT_FILE); + + + return 1; +} + + +sub fix_html { + + my($buf, $is_article) = @_; + my($indx) = -1; + + # make corrections and write out the file # - $buf =~ s/(\n>/$1$2\n/gms; - $buf =~ s/(\n>/$1$2\n/gms; - $buf =~ s/(\n>/$1$2\n/gms; + $$buf =~ s/(\n>/$1$2\n/gms; + $$buf =~ s/(\n>/$1$2\n/gms; + $$buf =~ s/(\n>/$1$2\n/gms; if( $is_article == 0 ) { - $buf =~ s/(\nCLASS="SECT[TION\d]+"\n>)
))
) -1 ) { - $buf = substr($buf, 0, $indx); - $buf .= "\n<\/BODY>\n<\/HTML>\n\n"; - } elsif( ($indx = rindex($buf, " -1 ) { - $buf = substr($buf, 0, $indx); - $buf .= "\n<\/BODY>\n<\/HTML>\n\n"; + $$buf =~ s/ -1 ) { + $$buf = substr($buf, 0, $indx); + $$buf .= "\n<\/BODY>\n<\/HTML>\n\n"; + } elsif( ($indx = rindex($$buf, " -1 ) { + $$buf = substr($buf, 0, $indx); + $$buf .= "\n<\/BODY>\n<\/HTML>\n\n"; } - $buf =~ s/\&\#13;//g; - $buf =~ s/\&\#60;/\</g; - $buf =~ s/\&\#62;/\>/g; - $buf =~ s/\&\#8211;/\-/g; - $buf =~ s/WIDTH=\"\d\"//g; - $buf =~ s/><[\/]*TBODY//g; - $buf =~ s/><[\/]*THEAD//g; - $buf =~ s/TYPE=\"1\"\n//gim; + $$buf =~ s/\&\#13;//g; + $$buf =~ s/\&\#60;/\</g; + $$buf =~ s/\&\#62;/\>/g; + $$buf =~ s/\&\#8211;/\-/g; + $$buf =~ s/WIDTH=\"\d\"//g; + $$buf =~ s/><[\/]*TBODY//g; + $$buf =~ s/><[\/]*THEAD//g; + $$buf =~ s/TYPE=\"1\"\n//gim; - $buf =~ s/<\/P/gms; + $$buf =~ s/<\/P/gms; if( $is_article == 0 ) { @@ -131,13 +151,16 @@ sub fix_print_html { # chapter level only to H1... # my($cnt,$j) = 0; - for($cnt=5; $cnt > 0; $cnt--) { + for($cnt=5; $cnt >= 0; $cnt--) { $j = $cnt + 1; - $buf =~ s/<\/DIV\n//gms; - $buf =~ s/(>(<\/LI\n)/$1$2$3/gms; + $$buf =~ s/><\/DIV\n//gms; + $$buf =~ s/(>(<\/LI\n)/$1$2$3/gms; - print OUT_FILE $buf; - close(OUT_FILE); - - return 1; + return; } + # Return true from package include # 1;