From 35eab7718ae6eff31ff4f31829ad7e6eeb68ed21 Mon Sep 17 00:00:00 2001 From: gferg <> Date: Sun, 25 Mar 2001 22:24:24 +0000 Subject: [PATCH] updated scripts --- LDP/builder/dsssl/ldp.dsl | 3 +- LDP/builder/ldp_mk | 31 ++++++++------ LDP/builder/ldp_print/fix_print_html.lib | 51 +++++++++++++++++++++--- 3 files changed, 67 insertions(+), 18 deletions(-) diff --git a/LDP/builder/dsssl/ldp.dsl b/LDP/builder/dsssl/ldp.dsl index d60d4795..e29a1ed0 100644 --- a/LDP/builder/dsssl/ldp.dsl +++ b/LDP/builder/dsssl/ldp.dsl @@ -168,7 +168,8 @@ (define (toc-depth nd) ;; more depth (2 levels) to toc; instead of flat hierarchy - 2) + ;; 2) + 4) (element emphasis ;; make role=strong equate to bold for emphasis tag diff --git a/LDP/builder/ldp_mk b/LDP/builder/ldp_mk index 9cba7ca6..e2fa82ad 100644 --- a/LDP/builder/ldp_mk +++ b/LDP/builder/ldp_mk @@ -128,7 +128,7 @@ if( $linuxdoc == 0 && $create_index == 1 ) { $cmd = "$_toolroot/mkindex/collateindex.pl -N -o index." . ($dtd eq 'XML' ? "xml;" : "sgml;") . - "$_toolroot/$_jade/jade/jade -t sgml -V html-index -d $style $dcl $fname; " . + "jade -t sgml -V html-index -d $style $dcl $fname; " . "$_toolroot/mkindex/collateindex.pl -g -t Index -i doc-index " . "-o index." . ($dtd eq 'XML' ? "xml" : "sgml") . " HTML.index;" . "rm -f HTML.index"; @@ -143,14 +143,14 @@ print "\nldp_mk: creating HTML from $fname...\n"; if( $linuxdoc == 1 ) { - $cmd = "$_toolroot/sgml-tools/bin/sgml2html -c latin $fname"; + $cmd = "sgml2html -c latin $fname"; } else { $cmd = - "$_toolroot/$_jade/jade/jade -t sgml -i html -d $style $dcl $fname; " . + "jade -t sgml -i html -d $style $dcl $fname; " . "mv -f \*.html $fname_wo_ext/;" . - "$_toolroot/$_jade/jade/jade -t sgml -i html -V nochunks " . + "jade -t sgml -i html -V nochunks " . "-d $style $dcl $fname > 00_${fname_wo_ext}.html"; } @@ -168,12 +168,21 @@ print "\nldp_mk: creating plain text from $fname...\n"; if( $linuxdoc == 1 ) { - $cmd = "$_toolroot/sgml-tools/bin/sgml2txt -c latin -f $fname"; + $cmd = "sgml2txt -c latin -f $fname"; } else { - open(F_IN, "00_${fname_wo_ext}.html"); - $s = join('', ); + $s = ''; + open(F_IN, "+< 00_${fname_wo_ext}.html"); + while() { + if( $_ =~ /^WIDTH=\"\d\"/ ) { + next; + } + $s .= $_; + } + seek(F_IN,0,0); + print F_IN $s; + truncate(F_IN, tell(F_IN)); close(F_IN); # fix to place URLs in-line for text variant @@ -187,7 +196,7 @@ if( $linuxdoc == 1 ) { $cmd = "lynx -dump "; } elsif( $txt_filter =~ /w3m/i ) { - $cmd = "$_toolroot/w3m/bin/w3m -S -cols 78 -dump "; + $cmd = "$_toolroot/w3m/w3m -S -cols 78 -dump "; } elsif( $txt_filter =~ /html2text/ ) { $cmd = "$_toolroot/html2text/bin/html2text -style pretty -nobs "; @@ -331,10 +340,8 @@ if( $linuxdoc == 1 ) { $ENV{'SGML_CATALOG_FILES'} = "$_toolroot/dtd/docbook.cat:$_toolroot/$_jade/dsssl/catalog"; - $cmd = "$_toolroot/$_jade/sgmlnorm/sgmlnorm " . - "$_toolroot/ld2db/docbook.dcl $fname > EX_$fname ;" . - "$_toolroot/$_jade/jade/jade -t sgml " . - "-c $_toolroot/ld2db/catalog " . + $cmd = "sgmlnorm $_toolroot/ld2db/docbook.dcl $fname > EX_$fname ;" . + "jade -t sgml -c $_toolroot/ld2db/catalog " . "-d $_toolroot/ld2db/ld2db.dsl#db EX_$fname > DB_$fname ;" . "rm -f EX_$fname"; system($cmd); diff --git a/LDP/builder/ldp_print/fix_print_html.lib b/LDP/builder/ldp_print/fix_print_html.lib index 964a83b0..cb335fec 100644 --- a/LDP/builder/ldp_print/fix_print_html.lib +++ b/LDP/builder/ldp_print/fix_print_html.lib @@ -30,7 +30,7 @@ sub fix_print_html { # ignore everything until we see the chapter or sect # - if( $_ =~ /CLASS="CHAP/ ) { + if( $_ =~ /CLASS="CHAP/ || $_ =~ /CLASS="chap/ ) { $buf .= $_; $indx++; @@ -102,18 +102,60 @@ sub fix_print_html { $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/\&\#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; + + if( $is_article == 0 ) { + + # for books...decrement the headers by 1 and then re-set the + # chapter level only to H1... + # + my($cnt,$j) = 0; + for($cnt=5; $cnt > 0; $cnt--) { + $j = $cnt + 1; + $buf =~ s/<\/DIV\n//gms; + $buf =~ s/(>(<\/LI\n)/$1$2$3/gms; print OUT_FILE $buf; close(OUT_FILE); @@ -121,7 +163,6 @@ sub fix_print_html { return 1; } - # Return true from package include # 1;