updated scripts

This commit is contained in:
gferg 2001-03-25 22:24:24 +00:00
parent b57df14c75
commit 35eab7718a
3 changed files with 67 additions and 18 deletions

View File

@ -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

View File

@ -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('', <F_IN>);
$s = '';
open(F_IN, "+< 00_${fname_wo_ext}.html");
while(<F_IN>) {
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);

View File

@ -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><LI\n><DIV\nCLASS="FORMALPARA"\n)><P\n(.*?)<\/P\n>/$1$2\n/gms;
$buf =~ s/(\n><LI\nSTYLE="[^\"]+"\n)><P\n(.*?)<\/P\n>/$1$2\n/gms;
if( $is_article == 0 ) {
$buf =~ s/(\nCLASS="SECT[TION\d]+"\n>)<H1\n(.*?)<\/H1/$1<H2\n$2<\/H2/gms;
$buf =~ s/(\nCLASS="SECT[TION\d]+"\n><HR>)<H1\n(.*?)<\/H1/$1<H2\n$2<\/H2/gms;
$buf =~ s/(\nCLASS="SECT[TION\d]+"\n>)<H1\n(.*?)<\/H1/$1<H2\n$2<\/H2/gims;
$buf =~ s/(\nCLASS="SECT[TION\d]+"\n><HR>)<H1\n(.*?)<\/H1/$1<H2\n$2<\/H2/gims;
}
$buf =~ s/<H1(\nCLASS="INDEXDIV"\n)(.*?)<\/H1/<H2$1$2<\/H2/gms;
$buf =~ s/<H1(\nCLASS="INDEXDIV"\n)(.*?)<\/H1/<H2$1$2<\/H2/gims;
if( ($indx = rindex($buf, "<H1\n><A\nNAME=\"DOC-INDEX\"")) > -1 ) {
$buf = substr($buf, 0, $indx);
$buf .= "\n<\/BODY>\n<\/HTML>\n\n";
} elsif( ($indx = rindex($buf, "<H1\n><A\nNAME=\"doc-index\"")) > -1 ) {
$buf = substr($buf, 0, $indx);
$buf .= "\n<\/BODY>\n<\/HTML>\n\n";
}
$buf =~ s/\&\#13;//g;
$buf =~ s/\&\#60;/\&lt;/g;
$buf =~ s/\&\#62;/\&gt;/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/<H${cnt}/<H${j}/g;
$buf =~ s/<\/H${cnt}/<\/H${j}/g;
}
my(@l) = split(/\n/, $buf);
for( $cnt=0; $cnt < (@l + 0); $cnt++ ) {
if( $j == 1 ) {
if( $l[$cnt] =~ /<DIV/ ) {
$j = 0;
next;
}
$l[$cnt] =~ s/<H2/<H1/g;
$l[$cnt] =~ s/<\/H2/<\/H1/g;
}
if( $l[$cnt] =~ /^CLASS=\"CHAP/i ) {
$j = 1;
}
}
$buf = join("\n", @l);
}
$buf =~ s/><DIV\nCLASS="\w+"\n//gms;
$buf =~ s/><\/DIV\n//gms;
$buf =~ s/(><LI\n)><P\n(.*?)<\/P\n>(<\/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;