[Commits] python.it commit r179 - www/branches/zonapython/scripts/ltoh

commit a svn.python.it commit a svn.python.it
Dom 11 Giu 2006 12:09:50 CEST


Author: manlio
Date: Sun Jun 11 12:09:49 2006
New Revision: 179

Added:
   www/branches/zonapython/scripts/ltoh/
   www/branches/zonapython/scripts/ltoh/README
   www/branches/zonapython/scripts/ltoh/c++.lang
   www/branches/zonapython/scripts/ltoh/html_header.html
   www/branches/zonapython/scripts/ltoh/html_header_footer.html
   www/branches/zonapython/scripts/ltoh/index.html
   www/branches/zonapython/scripts/ltoh/index.pl
   www/branches/zonapython/scripts/ltoh/java.lang
   www/branches/zonapython/scripts/ltoh/langs.txt
   www/branches/zonapython/scripts/ltoh/lib.pl
   www/branches/zonapython/scripts/ltoh/ltoh.pl
   www/branches/zonapython/scripts/ltoh/make_book_html.pl
   www/branches/zonapython/scripts/ltoh/parse.pl
   www/branches/zonapython/scripts/ltoh/perl.lang
   www/branches/zonapython/scripts/ltoh/python.lang
   www/branches/zonapython/scripts/ltoh/readme.txt
   www/branches/zonapython/scripts/ltoh/sql.lang
   www/branches/zonapython/scripts/ltoh/style.html
   www/branches/zonapython/scripts/ltoh/syntax.pl
   www/branches/zonapython/scripts/ltoh/toc.pl
Log:
aggiunto LaTeX to HTML, usato by Thinking in Python

Added: www/branches/zonapython/scripts/ltoh/README
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/README	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,3 @@
+Utilizzo:
+
+	make_book_html.pl source_dir dest_dir [Italian]
\ No newline at end of file

Added: www/branches/zonapython/scripts/ltoh/c++.lang
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/c++.lang	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,69 @@
+S 2
+// \n
+/* */
+asm
+auto
+bad_cast
+bad_typeid
+bool
+break
+case
+catch
+char
+class
+const
+const_cast
+continue
+default
+delete
+do
+double
+dynamic_cast
+else
+enum
+except
+explicit
+extern
+false
+finally
+float
+for
+friend
+goto
+if
+inline
+int
+long
+mutable
+namespace
+new
+operator
+private
+protected
+public
+register
+reinterpret_cast
+return
+short
+signed
+sizeof
+static
+static_cast
+struct
+switch
+template
+this
+throw
+true
+try
+type_info
+typedef
+typeid
+typename
+union
+unsigned
+using
+virtual
+void
+volatile
+while

Added: www/branches/zonapython/scripts/ltoh/html_header.html
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/html_header.html	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>$title</title>
+
+<style type="text/css">
+<!--
+body {background-color: white; color: black;}
+a {background-color: white; color: blue; text-decoration: underline;}
+a:hover {text-decoration: none;}
+td.head,td.headcenter {background-color: #99ccff; color: black;}
+td.headcenter {width: 100%; text-align: center;}
+img {border-style: none;}
+-->
+</style>
+
+</head>
+
+<body>

Added: www/branches/zonapython/scripts/ltoh/html_header_footer.html
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/html_header_footer.html	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,13 @@
+<hr>
+<table width="100%" cellpadding="0" cellspacing="2" border="0">
+  <tr>
+    <td width="20" class=head><a href="$next.htm"><img border="0" alt="Next" src="images/next.png"></a></td>
+    <td width="20" class=head><a href="index.htm"><img border="0" alt="Up" src="images/up.png"></a></td>
+    <td width="20" class=head><a href="$previous.htm"><img border="0" alt="Previous" src="images/prev.png"></a></td>
+    <td width="100%" class=headcenter><img border="0" alt="Hi" src="images/headertitle.png"></td>
+    <td width="20" class=head><img border="0" alt="" src="images/blank.png"></td>
+    <td width="20" class=head><a href="dex.htm"><img border="0" alt="Index" src="images/index.png"></a></td>
+    <td width="20" class=head><img border="0" alt="" src="images/blank.png"></td>
+  </tr>
+</table>
+<hr>

Added: www/branches/zonapython/scripts/ltoh/index.html
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/index.html	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,41 @@
+<html>
+<head>
+  <title>Latex-to-HTML homepage</title>
+<style type=text/css>
+<!--
+body {background-color: white;}
+-->
+</style>
+</head>
+
+<body>
+
+<table width=600 cellspacing=0 cellpadding=0>
+<tr>
+<td><h2>Latex-to-HTML Homepage</h2></td>
+</tr>
+<tr>
+<td>
+Latex-to-HTML is a batch of Perl scripts which can be used to convert Latex book documentation into web-friendly HTML.  It also includes a syntax highlighter which will automatically detect which programming language is being used in a particular latex file and create color-highlighted text.
+<p>The syntax highlighter can also be used independently of the Latex-to-HTML converter, so syntax.zip is provided as a separate download as well as being included in the main Latex-to-HTML distribution.
+<p>This program is currently being used to publish three versions of the book <a href="http://www.ibiblio.org/obp/thinkCS.html">How To Think Like a Computer Scientist</a> on the <a href="http://www.ibiblio.org/obp/">Open Book Project</a>.
+</td>
+</tr>
+<tr>
+<td align=center>
+<br>
+<table>
+<tr><th>File</th><th width=100></th><th>Last Updated</th></tr>
+<tr><td><a href="ltoh.zip">ltoh.zip</a></td><td></td><td>June 27, 2002</td></tr>
+<tr><td><a href="syntax.zip">syntax.zip</a></td><td></td><td>June 27, 2002</td></tr>
+</table>
+</td>
+</tr>
+<tr>
+<td align=center height=50 valign=bottom>
+<a href="mailto:jonah a ibiblio.org"><i>Contact the author</i></a>
+</td>
+</tr>
+</table>
+</body>
+</html>

Added: www/branches/zonapython/scripts/ltoh/index.pl
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/index.pl	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,135 @@
+#!/usr/bin/perl
+
+require 'lib.pl';
+
+if(scalar(@ARGV) < 2)
+{
+  print <<EOF;
+
+Index Generator
+by Jonah Cohen <jonah\@ibiblio.org>
+http://www.ibiblio.org/obp/ltoh/
+
+Usage:
+  $0 source_dir dest_dir [language]
+
+EOF
+  exit(0);
+}
+
+load($ARGV[2]);
+
+open(TOP, "$ARGV[0]/top.tex") || die("Can't open $ARGV[0]/top.tex\n");
+$_ = <TOP>;
+close(TOP);
+$previous = $1 while s/^[^%\n]*\\include\s*\{([^\}]*)\}//m;
+
+open(INDEX, ".index_lst") || die("Can't open .index_lst\n");;
+foreach (split /\n/,<INDEX>)
+{
+  /(.*)\t(.*)/;
+  $index{$1} = $2;
+}
+close(INDEX);
+
+open(OUTPUT, ">$ARGV[1]/dex.htm") || die("Can't write to $ARGV[1]/dex.htm\n");
+
+open(HEADER, "html_header.html") || die("Can't read from html_header.html\n");
+$header = languagestrings(<HEADER>);
+close(HEADER);
+
+open(HEADERFOOTER, "html_header_footer.html") || die("Can't read from html_header_footer.html\n");
+$headerfooter = languagestrings(<HEADERFOOTER>);
+close(HEADERFOOTER);
+
+$header =~ s/\$title/$Index/g;
+
+$headerfooter =~ s/\$next/index/;
+$headerfooter =~ s/\$previous/$previous/;
+
+print "Creating Index\n";
+
+#write HTML header
+print OUTPUT <<EOF;
+$header
+$headerfooter
+
+<h1>$Index</h1>
+
+<table border="0" cellspacing="0" cellpadding="20">
+<tr>
+<td valign="top" width="50%">
+<font size=2>
+EOF
+
+#sort items alphabetically (case-insensitive)
+ a items = sort {letters($a) cmp letters($b)} keys %index;
+
+sub letters
+{
+  $_ = uc pop;
+  s/<[^>]+>//g;
+  return $_;
+}
+
+$i = 0;
+$n = int((scalar(@items)+1)/2);
+foreach (@items)
+{
+  $i++;
+
+  if(s/\|([^\{]*)\{\s*([^\}]*)\}?/... $1 $2/)
+  {
+  	($_, $b) = latex($_);
+    print OUTPUT "$_<br>\n";
+    next;
+  }
+
+  @links = split /,/, $index{$_};
+
+  s/^.+\!(.+)$/&nbsp; &nbsp; &nbsp; $1/;
+  s/\!//g;
+  print OUTPUT "$_... ";
+
+  while ($_ = shift @links)
+  {
+    /-/;
+    $link = $';
+    ($_, $b) = latex($`);
+    print OUTPUT "<a href=$link>$_</a>";
+    if(scalar(@links) > 0)
+    {
+      print OUTPUT ", ";
+    }
+    else
+    {
+      print OUTPUT "\n";
+    }
+  }
+
+  if($i == $n)
+  {
+    print OUTPUT <<EOF
+</font>
+</td>
+<td valign="top" width="50%">
+<font size=2>
+EOF
+  }
+  else
+  {
+    print OUTPUT "<br>";
+  }
+}
+
+#write HTML footer
+print OUTPUT <<EOF;
+</font>
+</tr>
+</table>
+$headerfooter
+</body>
+</html>
+EOF
+
+close(OUTPUT);

Added: www/branches/zonapython/scripts/ltoh/java.lang
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/java.lang	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,53 @@
+S 2
+// \n
+/* */
+abstract
+boolean
+break
+byte
+case
+catch
+char
+class
+const
+continue
+default
+do
+double
+else
+extends
+false
+final
+finally
+float
+for
+goto
+if
+implements
+import
+instanceof
+int
+long
+interface
+native
+new
+null
+package
+private
+protected
+public
+return
+short
+static
+super
+switch
+synchronized
+this
+throw
+throws
+transient
+true
+try
+void
+volatile
+while

Added: www/branches/zonapython/scripts/ltoh/langs.txt
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/langs.txt	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,35 @@
+[Italian]
+Chapter = Capitolo
+Appendix = Appendice
+Index = Indice
+TOC = Sommario
+Next = Successivo
+Previous = Precedente
+Up = Sopra di un livello
+
+[English]
+Chapter = Chapter
+Appendix = Appendix
+Index = Index
+TOC = Table of Contents
+Next = Next
+Previous = Previous
+Up = Up
+
+[German]
+Chapter = Kapitel
+Appendix = Anhang
+Index = Register
+TOC = Inhalt
+Next = Weiter
+Previous = Zurück
+Up = Rauf
+
+[Spanish]
+Chapter = Capítulo
+Appendix = Apéndice
+Index = Índice
+TOC = Índice de Materias
+Next = Siguiente
+Previous = Subir un Nivel
+Up = Subir un Nivel

Added: www/branches/zonapython/scripts/ltoh/lib.pl
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/lib.pl	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,367 @@
+undef $/;
+
+$sec = 0;
+
+sub latex
+{
+  my ($m, $p);
+
+  $p = "";
+
+  $_ = ignore($_[0]);
+
+  while(/[\\\{\}\%\$\&\<\>\|]|([\"\'\`\n])\1|\-{3}|\w*~/)
+  {
+    if($` ne "")
+    {
+      $_ = $& . $';
+      $p .= languagestrings($`);
+    }
+    else
+    {
+      return ("$_[2]$p$_[3]", $') if /^\}/ || /^$/ || $_[1] =~ /./ && /^$_[1]/;
+
+      ($m, $_) = latextag($_, $_[1]);
+      $p .= $m;
+    }
+
+    $_ = ignore($_);
+  }
+
+  return ("$_[2]$p$_$_[3]", "");
+}
+
+sub ignore
+{
+  $_ = $_[0];
+
+  my ($m, $p);
+
+  $p = "";
+
+  while(1)
+  {
+    if(/^\n+/)
+    {
+      $_ = $';
+      $p .= $&;
+      next;
+    }
+    next if !(/^%!--feedback\s/) && s/^%[^\n]*//;
+    next if s/^\\(pagebreak|noindent|before\S*|after\S*)//;
+    next if s/^\\(begin|end)\s*\{flushleft\}//;
+    if(/^\\(index|label|vspace|adjustpage)\s*\{/)
+    {
+      ($m, $_) = latex($', $_[1]);
+      next;
+    }
+    if(/^\\(begin|end)\s*\{([^\}]+)\}/)
+    {
+      $m = $';
+
+      unless($2 =~ /^(itemize|enumerate|description|quote|eqnarray|equation|verbatim|table|tabular)\*?$/)
+      {
+        $_ = $m;
+        next;
+      }
+    }
+    last;
+  }
+
+  return $p . $_;
+}
+
+sub latextag
+{
+  $_ = $_[0];
+
+  my ($l, $m, $c);
+
+  #feedback comments
+  return ("<!--feedback $1 -->\n", $') if /^%!--feedback\s+([^\n]*)/;
+
+  #new paragraph
+  if(/^\n{2,}/)
+  {
+    $_ = ignore($');
+    return (/^\\\w/ ? "\n\n" : "\n<p>\n", $_);
+  }
+
+  #special characters
+  return ("<br>", $') if /^\\\\/;
+  return ("&lt;", $') if /^\\?</;
+  return ("&gt;", $') if /^\\?>/;
+  return ("\"", $') if /^(``|'')/;
+  return ($1, $') if /^\\([\_\#\&\%\{\}\[\]\$])/;
+  return ("&copy;", $') if /^\\copyright/;
+  return ("", $') if /^\\-/;
+  return (" <s>&nbsp; &nbsp;</s> ", $') if /^---/;
+
+  #accents
+  my %accents = ("'","acute","`","grave","\"","uml","~","tilde","^","circ");
+  return ("&$2$accents{$1};", $') if /^\\(['`"~^])\{\\?(\w)\}/;
+
+  #references
+  return ("<a href=\"$labellinks{$2}\">$1 $labels{$2}</a>", $') if /^(\w*)~\\ref\s*\{([^\}]*)\}/;
+
+  #to ignore \Latex~input
+  return ("$1 ", $') if /^\\(\w+)~/;
+
+  #tt tags
+  if(/^\{\\tt\s+/)
+  {
+    $_ = $';
+    $l = "";
+
+    #check for hyperlinks
+    $l = "<a href=\"mailto:$1\">$1<\/a>" if /^(\S+@\S+)\s*\}/;
+    $l = "<a href=\"$1\">$1<\/a>" if /^((ht|f)tp:\/\/\S+)\s*\}/;
+    $l = "<a href=\"http:\/\/$1\">$1<\/a>" if /^(www\.\S+)\s*\}/;
+
+    return ($l, $') if $l ne "" && /\}/;
+
+    #no hyperlinks
+    return latex($_, $_[1], "<code>", "</code>");
+  }
+
+  #basic formatting tags
+  return latex($', $_[1], "<b>", "</b>") if /^\{\\bf\s*/;
+  return latex($', $_[1], "<b>", "</b>") if /^\\textbf\s*\{/;
+  return latex($', $_[1], "<i>", "</i>") if /^\{\\em\s*/;
+  return ("<code>$2</code>", $') if /^\\verb(\W)(.*?)\1/;
+  return ("<code>$2</code>", $') if /^\{\\verb(\W)(.*?)\1\}/;
+
+  #part of index tags
+  if(/^\|([^\{]*)\{/)
+  {
+    $m = $1;
+    ($l, $_) = latex($', $_[1]);
+    return ("|$m\{$l\}", $_);
+  }
+
+  return latex($& . $', $_[1]) if /^\|see\s*\{/;
+
+  #footnotes
+  if(/^\\footnote\s*\{/)
+  {
+    ($l, $_) = latex($', $_[1]);
+    $l =~ s/\'/\\\'/g;
+    return (" <a href=\"javascript:fn(\'$l\')\">* Note<\/a>", $_);
+  }
+
+  #chapters
+  return latex($', $_[1], "<h1>", "</h1>") if /^\\chapter\s*\{/;
+
+  #sections
+  return latex($', $_[1], "\n<h3>", "</h3>") if /^\\section\*\s*\{/;
+  if(/^\\section\s*\{/)
+  {
+    ($l, $_) = latex($', $_[1]);
+
+    if($ischapter)
+    {
+      $sec++;
+      return latex($', $_[1], "<a name=$sec><\/a>\n<h3>$chap.$sec ", "<\/h3>");
+    }
+
+    return latex($', $_[1], "\n<h3>", "<\/h3>");
+  }
+
+  #subsections and subsubsections
+  return latex($', $_[1], "<h4>", "</h4>") if /^\\(sub)+section\*?\s*\{/;
+
+  #list items
+  return latex($', "\\n{2,}", "<dt>" . (join "",latex($1)) . "</dt>\n<dd>", "</dd>\n") if /^\\item\s*\[([^:\]]*):?\]\s*/;
+  return latex($', "\\n{2,}", "<li>", "</li>\n") if /^\\item\s*/;
+
+  #unordered lists
+  return ("<ul>", $') if /^\\begin\s*\{itemize\}\n/;
+  return ("</ul>", $') if /^\\end\s*\{itemize\}/;
+
+  #ordered lists
+  return ("<ol>", $') if /^\\begin\s*\{enumerate\}\n/;
+  return ("</ol>", $') if /^\\end\s*\{enumerate\}/;
+
+  #definition lists
+  return ("<dl>", $') if /^\\begin\s*\{description\}\n/;
+  return ("</dl>", $') if /^\\end\s*\{description\}/;
+
+  #blockquotes
+  return ("<blockquote>", $') if /^\\begin\s*\{quote\}\n/;
+  return ("</blockquote>", $') if /^\\end\s*\{quote\}/;
+
+  #images
+  return ("<p align=\"center\"><img src=\"$1.png\"><\/p>", $') if /^\\centerline\s*\{\\psfig\s*\{figure=([^\.]*)[^\}]*\}\s*\}/;
+
+  #centered text (?)
+  return latex($', $_[1], "<b>", "</b>") if /^\\centerline\s*\{/;
+
+  #math
+  return math($', "<tt>", "</tt>") if /^\$/;
+  return math($', "<p>\n<table align=center><tr><td><tt>\n", "</tt></td></tr></table>\n\n") if /^\\begin\s*\{(eqnarray|equation)\*?\}\n/;
+
+  #verbatim
+  return verbatim($', "<pre>", "</pre>") if /^\\begin\s*\{verbatim\*?\}\n/;
+
+  #table
+  return table($', "<p>\n<table align=center>", "</table>") if /^\\begin\s*\{(table|tabular)\*?\}/;
+
+
+  #not recognized, so skip char
+  return ($&, $') if /^./;
+}
+
+sub math
+{
+  my ($m, $p);
+
+  $_ = $_[0];
+  s/^\s+//;
+
+  $p = "";
+
+  while(/[\\\{\}\$\_\^\&]/)
+  {
+    $m = $& . $';
+    $p .= $`;
+
+    return ("$_[1]$p$_[2]", $') if $m =~ /^(\}|\$|\\end\s*\{(eqnarray|equation)\*?\})/;
+
+    ($m, $_) = mathtag($m);
+
+    $p .= $m;
+  }
+
+  return ("$_[1]$p$_$_[2]", "");
+}
+
+sub mathtag
+{
+  my ($l, $m);
+
+  $_ = $_[0];
+
+  return ("<br>", $') if /^\\\\\s*/;
+
+  return ("", $') if /^&&\s*/;
+  return ("=", $') if /^&\s+=\s+&/;
+  return ("&copy;", $') if /^\\copyright/;
+
+  #superscript and subscript
+  return math($', "<sub>", "</sub>") if /^_\s*\{/;
+  return ("<sub>$1</sub>", $') if /^_(.)/;
+  return math($', "<sup>", "</sup>") if /^\^\s*\{/;
+  return ("<sup>$1</sup>", $') if /^\^(.)/;
+
+  #fractions
+  if(/^\\frac\s*\{/)
+  {
+    ($l, $_) = math($', "<tr><td>", "<\/td><\/tr>");
+    ($m, $_) = math($', "<tr><td><hr noshade color=black><\/td><\/tr><tr><td>", "<\/td><\/tr>") if /^\s*\{/;
+    return ("<table style=\"display: inline; align: center; vertical-align: middle;\">$l$m</table>", $_);
+  }
+
+  #math functions
+  return math($', "<table style=\"display: inline; vertical-align: middle;\"><tr><td rowspan=2 valign=bottom><font size=5>&radic;<\/font><\/td><td><hr noshade color=black><\/td><\/tr><tr><td>", "<\/tr><\/table> ") if /^\\sqrt\s*\{/;
+  return ("$1<sub>$2</sub>", $') if /^\\(log|ln)_(\w+)/;
+  return ("$1", $') if /^\\((log|ln)|(arc)?(sin|cos|tan))/;
+  return math($', "<big><i>", "</i></big>") if /^\\mathcal\s*\{/;
+
+  #special chars
+  return ("&lt;", $') if /^</;
+  return ("$gt;", $') if /^>/;
+  return ("-&gt;", $') if /^\\mapsto/;
+  return ("\\", $') if /^\\backslash/;
+  return ($1, $') if /^\\(pi|theta)/;
+  return ("&middot;" x 3, $') if /^\\cdots/;
+  return ("&middot;", $') if /^\\cdot/;
+  return ("\$", $') if /^\\\$/;
+
+  #remove any other backslashes
+  return ("", $') if /^\\/;
+
+
+  #not recognized, so skip char
+  return ($&, $') if /^./;
+}
+
+sub verbatim
+{
+  my $p;
+
+  $_ = $_[0];
+
+  /\\end\s*\{verbatim\*?\}/;
+
+  $p = $`;
+  $_ = $';
+
+  $p =~ s/\\\\/\\/g;
+  $p =~ s/&/&amp;/g;
+  $p =~ s/</&lt;/g;
+  $p =~ s/>/&gt;/g;
+
+  return ("<pre>\n$p</pre>", $_);
+}
+
+sub table
+{
+  my ($l, $p, $r, $col, %alignalias, @align);
+
+  $_ = $_[0];
+  s/^\s+//;
+
+  %alignalias = ("l", "left", "r", "right", "c", "center");
+
+  @align = map $alignalias{$_}, split /\s+/, $1 if /^\{(\w(\s+\w)*)\}/;
+
+  s/^[^\n]*\n//;
+
+  $p = "";
+  $r = "";
+  $col = 0;
+
+  until(/^\}/)
+  {
+    ($l, $_) = latex($_, "(&|\\\\\\\\|\\\\end\\s*\\{(table|tabular)\\*?)");
+
+    $r .= "<td align=$align[$col]>$l</td>";
+    $col++;
+
+    if(/^\s*\n/)
+    {
+      $_ = $';
+      $p .= "<tr>$r</tr>";
+      $r = "";
+      $col = 0;
+    }
+  }
+
+  $p .= "<tr>$r</tr>" if $r ne "";
+
+  /^\}/;
+  return ("$_[1]$p$_[2]", $');
+}
+
+sub languagestrings
+{
+  my $s = pop;
+  $s =~ s/$strings/$strings{$&}/g;
+  return $s;
+}
+
+sub load
+{
+  open FILE,"langs.txt";
+  my $b = $/;
+  $/ = undef;
+  $_ = <FILE>;
+  $/ = $b;
+  $_ = $& if /^\[$_[0]\][^\[\]]*/mi || /^\[English\][^\[\]]*/mi;
+  #load language-dependent strings
+  $strings{$1} = $2 while s/^(\S+)\s*=\s*(.+)$//mi;
+  $strings = join "|",keys %strings;
+  ${$_} = $strings{$_} foreach (keys %strings);
+}
+
+1;

Added: www/branches/zonapython/scripts/ltoh/ltoh.pl
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/ltoh.pl	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,129 @@
+#!/usr/bin/perl
+
+require 'lib.pl';
+
+if(scalar(@ARGV) < 3)
+{
+  print <<EOF;
+
+Latex-to-HTML converter
+by Jonah Cohen <jonah\@ibiblio.org>
+http://www.ibiblio.org/obp/ltoh/
+
+Usage:
+  $0 filename source_dir dest_dir [language]
+
+Converts from source_dir/filename.tex to dest_dir/filename.htm
+
+EOF
+  exit(0);
+}
+
+load($ARGV[3]);
+
+open INPUT, "$ARGV[1]/$ARGV[0].tex" || die "Can't read from $ARGV[1]/$ARGV[0].htm\n";
+$b = $/;
+$/ = undef;
+$lines = <INPUT>;
+$/ = $b;
+close INPUT;
+
+$chapnum = $ARGV[0];
+$chapnum =~ s/[^\d]//g;
+$chap = $chapnum;
+$chap =~ s/^0//;
+
+open OUTPUT, ">$ARGV[2]/$ARGV[0].htm" || die "Can't write to $ARGV[2]/$ARGV[0].htm\n";
+
+push @files,"index";
+open TOP, "$ARGV[1]/top.tex" || die "Can't read from $ARGV[1]/top.tex\n";
+$_ = <TOP>;
+close TOP;
+push @files, $1 while s/^[^%\n]*\\include\s*\{([^\}]*)\}//m;
+push @files, "dex";
+
+open LABELS, ".labels_lst";
+foreach (split /\n/,<LABELS>)
+{
+  /(.*)\t(.*)\t(.*)/;
+  $labels{$1} = $2;
+  $labellinks{$1} = $3;
+}
+close LABELS;
+
+open INDEX, ".index_lst";
+foreach (split /\n/,<INDEX>)
+{
+  /(.*)\t(.*)/;
+  $index{$1} = $2;
+}
+close INDEX;
+
+open HEADER, "html_header.html" || die "Can't read from html_header.html\n";
+$header = languagestrings(<HEADER>);
+close HEADER;
+
+open HEADERFOOTER, "html_header_footer.html" || die "Can't read html header\n";
+$headerfooter = languagestrings(<HEADERFOOTER>);
+close HEADERFOOTER;
+
+print "Converting $ARGV[0].tex to $ARGV[0].htm\n";
+
+#find previous and next files
+for($i=0; $i<scalar(@files); $i++)
+{
+  if($ARGV[0] =~ $files[$i])
+  {
+    $previous = $files[$i-1];
+    $next = $files[$i+1];
+    last;
+  }
+}
+
+#find title
+$chapname = $1 if $lines =~ /^[^%]*\\chapter\s*\{([^\}]*)\}/m;
+
+if($ARGV[0] =~ /ch/)
+{
+  $title = "$Chapter $chap: $chapname";
+  $chapter = "\n<h2>$Chapter $chap</h2>\n";
+  $ischapter = 1;
+}
+elsif($ARGV[0] =~ /ap/)
+{
+  $title = "$Appendix " . pack('c',64+$chap) . ": $chapname";
+  $chapter = "\n<h2>$Appendix " . pack('c',64+$chap) . "</h2>\n";
+}
+else
+{
+  $title = $chapname;
+  $chapter = "";
+}
+
+$header =~ s/\$title/$title/;
+$headerfooter =~ s/\$previous/$previous/gm;
+$headerfooter =~ s/\$next/$next/gm;
+
+$body = join "", latex($lines);
+
+print OUTPUT <<EOF;
+$header
+$headerfooter
+$chapter
+$body
+<p>
+$headerfooter
+<script language="Javascript">
+<!--
+function fn(str)
+{
+  var w = window.open("","newwin","height=200,width=200");
+  w.document.write("<html><head><title>Note</title>$style<\\/head><body bgcolor=white>" + str + "<p><a href=\\"javascript:self.close();\\"><small><font color=blue><b>Close window</b></small></font></a></p></body></html>");
+}
+//-->
+</script>
+</body>
+</html>
+EOF
+
+close OUTPUT;
\ No newline at end of file

Added: www/branches/zonapython/scripts/ltoh/make_book_html.pl
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/make_book_html.pl	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+
+require 'lib.pl';
+
+print "\n";
+
+if(scalar(@ARGV) < 2)
+{
+ print <<EOF;
+Make Book Script
+by Jonah Cohen <jonah\@ibiblio.org>
+http://www.ibiblio.org/obp/ltoh/
+
+Usage:
+  $0 source_dir dest_dir [language]
+
+EOF
+  exit 0;
+}
+
+mkdir $ARGV[1],oct 755;
+
+open LANGS, "ls *.lang|";
+$langs = <LANGS>;
+close LANGS;
+
+$langs =~ s/\.lang//g;
+$langs =~ s/[^\w\n]/\\$&/g;
+$langs =~ s/\n/|/gm;
+chop $langs;
+
+open TOP, "$ARGV[0]/top.tex" || die "Can't open $ARGV[0]/top.tex\n";
+$_ = <TOP>;
+close TOP;
+$lang = lc $& if /$langs/mi;
+push @files,$1 while s/^[^%\n]*\\include\{([^\}]+)\}//m;
+
+foreach (@files)
+{
+  system "perl parse.pl $_ $ARGV[0] $ARGV[2]" if /(ch|ap)/;
+}
+
+foreach (@files)
+{
+  print "\n";
+  print "perl ltoh.pl $_ $ARGV[0] $ARGV[1] $ARGV[2]\n";
+  system "perl ltoh.pl $_ $ARGV[0] $ARGV[1] $ARGV[2]";
+  system "perl syntax.pl $lang $ARGV[1]/$_.htm" if /(ch|ap)/ && $lang ne "";
+}
+
+print "\n";
+system "perl index.pl $ARGV[0] $ARGV[1] $ARGV[2]";
+system "perl toc.pl $ARGV[0] $ARGV[1] $ARGV[2]";
+print "\n";
+
+system "rm .*_lst";

Added: www/branches/zonapython/scripts/ltoh/parse.pl
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/parse.pl	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,134 @@
+#!/usr/bin/perl
+
+require 'lib.pl';
+
+if(scalar(@ARGV) < 1)
+{
+  print <<EOF;
+
+Latex Parser
+by Jonah Cohen <jonah\@ibiblio.org>
+http://www.ibiblio.org/obp/ltoh/
+
+Usage:
+  $0 file source_dir/ [language]
+
+Parses info from source_dir/file.tex
+
+EOF
+  exit(0);
+}
+load($ARGV[2]);
+
+open(INPUT, "$ARGV[1]/$ARGV[0].tex") || die("Can't read from $ARGV[1]/$ARGV[0].tex\n");
+ a lines = split /\n/,<INPUT>;
+close(INPUT);
+
+$chap = $ARGV[0];
+$chap =~ s/^.*?(\d+)$/$1/;
+$chapnum = $chap + 0;
+
+open(LABELS, ".labels_lst");
+foreach (split /\n/,<LABELS>)
+{
+  /(.*)\t(.*)\t(.*)/;
+  $labels{$1} = $2;
+  $labellinks{$1} = $3;
+}
+close(LABELS);
+
+open(LABELS, ">.labels_lst") || die("Can't write to .labels_lst\n");
+
+open(INDEX, ".index_lst");
+foreach (split /\n/,<INDEX>)
+{
+  /(.*)\t(.*)/;
+  $index{$1} = $2;
+}
+close(INDEX);
+
+open(INDEX, ">.index_lst")  || die("Can't write to .index_lst.\n");
+
+print "Parsing $ARGV[0].tex\n";
+
+foreach (@lines)
+{
+  $sec += /\\section\s*\{/;
+
+  #look for index tags
+  while(/\\index\s*\{/)
+  {
+  	($i, $_) = latex($');
+#  	print "$i\n";
+#    $i =~ s/<\/?p>//g;
+
+    $indexlink = "$ARGV[0].htm";
+    if($ARGV[0] =~ /ch/)
+    {
+      $index = $chapnum;
+      if($sec)
+      {
+        $index .= ".$sec";
+        $indexlink .= "#$sec";
+      }
+    }
+    else
+    {
+      $index = "$Appendix " . pack('c',64+$chap);
+    }
+    if($i ne "")
+    {
+      %indices = ();
+      foreach (split /,/,$index{$i})
+      {
+        /-/;
+        $indices{$`} = $';
+      }
+      $indices{$index} = $indexlink;
+      $index{$i} = join ",",map "$_-$indices{$_}",sort {sec($a) <=> sec($b)} keys %indices;
+    }
+  }
+
+  #look for labels
+  while(s/\\label\s*\{([^\}]*)\}//)
+  {
+    $l = $1;
+    $l =~ s/^\s*//;
+    $l =~ s/\s*$//;
+    if($ARGV[0] =~ /ch/)
+    {
+      $labels{$l} = 0+$chap;
+      $labellinks{$l} = "chap$chap.htm";
+      if($sec)
+      {
+        $labels{$l} .= ".$sec";
+        $labellinks{$l} .= "#$sec";
+      }
+    }
+    else
+    {
+      $labels{$l} = pack('c',64+$chap);
+      $labellinks{$l} = "app$chap.htm";
+    }
+  }
+}
+
+foreach (keys %labels)
+{
+  print LABELS "$_\t$labels{$_}\t$labellinks{$_}\n";
+}
+close(LABELS);
+
+foreach (keys %index)
+{
+  print INDEX "$_\t$index{$_}\n";
+}
+close(INDEX);
+
+sub sec
+{
+  $_ = pop;
+  return 100 + unpack('c', $_) unless /\./;
+  s/\.(\d)$/.0$1/;
+  return $_;
+}

Added: www/branches/zonapython/scripts/ltoh/perl.lang
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/perl.lang	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,69 @@
+S 2
+// \n
+/* */
+asm
+auto
+bad_cast
+bad_typeid
+bool
+break
+case
+catch
+char
+class
+const
+const_cast
+continue
+default
+delete
+do
+double
+dynamic_cast
+else
+enum
+except
+explicit
+extern
+false
+finally
+float
+for
+friend
+goto
+if
+inline
+int
+long
+mutable
+namespace
+new
+operator
+private
+protected
+public
+register
+reinterpret_cast
+return
+short
+signed
+sizeof
+static
+static_cast
+struct
+switch
+template
+this
+throw
+true
+try
+type_info
+typedef
+typeid
+typename
+union
+unsigned
+using
+virtual
+void
+volatile
+while

Added: www/branches/zonapython/scripts/ltoh/python.lang
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/python.lang	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,30 @@
+S 1
+# \n
+and
+assert
+break
+class
+continue
+def
+del
+elif
+else
+except
+exec
+finally
+for
+from
+global
+if
+import
+in
+is
+lambda
+not
+or
+pass
+print
+raise
+return
+try
+while

Added: www/branches/zonapython/scripts/ltoh/readme.txt
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/readme.txt	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,22 @@
+Latex-To-HTML Converter
+by Jonah Cohen <jonah a ibiblio.org>
+http://www.ibiblio.org/obp/ltoh/
+
+
+Files:
+  make_book_html.pl -- convert an entire book to html
+  ltoh.pl -- convert an individual chapter to html
+  syntax.pl -- syntax-highlight a chapter
+  toc.pl -- generate table of contents
+  index.pl -- generate index
+  parse.pl -- extract labels, indices, etc from a chapter
+  lib.pl -- library containing conversion routines
+  langs.txt -- multilingual translations used in converter
+  html_header.html -- header for converted chapters
+  html_header_footer.html -- header and footer for converted chapters
+  style.html -- style sheet for syntax highlighter
+  *.lang -- language definitions for syntax highlighter
+
+
+Run make_book_html.pl to get started.  Report any problems to
+Jonah Cohen at <jonah a ibiblio.org>.

Added: www/branches/zonapython/scripts/ltoh/sql.lang
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/sql.lang	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,235 @@
+I 2
+-- \n
+/* */
+action
+add
+aggregate
+all
+alter
+after
+and
+as
+asc
+avg
+avg_row_length
+auto_increment
+between
+bigint
+bit
+binary
+blob
+bool
+both
+by
+cascade
+case
+char
+character
+change
+check
+checksum
+column
+columns
+comment
+constraint
+create
+cross
+current_date
+current_time
+current_timestamp
+data
+database
+databases
+date
+datetime
+day
+day_hour
+day_minute
+day_second
+dayofmonth
+dayofweek
+dayofyear
+dec
+decimal
+default
+delayed
+delay_key_write
+delete
+desc
+describe
+distinct
+distinctrow
+double
+drop
+end
+else
+escape
+escaped
+enclosed
+enum
+explain
+exists
+fields
+file
+first
+float
+float4
+float8
+flush
+foreign
+from
+for
+full
+function
+global
+grant
+grants
+group
+having
+heap
+high_priority
+hour
+hour_minute
+hour_second
+hosts
+identified
+ignore
+in
+index
+infile
+inner
+insert
+insert_id
+int
+integer
+interval
+int1
+int2
+int3
+int4
+int8
+into
+if
+is
+isam
+join
+key
+keys
+kill
+last_insert_id
+leading
+left
+length
+like
+lines
+limit
+load
+local
+lock
+logs
+long
+longblob
+longtext
+low_priority
+max
+max_rows
+match
+mediumblob
+mediumtext
+mediumint
+middleint
+min_rows
+minute
+minute_second
+modify
+month
+monthname
+myisam
+natural
+numeric
+no
+not
+null
+on
+optimize
+option
+optionally
+or
+order
+outer
+outfile
+pack_keys
+partial
+password
+precision
+primary
+procedure
+process
+processlist
+privileges
+read
+real
+references
+reload
+regexp
+rename
+replace
+restrict
+returns
+revoke
+rlike
+row
+rows
+second
+select
+set
+show
+shutdown
+smallint
+soname
+sql_big_tables
+sql_big_selects
+sql_low_priority_updates
+sql_log_off
+sql_log_update
+sql_select_limit
+sql_small_result
+sql_big_result
+sql_warnings
+straight_join
+starting
+status
+string
+table
+tables
+temporary
+terminated
+text
+then
+time
+timestamp
+tinyblob
+tinytext
+tinyint
+trailing
+to
+type
+use
+using
+unique
+unlock
+unsigned
+update
+usage
+values
+varchar
+variables
+varying
+varbinary
+with
+write
+when
+where
+year
+year_month
+zerofill

Added: www/branches/zonapython/scripts/ltoh/style.html
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/style.html	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,11 @@
+
+<style type="text/css">
+<!--
+.code {font-family: Courier; font-size: 85%;}
+.keyword {color: #0000ff;}
+.comment {color: #008000;}
+.quote {color: #ff0000;}
+.function {color: #ffc400;}
+-->
+</style>
+

Added: www/branches/zonapython/scripts/ltoh/syntax.pl
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/syntax.pl	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,215 @@
+#!/usr/bin/perl
+
+if(scalar(@ARGV) < 2)
+{
+  print <<EOF;
+
+Syntax Highlighter
+by Jonah Cohen <jonah\@ibiblio.org>
+http://www.ibiblio.org/obp/ltoh/
+
+Usage:
+  $0 lang source.html [dest.html]
+
+EOF
+  exit(0);
+}
+
+open(LANG, "$ARGV[0].lang") || die("Can't open $ARGV[0].lang\n");
+($case,$n) = split /\s+/,<LANG>;
+while($n--)
+{
+  $_ = <LANG>;
+  s/[\n\r]//g;
+  @a = split;
+  $a[1] =~ s/([\/\.\*\{\}\&\?\+\[\]])/\\$1/g;
+  $comments{$a[0]} = $a[1];
+}
+$comments = join "|",keys %comments;
+$comments =~ s/([\/\.\*\{\}\&\?\+\[\]])/\\$1/g;
+
+$/ = undef;
+
+$keywords = <LANG>;
+$keywords =~ s/[\s\n\r]+/|/g;
+$keywords =~ s/(^\||\|$)//g;
+close(LANG);
+
+open(STYLE, "style.html") || print("Can't open style.html\n");
+$style = <STYLE>;
+close(STYLE);
+
+open(INPUT, $ARGV[1]) || die("Can't open $ARGV[1]\n");
+ a lines = split /(<(code|pre)[^>]*>[\n\r]*|<\/(code|pre)[^>]*>)/i, <INPUT>;
+#@lines = split /<\/?(code|pre)[^>]*>[\n\r]*/im, <INPUT>;
+close(INPUT);
+
+$out = pop;
+die "Invalid filename" unless $out =~ /\w/;
+open(OUTPUT, ">$out") || die("Can't write to $out\n");
+
+print "Syntax highlighting $ARGV[1]\n";
+
+$incode = -1;
+while(@lines)
+{
+  $prev = $_;
+  $_ = shift @lines;
+  $incode = ($incode+1)%8;
+  unless($incode)
+  {
+    s/<\/head>/$style$&/mi;
+    print OUTPUT;
+  }
+  if($incode == 1 && /pre/i)
+  {
+    print OUTPUT "<p>";
+  }
+  elsif($incode == 5 && /pre/i)
+  {
+    print OUTPUT "</p>\n";
+  }
+  elsif($incode == 4)
+  {
+#    if($ARGV[0] eq 'python' && /^(&gt;){3}/m)
+#    {
+#      #python output -- not code
+#      print OUTPUT "<$prev>$_</" . (shift @lines) . ">";
+#      $incode = ($incode+1)%4;
+#      next;
+#    }
+
+    if(/^\s*((ht|f)tp:\/\/\S+|\S+\@\S+\.\S+)\s*$/)
+    {
+      $link = $1;
+      $link = "<a href=\"" . ((/\@/)?"mailto:":"") . "$link\">$link</a>";
+      $link = "<p>$link</p>" if shift(@lines) =~ /pre/i;
+      $incode++;
+
+      print OUTPUT $link;
+      next;
+    }
+
+    print OUTPUT "<span class=code>";
+
+    s/<\/?tt>//gm;
+    s/&/&amp;/gm;
+    s/&amp;([\w#]{2,5};)/&$1/gm;
+    s/</&lt;/gm;
+    s/>/&gt;/gm;
+    s/\n/\n<br>/gm;
+    while(s/^(.*?)\t/&spaces($1)/gme) {}
+    s/  /&nbsp; /gm;
+    s/  / &nbsp;/gm;
+
+
+  startover: # :-)
+
+    @comments = ();
+    @line = ();
+
+    while(/(^|[^&])($comments)/m)
+    {
+      push @comments,$2;
+      push @line,$`.$1;
+      $_ = $';
+
+      /($comments{$2})/m || /()\z/m;
+      push @comments,$1;
+      push @line,$`;
+      $_ = $';
+    }
+    push @line,$_;
+    $incomment = 1;
+
+    while(@line)
+    {
+      $_ = shift @line;
+      $incomment = !$incomment;
+      if($incomment)
+      {
+        print OUTPUT "<span class=comment>" . shift(@comments) . $_ . shift(@comments) . "</span>";
+      }
+      else
+      {
+        @quotes = ();
+        @quoteline = ();
+        while(/((^|[^\\])(\\\\)*)(["'`])/m)
+        {
+          push @quotes,$4;
+          push @quoteline,$`.$1;
+          $_ = $';
+
+          $q = $4;
+
+          if(/((^|[^\\])(\\\\)*)($q)/m)
+          {
+            push @quotes,$4;
+            push @quoteline,$`.$1;
+            $_ = $';
+            next;
+          }
+
+          until(/((^|[^\\])(\\\\)*)($q)/m || scalar(@comments)==0)
+          {
+            $_ .= shift(@comments) . shift(@line);
+          }
+
+          unless(/((^|[^\\])(\\\\)*)($q)/m)
+          {
+            $_ = pop(@quoteline) . pop(@quotes) . $_;
+            last;
+          }
+
+          push @quotes,$4;
+          push @quoteline,$`.$1;
+
+          $_ = $';
+          $_ .= shift(@comments) . shift(@line) while @comments || @line;
+
+          &dispquotes;
+          goto startover;
+        }
+        push @quoteline,$_;
+        &dispquotes;
+      }
+    }
+    print OUTPUT "</span>";
+  }
+}
+
+close(OUTPUT);
+
+sub dispquotes
+{
+  $inquote = 1;
+  foreach (@quoteline)
+  {
+    $inquote = !$inquote;
+    if($inquote)
+    {
+      print OUTPUT "<span class=quote>" . shift(@quotes) . $_ . shift(@quotes) . "</span>";
+    }
+    else
+    {
+      if($case eq "S")
+      {
+        s/\b($keywords)\b((\s|&nbsp;|<br>)+\b($keywords)\b)*/<span class=keyword>$&<\/span>/gm;
+        s/(<span class=keyword>def<\/span>\s+)(\w+)/$1<span class=function>$2<\/span>/gm;
+      }
+      else
+      {
+        s/\b($keywords)\b((\s|&nbsp;|<br>|\n)+\b($keywords)\b)*/<span class=keyword>$&<\/span>/gmi;
+      }
+      print OUTPUT;
+    }
+  }
+}
+
+sub spaces()
+{
+  $s = pop;
+  $_ = $s;
+  s/&[^;]*;/_/g;
+  return $s . (" " x (4-length($_)%4));
+}

Added: www/branches/zonapython/scripts/ltoh/toc.pl
==============================================================================
--- (empty file)
+++ www/branches/zonapython/scripts/ltoh/toc.pl	Sun Jun 11 12:09:49 2006
@@ -0,0 +1,124 @@
+#!/usr/bin/perl
+
+require 'lib.pl';
+
+if(scalar(@ARGV) < 2)
+{
+  print <<EOF;
+
+Table of Contents Generator
+by Jonah Cohen <jonah\@ibiblio.org>
+http://www.ibiblio.org/obp/ltoh/
+
+Usage:
+  $0 source_dir dest_dir [language]
+
+Parses info from file.tex
+
+EOF
+  exit(0);
+}
+
+load($ARGV[2]);
+
+open(LANGS, "ls *.lang|");
+$langs = <LANGS>;
+close(LANGS);
+
+$langs =~ s/\.lang//g;
+$langs =~ s/[^\w\n]/\\$&/g;
+$langs =~ s/\n/|/gm;
+chop $langs;
+
+open(TOP, "$ARGV[0]/top.tex") || die("Can't open $ARGV[0]/top.tex\n");
+$_ = <TOP>;
+close(TOP);
+
+$top = $_;
+
+$title = $1 if /^[^%\n]*\\title\s*\{([^\}]*)\}/m;
+$author = $1 if /^[^%\n]*\\author\s*\{([^\}]*)\}/m;
+$lang = ucfirst lc $& if /$langs/mi;
+
+$title =~ s/(\w+)/ucfirst $1/ge;
+$title =~ s/\\\w*\s*//g;
+
+open(OUTPUT, ">$ARGV[1]/index.htm") || die("Can't write to $ARGV[1]/index.htm.\n");
+
+print "Creating Table of Contents\n";
+
+print OUTPUT <<EOF;
+<html>
+
+<head>
+  <title>$title</title>
+  <style type="text/css">
+
+body {background-color: #fffacd; text-align: center}
+a {text-decoration: none; color: #a0522d; font-size: 11pt;
+font-weight: bold; font-family: Verdana}
+a:hover {text-decoration: underline}
+a:active {text-decoration: underline}
+a.h2 {font-size: 15pt; font-family: Times}
+a.h3 {font-size: 12pt; font-family: Times}
+h1 {font-size: 22pt; font-family: Times}
+p.h2 {font-size: 15pt; font-family: Times}
+table {border: 0; margin-left: auto; margin-right: auto}
+td {background-color: #b0e0e6}
+th {font-size: 12pt; font-family: Times}
+
+</style>
+</head>
+
+<body>
+  <h1>$title</h1>
+  <h2>$lang Version</h2>
+  <p class=h2>by $author</p>
+
+<table cellspacing=6 cellpadding=7 align=center>
+  <tr>
+    <th>$TOC</th>
+  </tr>
+EOF
+
+while($top =~ /^[^%\n]*\\include\s*\{([^\}]*)\}/m)
+{
+  $top = $';
+  $file = $1;
+  $n = $1;
+  $n =~ s/[^\d]//g;
+  $n =~ s/^0//;
+
+  #get title
+  open(FILE, "$ARGV[0]/$file.tex") || next;
+  $_ = <FILE>;
+  close(FILE);
+  ($title, $_) = latex($') if /\\chapter\s*\{/;
+
+  if($file =~ /ch/)
+  {
+    $title = "$Chapter $n: $title";
+  }
+  elsif($file =~ /ap/)
+  {
+    $title = "$Appendix " . pack('c',64+$n) . ": $title";
+  }
+
+  print OUTPUT <<EOF;
+  <tr>
+    <td><a href="$file.htm">$title</a></td>
+  </tr>
+EOF
+}
+
+print OUTPUT <<EOF;
+  <tr>
+    <td><a href="dex.htm">$Index</a></td>
+  </tr>
+</table>
+
+</body>
+</html>
+EOF
+
+close(OUTPUT);


Maggiori informazioni sulla lista Commits