📄 texi2www
字号:
$origin[$start_index] . " via texi2www -->\n"); &print_header if $header; &printHTML("<HEAD>\n<TITLE>$this</TITLE>\n"); &print_arrows; &printHTML("</P>\n"); } # process_nodesub terminate_node{ if ($nfootnotes) { &printHTML("<P><HR>\n"); for ($n=0; $n < $nfootnotes; ++$n) { &printHTML("<P>\[" . ($n+1) . "\] $footnote[$n]</P>\n"); } } &printHTML("<P><HR>\n"); &print_arrows; &printHTML("</P>\n"); &print_footer if $footer; &printHTML("</BODY></HTML>\n"); close (HTML);}########################################################################sub process_section## On entry:# $_ is the section command (I.e. `@chapter Overview')# $i is the index to $_ in @lines{ &printHTML("$paragraph_end") if $in_paragraph; $in_paragraph = 0; /^\@(\w+)\s+(.*)/; $section_number = ''; if ($1 eq 'chapter') { ++$chapter; $section=$subsection=$subsubsection=0; $section_number = "Chapter $chapter: "; } elsif ($1 eq 'section') { ++$section; $subsection=$subsubsection=0; $section_number = "$chapter.$section: "; } elsif ($1 eq 'subsection') { ++$subsection; $subsubsection=0; $section_number = "$chapter.$section.$subsection: "; } elsif ($1 eq 'subsubsection') { ++$subsubsection; $section_number = "$chapter.$section.$subsection.$subsubsection: "; } elsif ($1 eq 'appendix') { ++$appendix; $section=$subsection=$subsubsection=0; $x = ('A'..'Z')[$appendix-1]; $section_number = "Appendix $x: "; } elsif ($1 eq 'appendixsec') { ++$section; $subsection=$subsubsection=0; $x = ('A'..'Z')[$appendix-1]; $section_number = "$x.$section: "; } elsif ($1 eq 'appendixsubsec') { ++$subsection; $subsubsection=0; $x = ('A'..'Z')[$appendix-1]; $section_number = "$x.$section.$subsection: "; } elsif ($1 eq 'appendixsubsubsec') { ++$subsubsection; $x = ('A'..'Z')[$appendix-1]; $section_number = "$x.$section.$subsection.$subsubsection: "; } $x = $directive_section{$1}; &printHTML("<H$x>$section_number$2</H$x>\n");} # process_section########################################################################sub process_synindex## There's perhaps a bug here -- this presumes the @synindex comes before# any @?index directives; anything already in <from> doesn't get merged# into <to>!#{ local ($code) = @_; # Either 0 or 1; 1 means @syncodeindex /\@syn\w*index\s+(\w+)\s+(\w+)/; print "*** synindex $1 $2\n" if $debug{'index'}; $index_name{$1} = $2 . "index"; $index_style{$1} = 'CODE' if $code;} # process_synindex########################################################################sub printHTML{ local ($line) = @_; $line =~ s/\$R/\}/g; $line =~ s/\$L/\{/g; $line =~ s/\$A/\@/g; $line =~ s/\$D/\$/g; if ($debug{printHTML}) { print $line; } else { print HTML $line; }} # printHTML########################################################################sub print_header{ unless (open(HEADER,$header)) { print "WARNING -- couldn't open header file \"$header\" -- $!\n"; $header = 0; return; } while (<HEADER>) { &printHTML($_); } close(HEADER);}########################################################################sub print_footer{ unless (open(FOOTER,$footer)) { print "WARNING -- couldn't open footer file \"$footer\" -- $!\n"; $footer = 0; return; } while (<FOOTER>) { &printHTML($_); } close(FOOTER);}########################################################################sub read_input## Read the texinfo source into @texinfo. Don't copy comments or the# `@ifxxx' and `@end ifxxx' surrounding [or the contents of] conditional# blocks. Read `@include' files.{ local ($echo,$terminator_re,$started_at) = @_; while (&texinfo_read()) { next if (/^\@c$/ || /^\@c\s/ || /^\@comment/); if (/^\@ifinfo/) { &read_input($echo,'/^\@end\s+ifinfo/', "$texinfo_file[0] line $."); next; } if (/^\@ifnottex/) { &read_input($echo,'/^\@end\s+ifnottex/', "$texinfo_file[0] line $."); next; } if (/^\@ifhtml/) { &read_input($echo,'/^\@end\s+ifhtml/', "$texinfo_file[0] line $."); next; } if (/^\@iftex/) { &read_input(0,'/^\@end\s+iftex/', "$texinfo_file[0] line $."); next; } if (/^\@tex/) { &read_input(0,'/^\@end\s+tex/', "$texinfo_file[0] line $."); next; } if (/^\@ignore/) { # @ignore doesn't nest $ignore_from = "$texinfo_file[0] line $."; while (&texinfo_read()) { last if (/^\@end\s+ignore/); } unless (/^\@end\s+ignore/) { print "Unexpected EOF while searching from $ignore_from " . "for \'\@end ignore\'\n"; } next; } if (/^\@titlepage/) { &read_input(0,'/^\@end\s+titlepage/',"$texinfo_file[0] line $."); next; } if (/^\@ifclear\s+(\S+)/) { &read_input($echo&&(!defined($set{$1})),'/^\@end\s+ifclear/', "$texinfo_file[0] line $."); next; } if (/^\@ifset\s+(\S+)/) { &read_input($echo&&defined($set{$1}),'/^\@end\s+ifset/', "$texinfo_file[0] line $."); next; } return if eval "$terminator_re"; if (/^\@include\s+(\S+)/) { &open_input_file($1); next; } if (/^\@(set|clear)\s+(\S+)/) { if ($1 eq "set") { $set{$2} = 1; } else { undef($set{$2}); } } next unless $echo; if (/^\@(\w+)/) {next if $ignore_these_directives{$1};} # Hide @@, @{, and @} so later on it'll be easier to process # stuff like `@code{@@TeX@{@}}'. s/\$/\$D/g; s/\@\@/\$A/g; s/\@{/\$L/g; s/\@}/\$R/g; # Convert the HTML special characters s/\&/\&/g; s/\</\</g; s/\>/\>/g; s/\"/\"/g; $texinfo[$ntexinfo] = $_; $origin[$ntexinfo] = "$texinfo_file[0] line $."; ++$ntexinfo; } print "Unexpected EOF while searching from $started_at " . "for $terminator_re\n";} # read_input########################################################################sub initialize_tables{ # Lists which `@x{y}' get expanded into `y'. %atxy_2_y = ( 'asis', 1, 'r', 1, 'w', 1, ); # Describes which `@x{y}' get expanded into `<z>y</z>' and what `z' # is in those expansions! (If the expansion matches # ``/(.*),(.*),(.*)/'' then y actually expands to ``$1<$2>y</$2>$3''; # if z (or $2) begins with ^ then uppercase y before doing the # expansion). %atxy_2_zyz= ( 'b', 'STRONG', 'cite', 'CITE', 'code', "CODE", 'dfn', 'EM', 'dmn', 'EM', 'emph', 'EM', 'file', "`,CODE,'", 'i', 'EM', 'kbd', 'KBD', 'key', '^CODE', 'math', 'CODE', 'samp', "`,CODE,'", 'sc', '^EM', 'strong', 'STRONG', 't', 'CODE', 'titlefont', 'CITE', 'var', 'VAR', ); # Describes which `@x{y}' can be expanded into `z' and what `z' is in # those expansions! %atxy_2_z = ( 'TeX', '<i>T</i>e<i>X</i>', 'bullet', '*', 'copyright', '(C)', 'dots', '...', 'equiv', '==', 'error', 'error-->', 'expansion', '==>', 'minus', '-', 'point', '-!-', 'print', '-|', 'result', '=>', 'today', &today(), ); # Lists the '@x{y}' cross reference commands, and describes how they get # expanded. Note the 'X' beginning each expansion -- it's there so 'ref' # doesn't get expanded to ''! %atxy_2_ref = ( 'xref', 'XSee ', 'ref', 'X', 'pxref', 'Xsee ', 'href', 'X', 'uref', 'X', 'email', 'X', 'inforef', 'XSee ', ); %ignore_these_directives = ( 'author', 1, 'break', 1, 'contents', 1, 'evenfooting', 1, 'everyfooting', 1, 'everyheading', 1, 'finalout', 1, 'footnotestyle', 1, 'headings', 1, 'need', 1, 'noindent', 1, 'oddfooting', 1, 'page', 1, 'paragraphindent', 1, 'setchapternewpage', 1, 'setcontentsaftertitlepage', 1, 'setfilename', 1, 'shortcontents', 1, 'shorttitlepage', 1, 'smallbook', 1, 'sp', 1, 'subtitle', 1, 'summarycontents', 1, 'top', 1, 'vskip', 1, ); # List the section directives and indicate what heading level # each one gets. %directive_section = ( 'chapter', 1, 'section', 2, 'subsection', 3, 'subsubsection',4, 'appendix', 1, 'appendixsec', 2, 'appendixsubsec', 3, 'appendixsubsubsec', 4, 'chapheading', 1, 'majorheading', 1, 'heading', 2, 'subheading', 3, 'subsubheading', 4, 'unnumbered', 1, 'unnumberedsec', 2, 'unnumberedsubsec', 3, 'unnumberedsubsubsec', 4, ); # These @ directives begin a block of preformatted text # (">PRE" means indented inside <PRE>...</PRE>) %directive_block = ( 'cartouche', 'HR', 'display', '>PRE', 'example', '>PRE', 'format', 'PRE', 'group', '-', 'lisp', '>PRE', 'quotation', 'BLOCKQUOTE', 'smallexample','>PRE', ); %index_name = ( 'cp', 'cpindex', 'fn', 'fnindex', 'ky', 'kyindex', 'pg', 'pgindex', 'tp', 'tpindex', 'vr', 'vrindex', ); %index_style = ( 'fn', 'CODE', 'ky', 'CODE', 'pg', 'CODE', 'tp', 'CODE', 'vr', 'CODE', );} # initialize_tables########################################################################sub open_input_file{ my $file = "$_[0]" ; if ( not -f "$file" ) { foreach $i ( @include_path ) { if ( -f "$i/$_[0]" ) { $file = "$i/$_[0]"; last ; } } } unshift(@texinfo_file,$file); print "opening $file ...\n" if $debug{open_input_file}; open($texinfo_file[0],$file) || die "Couldn't open $file: $!\n";} # open_input_file########################################################################sub texinfo_read# Reads the next line of texinfo input into $_.{ do { $fd = $texinfo_file[0]; $_ = <$fd>; } while ($_ eq '' && shift @texinfo_file); return $_;} # texinfo_read########################################################################sub today{ $today = `date`; $today =~ s/\w+ (\w+ +[0-9]+) [0-9]+:[0-9]+:[0-9]+ \w+ ([0-9]+)\n/$1 $2/; $today =~ s/ +/ /g; return $today;} # today########################################################################sub copy_to_destdir{ ($copy_from) = @_; if ($copy_from =~ m|(.*)/([^/]*)|) { $copy_from_dir = $1; $copy_from_file = $2; } else { $copy_from_dir = "."; $copy_from_file = $copy_from; } if ($copy_from_dir ne $dir && !-e "$dir/$copy_from_file") { system("cp $copy_from $dir") && die "Couldn\'t \`cp $copy_from $dir\'\n"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -