⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 texi2html

📁 unix上的ODBC实现
💻
📖 第 1 页 / 共 4 页
字号:
#!PATH_TO_PERL -*- perl -*-# Add path to perl on the previous line and make this executable# if you want to use this as a normal script.'di ';'ig 00 ';#+###############################################################################                                                                              ## File: texi2html                                                              ##                                                                              ## Description: Program to transform most Texinfo documents to HTML             ##                                                                              ##-############################################################################### @(#)texi2html	1.52 971230 Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch# Enhanced by David Axmark, david@detron.se# The man page for this program is included at the end of this file and can be# viewed using the command 'nroff -man texi2html'.# Please read the copyright at the end of the man page.#+++#############################################################################                                                                              ## Constants                                                                    ##                                                                              ##---############################################################################$DEBUG_TOC   =  1;$DEBUG_INDEX =  2;$DEBUG_BIB   =  4;$DEBUG_GLOSS =  8;$DEBUG_DEF   = 16;$DEBUG_HTML  = 32;$DEBUG_USER  = 64;$BIBRE = '\[[\w\/]+\]';			# RE for a bibliography reference$FILERE = '[\/\w.+-]+';			# RE for a file name$VARRE = '[^\s\{\}]+';			# RE for a variable name$NODERE = '[^@{}:\'`",]+';		# RE for a node name$NODESRE = '[^@{}:\'`"]+';		# RE for a list of node names$XREFRE = '[^@{}]+';			# RE for a xref (should use NODERE)$ERROR = "***";			        # prefix for errors and warnings$THISPROG = "texi2html 1.52 (hacked by david\@detron.se)";	# program name and version$HOMEPAGE = "http://www.mathematik.uni-kl.de/~obachman/Texi2html/"; # program home page$TODAY = &pretty_date;			# like "20 September 1993"$SPLITTAG = "<!-- SPLIT HERE -->\n";	# tag to know where to split$PROTECTTAG = "_ThisIsProtected_";	# tag to recognize protected sections$html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//EN">';## language dependent constants##$LDC_SEE = 'see';#$LDC_SECTION = 'section';#$LDC_IN = 'in';#$LDC_TOC = 'Table of Contents';#$LDC_GOTO = 'Go to the';#$LDC_FOOT = 'Footnotes';# TODO: @def* shortcuts#$user_sub{"email"} = "fix_email";## pre-defined indices#%predefined_index = (		     'cp', 'c',		     'fn', 'f',		     'vr', 'v',		     'ky', 'k',		     'pg', 'p',		     'tp', 't',		     );## valid indices#%valid_index = (		'c', 1,		'f', 1,		'v', 1,		'k', 1,		'p', 1,		't', 1,		);## texinfo section names to level#%sec2level = (	      'top', 0,	      'chapter', 1,	      'unnumbered', 1,	      'majorheading', 1,	      'chapheading', 1,	      'appendix', 1,	      'section', 2,	      'unnumberedsec', 2,	      'heading', 2,	      'appendixsec', 2,	      'appendixsection', 2,	      'subsection', 3,	      'unnumberedsubsec', 3,	      'subheading', 3,	      'appendixsubsec', 3,	      'subsubsection', 4,	      'unnumberedsubsubsec', 4,	      'subsubheading', 4,	      'appendixsubsubsec', 4,	      );## accent map, TeX command to ISO name#%accent_map = (	       '"',  'uml',	       '~',  'tilde',	       '^',  'circ',	       '`',  'grave',	       '\'', 'acute',	       );## texinfo "simple things" (@foo) to HTML ones#%simple_map = (	       # cf. makeinfo.c	       "*", "<BR>",	# HTML+	       " ", " ",	       "\n", "\n",	       "|", "",	       # spacing commands	       ":", "",	       "!", "!",	       "?", "?",	       ".", ".",	       );## texinfo "things" (@foo{}) to HTML ones#%things_map = (	       'TeX', 'TeX',	       'br', '<P>',	# paragraph break	       'bullet', '*',	       'copyright', '(C)',	       'dots', '...',	       'equiv', '==',	       'error', 'error-->',	       'expansion', '==>',	       'minus', '-',	       'point', '-!-',	       'print', '-|',	       'result', '=>',	       'today', $TODAY,	       );## texinfo styles (@foo{bar}) to HTML ones#%style_map = (	      'asis', '',	      'b', 'B',	      'cite', 'CITE',	      'code', 'CODE',	      'ctrl', '&do_ctrl', # special case	      'dfn', 'STRONG',	# DFN tag is illegal in the standard	      'dmn', '',	# useless	      'email', '&fix_email',	# special	      'emph', 'EM',	      'file', '"TT',	# will put quotes, cf. &apply_style	      'i', 'I',	      'kbd', 'KBD',	      'key', 'KBD',	      'r', '',		# unsupported	      'samp', '"SAMP',	# will put quotes, cf. &apply_style	      'sc', '&do_sc',	# special case	      'strong', 'STRONG',	      't', 'TT',	      'titlefont', '',	# useless	      'image', '&fix_image',	# Image	      'url', '&fix_url',	# URL	      'uref', '&fix_uref',	# URL Reference	      'var', 'VAR',	      'w', '',		# unsupported	      );## texinfo format (@foo/@end foo) to HTML ones#%format_map = (	       'display', 'PRE',	       'example', 'PRE',	       'format', 'PRE',	       'lisp', 'PRE',	       'quotation', 'BLOCKQUOTE',	       'smallexample', 'PRE',	       'smalllisp', 'PRE',	       # lists	       'itemize', 'UL',	       'enumerate', 'OL',	       # poorly supported	       'flushleft', 'PRE',	       'flushright', 'PRE',	       );## texinfo definition shortcuts to real ones#%def_map = (	    # basic commands	    'deffn', 0,	    'defvr', 0,	    'deftypefn', 0,	    'deftypevr', 0,	    'defcv', 0,	    'defop', 0,	    'deftp', 0,	    # basic x commands	    'deffnx', 0,	    'defvrx', 0,	    'deftypefnx', 0,	    'deftypevrx', 0,	    'defcvx', 0,	    'defopx', 0,	    'deftpx', 0,	    # shortcuts	    'defun', 'deffn Function',	    'defmac', 'deffn Macro',	    'defspec', 'deffn {Special Form}',	    'defvar', 'defvr Variable',	    'defopt', 'defvr {User Option}',	    'deftypefun', 'deftypefn Function',	    'deftypevar', 'deftypevr Variable',	    'defivar', 'defcv {Instance Variable}',	    'defmethod', 'defop Method',	    # x shortcuts	    'defunx', 'deffnx Function',	    'defmacx', 'deffnx Macro',	    'defspecx', 'deffnx {Special Form}',	    'defvarx', 'defvrx Variable',	    'defoptx', 'defvrx {User Option}',	    'deftypefunx', 'deftypefnx Function',	    'deftypevarx', 'deftypevrx Variable',	    'defivarx', 'defcvx {Instance Variable}',	    'defmethodx', 'defopx Method',	    );## things to skip#%to_skip = (	    # comments	    'c', 1,	    'comment', 1,	    # useless	    'contents', 1,	    'shortcontents', 1,	    'summarycontents', 1,	    'footnotestyle', 1,	    'end ifclear', 1,	    'end ifset', 1,	    'titlepage', 1,	    'end titlepage', 1,	    # unsupported commands (formatting)	    'afourpaper', 1,	    'cropmarks', 1,	    'finalout', 1,	    'headings', 1,	    'need', 1,	    'page', 1,	    'setchapternewpage', 1,	    'everyheading', 1,	    'everyfooting', 1,	    'evenheading', 1,	    'evenfooting', 1,	    'oddheading', 1,	    'oddfooting', 1,	    'smallbook', 1,	    'vskip', 1,	    'filbreak', 1,	    # unsupported formats	    'cartouche', 1,	    'end cartouche', 1,	    'group', 1,	    'end group', 1,	    );#+++#############################################################################                                                                              ## Argument parsing, initialisation                                             ##                                                                              ##---############################################################################%value = ();			# hold texinfo variables$use_bibliography = 1;$use_acc = 0;$debug = 0;$doctype = '';$check = 0;$expandinfo = 0;$use_glossary = 0;$invisible_mark = '';$use_iso = 0;@include_dirs = ();$show_menu = 0;$number_sections = 0;$split_node = 0;$split_chapter = 0;$monolithic = 0;$verbose = 0;$opt_use_numbers = 0;$opt_empty_headers = 0;$opt_special_links = "";$usage = <<EOT;This is $THISPROGTo convert a Texinfo file to HMTL: $0 [options] filewhere options can be:-expandinfo    : use \@ifinfo sections, not \@iftex-glossary      : handle a glossary-invisible name: use 'name' as an invisible anchor-I dir         : search also for files in 'dir'-Dvar=value    : define a variable, as with \@set-menu          : handle menus-monolithic    : output only one file including ToC-number        : number sections-split_chapter : split on main sections-split_node    : split on nodes-ref_num       : use numeric names when spliting-empty_headers : no headers and implicit links (for inclusion into other documents)-usage         : print usage instructions-verbose       : verbose outputTo check converted files: $0 -check [-verbose] filesEOT  # while ($#ARGV >= 0 && $ARGV[0] =~ /^-/){  $_ = shift(@ARGV);  if (/^-acc$/)            { $use_acc = 1; next; }  if (/^-d(ebug)?(\d+)?$/) { $debug = $2 || shift(@ARGV); next; }  if (/^-doctype$/)        { $doctype = shift(@ARGV); next; }  if (/^-c(heck)?$/)       { $check = 1; next; }  if (/^-e(xpandinfo)?$/)  { $expandinfo = 1; next; }  if (/^-g(lossary)?$/)    { $use_glossary = 1; next; }  if (/^-i(nvisible)?$/)   { $invisible_mark = shift(@ARGV); next; }  if (/^-iso$/)            { $use_iso = 1; next; }  if (/^-I(.+)?$/)         { push(@include_dirs, $2 || shift(@ARGV)); next; }  if (/^-D([a-zA-Z0-9]+)=?(.+)?$/)			   { $value{$1} = $2 ? $2 : 1; next; }  if (/^-m(enu)?$/)        { $show_menu = 1; next; }  if (/^-mono(lithic)?$/)  { $monolithic = 1; next; }  if (/^-n(umber)?$/)      { $number_sections = 1; next; }  if (/^-ref_num$/)        { $opt_use_numbers = 1; next; }  if (/^-empty_headers$/)  { $opt_empty_headers = 1; next; }  if (/^-special_links$/)  { $opt_special_links = $2 || shift(@ARGV); next; }  if (/^-s(plit)?_?(n(ode)?|c(hapter)?)?$/) {    if ($2 =~ /^n/) {      $split_node = 1;    } else {      $split_chapter = 1;    }    next;  }  if (/^-v(erbose)?$/)     { $verbose = 1; next; }  die $usage;}if ($check) {  die $usage unless @ARGV > 0;  &check;  exit;}die "Can't use -special_links with -ref_num.\n"  if $opt_special_links && $opt_use_numbers;die "Must have -split_node with -special_links.\n"  if $opt_special_links && !$split_node;if (($split_node || $split_chapter) && $monolithic) {  warn "Can't use -monolithic with -split, -monolithic ignored.\n";  $monolithic = 0;}if ($expandinfo) {  $to_skip{'ifinfo'}++;  $to_skip{'end ifinfo'}++;} else {  $to_skip{'iftex'}++;  $to_skip{'end iftex'}++;}$invisible_mark = '<IMG SRC="invisible.xbm">' if $invisible_mark eq 'xbm';die $usage unless @ARGV == 1;$docu = shift(@ARGV);if ($docu =~ /.*\//) {  chop($docu_dir = $&);  $docu_name = $';} else {  $docu_dir = '.';  $docu_name = $docu;}unshift(@include_dirs, $docu_dir);$docu_name =~ s/\.te?x(i|info)?$//; # basename of the document$docu_doc = "$docu_name.html"; # document's contents$link_doc = $docu_doc;if ($monolithic) {  $docu_toc = $docu_foot = $docu_doc;} else {  $docu_toc  = "${docu_name}_toc.html"; # document's table of contents  $docu_foot = "${docu_name}_foot.html"; # document's footnotes}## variables#$value{'html'} = 1;		# predefine html (the output format)$value{'texi2html'} = '1.52';	# predefine texi2html (the translator)# _foo: internal to track @fooforeach ('_author', '_title', '_subtitle',	 '_settitle', '_setfilename') {  $value{$_} = '';		# prevent -w warnings}%node2sec = ();		# node to section name%node2href = ();	# node to HREF%bib2href = ();		# bibliography reference to HREF%gloss2href = ();	# glossary term to HREF@sections = ();		# list of sections%tag2pro = ();		# protected sections## initial indexes#$bib_num = 0;$foot_num = 0;$gloss_num = 0;$idx_num = 0;$sec_num = 0;$doc_num = 0;$current_chapter_link = "";@maybe_wrong_links = ();$html_num = 0;## can I use ISO8879 characters? (HTML+)#if ($use_iso) {  $things_map{'bullet'} = "&bull;";  $things_map{'copyright'} = "&copy;";  $things_map{'dots'} = "&hellip;";  $things_map{'equiv'} = "&equiv;";  $things_map{'expansion'} = "&rarr;";  $things_map{'point'} = "&lowast;";  $things_map{'result'} = "&rArr;";}## read texi2html extensions (if any)#$extensions = 'texi2html.ext'; # extensions in working directoryif (-f $extensions) {  print "# reading extensions from $extensions\n" if $verbose;  require($extensions);}($progdir = $0) =~ s/[^\/]+$//;if ($progdir && ($progdir ne './')){  $extensions = "${progdir}texi2html.ext"; # extensions in texi2html directory  if (-f $extensions) {    print "# reading extensions from $extensions\n" if $verbose;    require($extensions);  }}  print "# reading from $docu\n" if $verbose;#+++#############################################################################                                                                              ## Pass 1: read source, handle command, variable, simple substitution           ##                                                                              ##---############################################################################@lines = ();			# whole document@toc_lines = ();		# table of contents$toplevel = 0;			# top level seen in hierarchy$curlevel = 0;			# current level in TOC$node = '';			# current node name$in_table = 0;			# am I inside a table$table_type = '';		# type of table ('', 'f', 'v')@tables = ();			# nested table support$in_bibliography = 0;		# am I inside a bibliography$in_glossary = 0;		# am I inside a glossary$in_top = 0;			# am I inside the top node$in_pre = 0;			# am I inside a preformatted section$in_list = 0;			# am I inside a list$in_html = 0;			# am I inside an HTML section$first_line = 1;		# is it the first line$dont_html = 0;			# don't protect HTML on this line$split_num = 0;			# split index$deferred_ref = '';		# deferred reference for indexes@html_stack = ();		# HTML elements stack$html_element = '';		# current HTML element&html_reset;# build code for simple substitutions# the maps used (%simple_map and %things_map) MUST be aware of this# watch out for regexps, / and escaped characters!$subst_code = '';foreach (keys(%simple_map)) {  ($re = $_) =~ s/(\W)/\\$1/g;	# protect regexp chars  $subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n";}foreach (keys(%things_map)) {  $subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n";}if ($use_acc) {  # accentuated characters  foreach (keys(%accent_map)) {    if ($_ eq "`") {      $subst_code .= "s/$;3";    } elsif ($_ eq "'") {      $subst_code .= "s/$;4";    } else {      $subst_code .= "s/\\\@\\$_";    }    $subst_code .= "([aeiou])/&\${1}$accent_map{$_};/gi;\n";  }}eval("sub simple_substitutions { $subst_code }");&init_input;READ_LINE: while ($_ = &next_line){  #  # remove \input on the first lines only  #  if ($first_line) {    next if /^\\input/;    $first_line = 0;  }  #  # parse texinfo tags  #  $tag = '';  $end_tag = '';  if (/^\s*\@end\s+(\w+)\b/) {    $end_tag = $1;  } elsif (/^\s*\@(\w+)\b/) {    $tag = $1;  }  #  # handle @ifhtml / @end ifhtml  #  if ($in_html) {    if ($end_tag eq 'ifhtml') {      $in_html = 0;    } else {      $tag2pro{$in_html} .= $_;    }    next;  } elsif ($tag eq 'ifhtml') {    $in_html = $PROTECTTAG . ++$html_num;    push(@lines, $in_html);    next;  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -