diff --git a/Doc/custlib.py b/Doc/custlib.py deleted file mode 100644 index 32cb3d24e85..00000000000 --- a/Doc/custlib.py +++ /dev/null @@ -1,73 +0,0 @@ -# Generate custlib.tex, which is a site-specific library document. - -# Phase I: list all the things that can be imported - -import glob, os, sys, string -modules={} - -for modname in sys.builtin_module_names: - modules[modname]=modname - -for dir in sys.path: - # Look for *.py files - filelist=glob.glob(os.path.join(dir, '*.py')) - for file in filelist: - path, file = os.path.split(file) - base, ext=os.path.splitext(file) - modules[string.lower(base)]=base - - # Look for shared library files - filelist=(glob.glob(os.path.join(dir, '*.so')) + - glob.glob(os.path.join(dir, '*.sl')) + - glob.glob(os.path.join(dir, '*.o')) ) - for file in filelist: - path, file = os.path.split(file) - base, ext=os.path.splitext(file) - if base[-6:]=='module': base=base[:-6] - modules[string.lower(base)]=base - -# Minor oddity: the types module is documented in libtypes2.tex -if modules.has_key('types'): - del modules['types'] ; modules['types2']=None - -# Phase II: find all documentation files (lib*.tex) -# and eliminate modules that don't have one. - -docs={} -filelist=glob.glob('lib*.tex') -for file in filelist: - modname=file[3:-4] - docs[modname]=modname - -mlist=modules.keys() -mlist=filter(lambda x, docs=docs: docs.has_key(x), mlist) -mlist.sort() -mlist=map(lambda x, docs=docs: docs[x], mlist) - -modules=mlist - -# Phase III: write custlib.tex - -# Write the boilerplate -# XXX should be fancied up. -print """\documentstyle[twoside,11pt,myformat]{report} -\\title{Python Library Reference} -\\input{boilerplate} -\\makeindex % tell \\index to actually write the .idx file -\\begin{document} -\\pagenumbering{roman} -\\maketitle -\\input{copyright} -\\begin{abstract} -\\noindent This is a customized version of the Python Library Reference. -\\end{abstract} -\\pagebreak -{\\parskip = 0mm \\tableofcontents} -\\pagebreak\\pagenumbering{arabic}""" - -for modname in mlist: - print "\\input{lib%s}" % (modname,) - -# Write the end -print """\\input{custlib.ind} % Index -\\end{document}""" diff --git a/Doc/fix.el b/Doc/fix.el deleted file mode 100644 index f41fb59cd42..00000000000 --- a/Doc/fix.el +++ /dev/null @@ -1,5 +0,0 @@ -; load the new texinfo package (2.xx) if not installed by default -; (setq load-path (cons "/ufs/guido/lib/emacs/texinfo-2.14" load-path)) -(find-file "temp.texi") -(texinfo-all-menus-update t) -(texinfo-all-menus-update t) diff --git a/Doc/fix_hack b/Doc/fix_hack deleted file mode 100755 index 8dad11101a9..00000000000 --- a/Doc/fix_hack +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sed -e 's/{\\ptt[ ]*\\char[ ]*'"'"'137}/_/g' <"$1" > "@$1" && mv "@$1" $1 diff --git a/Doc/fix_libaux.sed b/Doc/fix_libaux.sed deleted file mode 100755 index 459b7e8d365..00000000000 --- a/Doc/fix_libaux.sed +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/sed -f -s/{\\tt \\hackscore {}\\hackscore {}/\\sectcode{__/ -s/\\hackscore {}\\hackscore {}/__/ diff --git a/Doc/indfix.py b/Doc/indfix.py deleted file mode 100755 index 395f095e751..00000000000 --- a/Doc/indfix.py +++ /dev/null @@ -1,92 +0,0 @@ -#! /usr/bin/env python - -"""Combine similar index entries into an entry and subentries. - -For example: - - \item {foobar} (in module flotz), 23 - \item {foobar} (in module whackit), 4323 - -becomes - - \item {foobar} - \subitem in module flotz, 23 - \subitem in module whackit, 4323 - -Note that an item which matches the format of a collapsable item but which -isn't part of a group of similar items is not modified. -""" -__version__ = '$Revision$' - -import re -import string -import StringIO -import sys - - -def cmp_entries(e1, e2, lower=string.lower): - return cmp(lower(e1[1]), lower(e2[1])) or cmp(e1, e2) - - -def dump_entries(write, entries): - if len(entries) == 1: - write(" \\item %s (%s)%s\n" % entries[0]) - return - write(" \item %s\n" % entries[0][0]) - # now sort these in a case insensitive manner: - if len(entries) > 0: - entries.sort(cmp_entries) - for xxx, subitem, pages in entries: - write(" \subitem %s%s\n" % (subitem, pages)) - - -breakable_re = re.compile( - r" \\item (.*) [(](.*)[)]((?:(?:, \d+)|(?:, \\[a-z]*\{\d+\}))+)") - -def main(): - import getopt - outfile = None - opts, args = getopt.getopt(sys.argv[1:], "o:") - for opt, val in opts: - if opt in ("-o", "--output"): - outfile = val - filename = args[0] - outfile = outfile or filename - if filename == "-": - fp = sys.stdin - else: - fp = open(filename) - ofp = StringIO.StringIO() - entries = [] - match = breakable_re.match - write = ofp.write - while 1: - line = fp.readline() - if not line: - break - m = match(line) - if m: - entry = m.group(1, 2, 3) - if entries and entries[-1][0] != entry[0]: - dump_entries(write, entries) - entries = [] - entries.append(entry) - elif entries: - dump_entries(write, entries) - entries = [] - write(line) - else: - write(line) - del write - del match - fp.close() - if outfile == "-": - fp = sys.stdout - else: - fp = open(outfile, "w") - fp.write(ofp.getvalue()) - fp.close() - - -if __name__ == "__main__": - main() diff --git a/Doc/keywords.py b/Doc/keywords.py deleted file mode 100644 index 52b4d6825c5..00000000000 --- a/Doc/keywords.py +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/local/bin/python - -# This Python program sorts and reformats the table of keywords in ref2.tex - -import string -l = [] -try: - while 1: - l = l + string.split(raw_input()) -except EOFError: - pass -l.sort() -for x in l[:]: - while l.count(x) > 1: l.remove(x) -ncols = 5 -nrows = (len(l)+ncols-1)/ncols -for i in range(nrows): - for j in range(i, len(l), nrows): - print string.ljust(l[j], 10), - print diff --git a/Doc/mktarball.sh b/Doc/mktarball.sh deleted file mode 100755 index e9d0c994888..00000000000 --- a/Doc/mktarball.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh -# -# script to create the latex source distribution -# * should be modified to get the Python version number automatically -# from the Makefile or someplace. -# -# usage: -# ./mktarball.sh [tag] -# -# without [tag]: generate from the current version that's checked in -# (*NOT* what's in the current directory!) -# -# with [tag]: generate from the named tag - -VERSION=1.5 - -TEMPDIR=tmp.$$ -MYDIR=`pwd` - -TAG="$1" - -mkdirhier $TEMPDIR/Python-$VERSION/Doc || exit $? -if [ "$TAG" ] ; then - cvs export -r $TAG -d $TEMPDIR/Python-$VERSION/Doc python/dist/src/Doc \ - || exit $? -else - cvs checkout -d $TEMPDIR/Python-$VERSION/Doc python/dist/src/Doc || exit $? - rm -r `find $TEMPDIR -name CVS -print` || exit $? -fi - -cd $TEMPDIR - -(tar cf - Python-$VERSION | gzip -9 >$MYDIR/latex-$VERSION.tar.gz) || exit $? -cd $MYDIR -rm -r $TEMPDIR || exit $? - -exit 0 diff --git a/Doc/modindex.py b/Doc/modindex.py deleted file mode 100755 index 0209a1a3f62..00000000000 --- a/Doc/modindex.py +++ /dev/null @@ -1,62 +0,0 @@ -#! /usr/bin/env python - -"""Script to convert raw module index data to module index.""" - -import os -import string -import sys - - -def parse_line(input): - lineno = string.split(input)[-1] - module = string.strip(input[:len(input)-(len(lineno)+1)]) - return module, lineno - - -def cmp_items((s1, line1), (s2, line2)): - rc = cmp(string.lower(s1), string.lower(s2)) - if rc == 0: - # Make the lower-case version come first since the upper-case - # version is usually a helper module for constants and such. - rc = cmp(s2, s1) - return rc - - - -def main(): - if sys.argv[1:]: - infile = sys.argv[1] - else: - infile = "-" - if infile == "-": - ifp = sys.stdin - ofp = sys.stdout - sys.stdout = sys.stderr - else: - ifp = open(infile) - base, ext = os.path.splitext(infile) - outfile = base + ".ind" - ofp = open(outfile, "w") - ofp.write("\\begin{theindex}\n\label{modindex}\n\n") - lines = ifp.readlines() - for i in range(len(lines)): - if lines[i][0] == '\\': - lines[i] = '\1' + lines[i] - lines = map(parse_line, lines) - lines.sort(cmp_items) - prev_letter = lines[0][0][0] - if prev_letter == '\1': - prev_letter = lines[0][0][1] - prev_letter = string.lower(prev_letter) - for module, lineno in lines: - if module[0] == '\1': - module = module[1:] - if string.lower(module[0]) != prev_letter: - ofp.write("\n \\indexspace\n\n") - prev_letter = string.lower(module[0]) - ofp.write(" \\item {\\tt %s}, %s\n" % (module, lineno)) - ofp.write("\n\\end{theindex}\n") - - -if __name__ == "__main__": - main() diff --git a/Doc/newind.py b/Doc/newind.py deleted file mode 100755 index b3a263b3fec..00000000000 --- a/Doc/newind.py +++ /dev/null @@ -1,22 +0,0 @@ -#! /usr/bin/env python - -"""Really nasty little script to create an empty, labeled index on stdout. - -Do it this way since some shells seem to work badly (and differently) with -the leading '\b' for the first output line. Specifically, /bin/sh on -Solaris doesn't seem to get it right. Once the quoting works there, it -doesn't work on Linux any more. ;-( -""" -__version__ = '$Revision$' -# $Source$ - -import sys - -if sys.argv[1:]: - label = sys.argv[1] -else: - label = "genindex" - -print "\\begin{theindex}" -print "\\label{%s}" % label -print "\\end{theindex}" diff --git a/Doc/node2label.pl b/Doc/node2label.pl deleted file mode 100755 index 73a3809a1da..00000000000 --- a/Doc/node2label.pl +++ /dev/null @@ -1,42 +0,0 @@ -#!/depot/gnu/plat/bin/perl -i - -# read the labels, then reverse the mappings -require "labels.pl"; - -%nodes = (); -my $key; -# sort so that we get a consistent assignment for nodes with multiple labels -foreach $label (sort keys %external_labels) { - $key = $external_labels{$label}; - $key =~ s|^/||; - $nodes{$key} = $label; -} - -# collect labels that have been used -%newnames = (); - -while (<>) { - # don't want to do one s/// per line per node - # so look for lines with hrefs, then do s/// on nodes present - if (/HREF=\"([^\#\"]*)html[\#\"]/) { - @parts = split(/HREF\=\"/); - shift @parts; - for $node (@parts) { - $node =~ s/[\#\"].*$//g; - chop($node); - if (defined($nodes{$node})) { - $label = $nodes{$node}; - if (s/HREF=\"$node([\#\"])/HREF=\"$label.html$1/g) { - s/HREF=\"$label.html#SECTION\d+/HREF=\"$label.html/g; - $newnames{$node} = "$label.html"; - } - } - } - } - print; -} - -foreach $oldname (keys %newnames) { -# or ln -s - system("mv $oldname $newnames{$oldname}"); -} diff --git a/Doc/texi2html.py b/Doc/texi2html.py deleted file mode 100644 index 22aa1fb834a..00000000000 --- a/Doc/texi2html.py +++ /dev/null @@ -1,1590 +0,0 @@ -#! /usr/local/bin/python - -# Convert GNU texinfo files into HTML, one file per node. -# Based on Texinfo 2.14. -# Usage: texi2html [-d] [-d] [-c] inputfile outputdirectory -# The input file must be a complete texinfo file, e.g. emacs.texi. -# This creates many files (one per info node) in the output directory, -# overwriting existing files of the same name. All files created have -# ".html" as their extension. - - -# XXX To do: -# - handle @comment*** correctly -# - handle @xref {some words} correctly -# - handle @ftable correctly (items aren't indexed?) -# - handle @itemx properly -# - handle @exdent properly -# - add links directly to the proper line from indices -# - check against the definitive list of @-cmds; we still miss (among others): -# - @defindex (hard) -# - @c(omment) in the middle of a line (rarely used) -# - @this* (not really needed, only used in headers anyway) -# - @today{} (ever used outside title page?) - -# More consistent handling of chapters/sections/etc. -# Lots of documentation -# Many more options: -# -top designate top node -# -links customize which types of links are included -# -split split at chapters or sections instead of nodes -# -name Allow different types of filename handling. Non unix systems -# will have problems with long node names -# ... -# Support the most recent texinfo version and take a good look at HTML 3.0 -# More debugging output (customizable) and more fexible error handling -# How about icons ? - -import os -import regex -import regsub -import string - -MAGIC = '\\input texinfo' - -cmprog = regex.compile('^@\([a-z]+\)\([ \t]\|$\)') # Command (line-oriented) -blprog = regex.compile('^[ \t]*$') # Blank line -kwprog = regex.compile('@[a-z]+') # Keyword (embedded, usually with {} args) -spprog = regex.compile('[\n@{}&<>]') # Special characters in running text -miprog = regex.compile( \ - '^\* \([^:]*\):\(:\|[ \t]*\([^\t,\n.]+\)\([^ \t\n]*\)\)[ \t\n]*') - # menu item (Yuck!) - - -class HTMLNode: - """Some of the parser's functionality is separated into this class. - - A Node accumulates its contents, takes care of links to other Nodes - and saves itself when it is finished and all links are resolved. - """ - - DOCTYPE = '' - - type = 0 - cont = '' - epilogue = '\n' - - def __init__(self, dir, name, topname, title, next, prev, up): - self.dirname = dir - self.name = name - if topname: - self.topname = topname - else: - self.topname = name - self.title = title - self.next = next - self.prev = prev - self.up = up - self.lines = [] - - def write(self, *lines): - map(self.lines.append, lines) - - def flush(self): - fp = open(self.dirname + '/' + makefile(self.name), 'w') - fp.write(self.prologue) - fp.write(self.text) - fp.write(self.epilogue) - fp.close() - - def link(self, label, nodename, rel=None, rev=None): - if nodename: - if string.lower(nodename) == '(dir)': - addr = '../dir.html' - title = '' - else: - addr = makefile(nodename) - title = ' TITLE="%s"' % nodename - self.write(label, ': ', nodename, ' \n') - - def finalize(self): - length = len(self.lines) - self.text = string.joinfields(self.lines, '') - self.lines = [] - self.open_links() - self.output_links() - self.close_links() - links = string.joinfields(self.lines, '') - self.lines = [] - - self.prologue = ( - self.DOCTYPE + - '\n\n' - ' \n' - ' ' + self.title + '\n' - ' \n' - ' \n' - ' \n' - '\n' + - links) - if length > 20: - self.epilogue = '

\n%s\n' % links - - def open_links(self): - self.write('


\n') - - def close_links(self): - self.write('
\n') - - def output_links(self): - if self.cont != self.next: - self.link(' Cont', self.cont) - self.link(' Next', self.next, rel='Next') - self.link(' Prev', self.prev, rel='Previous') - self.link(' Up', self.up, rel='Up') - if self.name <> self.topname: - self.link(' Top', self.topname) - - -class HTML3Node(HTMLNode): - - DOCTYPE = '' - - def open_links(self): - self.write('\n') - - -class TexinfoParser: - - COPYRIGHT_SYMBOL = "©" - FN_ID_PATTERN = "(%(id)s)" - FN_SOURCE_PATTERN = '' \ - + FN_ID_PATTERN + '' - FN_TARGET_PATTERN = '' \ - + FN_ID_PATTERN + '\n%(text)s

\n' - FN_HEADER = '\n

\n


\n' \ - 'Footnotes\n

' - - - Node = HTMLNode - - # Initialize an instance - def __init__(self): - self.unknown = {} # statistics about unknown @-commands - self.filenames = {} # Check for identical filenames - self.debugging = 0 # larger values produce more output - self.print_headers = 0 # always print headers? - self.nodefp = None # open file we're writing to - self.nodelineno = 0 # Linenumber relative to node - self.links = None # Links from current node - self.savetext = None # If not None, save text head instead - self.savestack = [] # If not None, save text head instead - self.dirname = 'tmp' # directory where files are created - self.includedir = '.' # directory to search @include files - self.nodename = '' # name of current node - self.topname = '' # name of top node (first node seen) - self.title = '' # title of this whole Texinfo tree - self.resetindex() # Reset all indices - self.contents = [] # Reset table of contents - self.numbering = [] # Reset section numbering counters - self.nofill = 0 # Normal operation: fill paragraphs - self.values={'html': 1} # Names that should be parsed in ifset - self.stackinfo={} # Keep track of state in the stack - # XXX The following should be reset per node?! - self.footnotes = [] # Reset list of footnotes - self.itemarg = None # Reset command used by @item - self.itemnumber = None # Reset number for @item in @enumerate - self.itemindex = None # Reset item index name - self.node = None - self.nodestack = [] - self.cont = 0 - self.includedepth = 0 - # Set (output) directory name - def setdirname(self, dirname): - self.dirname = dirname - - # Set include directory name - def setincludedir(self, includedir): - self.includedir = includedir - - # Parse the contents of an entire file - def parse(self, fp): - line = fp.readline() - lineno = 1 - while line and (line[0] == '%' or blprog.match(line) >= 0): - line = fp.readline() - lineno = lineno + 1 - if line[:len(MAGIC)] <> MAGIC: - raise SyntaxError, 'file does not begin with '+`MAGIC` - self.parserest(fp, lineno) - - # Parse the contents of a file, not expecting a MAGIC header - def parserest(self, fp, initial_lineno): - lineno = initial_lineno - self.done = 0 - self.skip = 0 - self.stack = [] - accu = [] - while not self.done: - line = fp.readline() - self.nodelineno = self.nodelineno + 1 - if not line: - if accu: - if not self.skip: self.process(accu) - accu = [] - if initial_lineno > 0: - print '*** EOF before @bye' - break - lineno = lineno + 1 - if cmprog.match(line) >= 0: - a, b = cmprog.regs[1] - cmd = line[a:b] - if cmd in ('noindent', 'refill'): - accu.append(line) - else: - if accu: - if not self.skip: - self.process(accu) - accu = [] - self.command(line) - elif blprog.match(line) >= 0 and \ - 'format' not in self.stack and \ - 'example' not in self.stack: - if accu: - if not self.skip: - self.process(accu) - if self.nofill: - self.write('\n') - else: - self.write('

\n') - accu = [] - else: - # Append the line including trailing \n! - accu.append(line) - # - if self.skip: - print '*** Still skipping at the end' - if self.stack: - print '*** Stack not empty at the end' - print '***', self.stack - if self.includedepth == 0: - while self.nodestack: - self.nodestack[-1].finalize() - self.nodestack[-1].flush() - del self.nodestack[-1] - - # Start saving text in a buffer instead of writing it to a file - def startsaving(self): - if self.savetext <> None: - self.savestack.append(self.savetext) - # print '*** Recursively saving text, expect trouble' - self.savetext = '' - - # Return the text saved so far and start writing to file again - def collectsavings(self): - savetext = self.savetext - if len(self.savestack) > 0: - self.savetext = self.savestack[-1] - del self.savestack[-1] - else: - self.savetext = None - return savetext or '' - - # Write text to file, or save it in a buffer, or ignore it - def write(self, *args): - try: - text = string.joinfields(args, '') - except: - print args - raise TypeError - if self.savetext <> None: - self.savetext = self.savetext + text - elif self.nodefp: - self.nodefp.write(text) - elif self.node: - self.node.write(text) - # Complete the current node -- write footnotes and close file - def endnode(self): - if self.savetext <> None: - print '*** Still saving text at end of node' - dummy = self.collectsavings() - if self.footnotes: - self.writefootnotes() - if self.nodefp: - if self.nodelineno > 20: - self.write('


\n') - [name, next, prev, up] = self.nodelinks[:4] - self.link('Next', next) - self.link('Prev', prev) - self.link('Up', up) - if self.nodename <> self.topname: - self.link('Top', self.topname) - self.write('
\n') - self.write('\n') - self.nodefp.close() - self.nodefp = None - elif self.node: - if not self.cont and \ - (not self.node.type or \ - (self.node.next and self.node.prev and self.node.up)): - self.node.finalize() - self.node.flush() - else: - self.nodestack.append(self.node) - self.node = None - self.nodename = '' - - # Process a list of lines, expanding embedded @-commands - # This mostly distinguishes between menus and normal text - def process(self, accu): - if self.debugging > 1: - print self.skip, self.stack, - if accu: print accu[0][:30], - if accu[0][30:] or accu[1:]: print '...', - print - if self.stack and self.stack[-1] == 'menu': - # XXX should be done differently - for line in accu: - if miprog.match(line) < 0: - line = string.strip(line) + '\n' - self.expand(line) - continue - (bgn, end), (a, b), (c, d), (e, f), (g, h) = \ - miprog.regs[:5] - label = line[a:b] - nodename = line[c:d] - if nodename[0] == ':': nodename = label - else: nodename = line[e:f] - punct = line[g:h] - self.write('
  • ', nodename, - '', punct, '\n') - self.expand(line[end:]) - else: - text = string.joinfields(accu, '') - self.expand(text) - - # Write a string, expanding embedded @-commands - def expand(self, text): - stack = [] - i = 0 - n = len(text) - while i < n: - start = i - i = spprog.search(text, i) - if i < 0: - self.write(text[start:]) - break - self.write(text[start:i]) - c = text[i] - i = i+1 - if c == '\n': - self.write('\n') - continue - if c == '<': - self.write('<') - continue - if c == '>': - self.write('>') - continue - if c == '&': - self.write('&') - continue - if c == '{': - stack.append('') - continue - if c == '}': - if not stack: - print '*** Unmatched }' - self.write('}') - continue - cmd = stack[-1] - del stack[-1] - try: - method = getattr(self, 'close_' + cmd) - except AttributeError: - self.unknown_close(cmd) - continue - method() - continue - if c <> '@': - # Cannot happen unless spprog is changed - raise RuntimeError, 'unexpected funny '+`c` - start = i - while i < n and text[i] in string.letters: i = i+1 - if i == start: - # @ plus non-letter: literal next character - i = i+1 - c = text[start:i] - if c == ':': - # `@:' means no extra space after - # preceding `.', `?', `!' or `:' - pass - else: - # `@.' means a sentence-ending period; - # `@@', `@{', `@}' quote `@', `{', `}' - self.write(c) - continue - cmd = text[start:i] - if i < n and text[i] == '{': - i = i+1 - stack.append(cmd) - try: - method = getattr(self, 'open_' + cmd) - except AttributeError: - self.unknown_open(cmd) - continue - method() - continue - try: - method = getattr(self, 'handle_' + cmd) - except AttributeError: - self.unknown_handle(cmd) - continue - method() - if stack: - print '*** Stack not empty at para:', stack - - # --- Handle unknown embedded @-commands --- - - def unknown_open(self, cmd): - print '*** No open func for @' + cmd + '{...}' - cmd = cmd + '{' - self.write('@', cmd) - if not self.unknown.has_key(cmd): - self.unknown[cmd] = 1 - else: - self.unknown[cmd] = self.unknown[cmd] + 1 - - def unknown_close(self, cmd): - print '*** No close func for @' + cmd + '{...}' - cmd = '}' + cmd - self.write('}') - if not self.unknown.has_key(cmd): - self.unknown[cmd] = 1 - else: - self.unknown[cmd] = self.unknown[cmd] + 1 - - def unknown_handle(self, cmd): - print '*** No handler for @' + cmd - self.write('@', cmd) - if not self.unknown.has_key(cmd): - self.unknown[cmd] = 1 - else: - self.unknown[cmd] = self.unknown[cmd] + 1 - - # XXX The following sections should be ordered as the texinfo docs - - # --- Embedded @-commands without {} argument list -- - - def handle_noindent(self): pass - - def handle_refill(self): pass - - # --- Include file handling --- - - def do_include(self, args): - file = args - file = os.path.join(self.includedir, file) - try: - fp = open(file, 'r') - except IOError, msg: - print '*** Can\'t open include file', `file` - return - if self.debugging: - print '--> file', `file` - save_done = self.done - save_skip = self.skip - save_stack = self.stack - self.includedepth = self.includedepth + 1 - self.parserest(fp, 0) - self.includedepth = self.includedepth - 1 - fp.close() - self.done = save_done - self.skip = save_skip - self.stack = save_stack - if self.debugging: - print '<-- file', `file` - - # --- Special Insertions --- - - def open_dmn(self): pass - def close_dmn(self): pass - - def open_dots(self): self.write('...') - def close_dots(self): pass - - def open_bullet(self): pass - def close_bullet(self): pass - - def open_TeX(self): self.write('TeX') - def close_TeX(self): pass - - def handle_copyright(self): self.write(self.COPYRIGHT_SYMBOL) - def open_copyright(self): self.write(self.COPYRIGHT_SYMBOL) - def close_copyright(self): pass - - def open_minus(self): self.write('-') - def close_minus(self): pass - - # --- Special Glyphs for Examples --- - - def open_result(self): self.write('=>') - def close_result(self): pass - - def open_expansion(self): self.write('==>') - def close_expansion(self): pass - - def open_print(self): self.write('-|') - def close_print(self): pass - - def open_error(self): self.write('error-->') - def close_error(self): pass - - def open_equiv(self): self.write('==') - def close_equiv(self): pass - - def open_point(self): self.write('-!-') - def close_point(self): pass - - # --- Cross References --- - - def open_pxref(self): - self.write('see ') - self.startsaving() - def close_pxref(self): - self.makeref() - - def open_xref(self): - self.write('See ') - self.startsaving() - def close_xref(self): - self.makeref() - - def open_ref(self): - self.startsaving() - def close_ref(self): - self.makeref() - - def open_inforef(self): - self.write('See info file ') - self.startsaving() - def close_inforef(self): - text = self.collectsavings() - args = string.splitfields(text, ',') - n = len(args) - for i in range(n): - args[i] = string.strip(args[i]) - while len(args) < 3: args.append('') - node = args[0] - file = args[2] - self.write('`', file, '\', node `', node, '\'') - - def makeref(self): - text = self.collectsavings() - args = string.splitfields(text, ',') - n = len(args) - for i in range(n): - args[i] = string.strip(args[i]) - while len(args) < 5: args.append('') - nodename = label = args[0] - if args[2]: label = args[2] - file = args[3] - title = args[4] - href = makefile(nodename) - if file: - href = '../' + file + '/' + href - self.write('', label, '') - - # --- Marking Words and Phrases --- - - # --- Other @xxx{...} commands --- - - def open_(self): pass # Used by {text enclosed in braces} - def close_(self): pass - - open_asis = open_ - close_asis = close_ - - def open_cite(self): self.write('') - def close_cite(self): self.write('') - - def open_code(self): self.write('') - def close_code(self): self.write('') - - def open_t(self): self.write('') - def close_t(self): self.write('') - - def open_dfn(self): self.write('') - def close_dfn(self): self.write('') - - def open_emph(self): self.write('') - def close_emph(self): self.write('') - - def open_i(self): self.write('') - def close_i(self): self.write('') - - def open_footnote(self): - # if self.savetext <> None: - # print '*** Recursive footnote -- expect weirdness' - id = len(self.footnotes) + 1 - self.write(self.FN_SOURCE_PATTERN % {'id': `id`}) - self.startsaving() - - def close_footnote(self): - id = len(self.footnotes) + 1 - self.footnotes.append(id, self.collectsavings()) - - def writefootnotes(self): - self.write(self.FN_HEADER) - for id, text in self.footnotes: - self.write(self.FN_TARGET_PATTERN - % {'id': `id`, 'text': text}) - self.footnotes = [] - - def open_file(self): self.write('') - def close_file(self): self.write('') - - def open_kbd(self): self.write('') - def close_kbd(self): self.write('') - - def open_key(self): self.write('') - def close_key(self): self.write('') - - def open_r(self): self.write('') - def close_r(self): self.write('') - - def open_samp(self): self.write('`') - def close_samp(self): self.write('\'') - - def open_sc(self): self.write('') - def close_sc(self): self.write('') - - def open_strong(self): self.write('') - def close_strong(self): self.write('') - - def open_b(self): self.write('') - def close_b(self): self.write('') - - def open_var(self): self.write('') - def close_var(self): self.write('') - - def open_w(self): self.write('') - def close_w(self): self.write('') - - open_titlefont = open_ - close_titlefont = close_ - - def open_small(self): pass - def close_small(self): pass - - def command(self, line): - a, b = cmprog.regs[1] - cmd = line[a:b] - args = string.strip(line[b:]) - if self.debugging > 1: - print self.skip, self.stack, '@' + cmd, args - try: - func = getattr(self, 'do_' + cmd) - except AttributeError: - try: - func = getattr(self, 'bgn_' + cmd) - except AttributeError: - # don't complain if we are skipping anyway - if not self.skip: - self.unknown_cmd(cmd, args) - return - self.stack.append(cmd) - func(args) - return - if not self.skip or cmd == 'end': - func(args) - - def unknown_cmd(self, cmd, args): - print '*** unknown', '@' + cmd, args - if not self.unknown.has_key(cmd): - self.unknown[cmd] = 1 - else: - self.unknown[cmd] = self.unknown[cmd] + 1 - - def do_end(self, args): - words = string.split(args) - if not words: - print '*** @end w/o args' - else: - cmd = words[0] - if not self.stack or self.stack[-1] <> cmd: - print '*** @end', cmd, 'unexpected' - else: - del self.stack[-1] - try: - func = getattr(self, 'end_' + cmd) - except AttributeError: - self.unknown_end(cmd) - return - func() - - def unknown_end(self, cmd): - cmd = 'end ' + cmd - print '*** unknown', '@' + cmd - if not self.unknown.has_key(cmd): - self.unknown[cmd] = 1 - else: - self.unknown[cmd] = self.unknown[cmd] + 1 - - # --- Comments --- - - def do_comment(self, args): pass - do_c = do_comment - - # --- Conditional processing --- - - def bgn_ifinfo(self, args): pass - def end_ifinfo(self): pass - - def bgn_iftex(self, args): self.skip = self.skip + 1 - def end_iftex(self): self.skip = self.skip - 1 - - def bgn_ignore(self, args): self.skip = self.skip + 1 - def end_ignore(self): self.skip = self.skip - 1 - - def bgn_tex(self, args): self.skip = self.skip + 1 - def end_tex(self): self.skip = self.skip - 1 - - def do_set(self, args): - fields = string.splitfields(args, ' ') - key = fields[0] - if len(fields) == 1: - value = 1 - else: - value = string.joinfields(fields[1:], ' ') - self.values[key] = value - print self.values - - def do_clear(self, args): - self.values[args] = None - - def bgn_ifset(self, args): - if args not in self.values.keys() \ - or self.values[args] is None: - self.skip = self.skip + 1 - self.stackinfo[len(self.stack)] = 1 - else: - self.stackinfo[len(self.stack)] = 0 - def end_ifset(self): - print self.stack - print self.stackinfo - if self.stackinfo[len(self.stack) + 1]: - self.skip = self.skip - 1 - del self.stackinfo[len(self.stack) + 1] - - def bgn_ifclear(self, args): - if args in self.values.keys() \ - and self.values[args] is not None: - self.skip = self.skip + 1 - self.stackinfo[len(self.stack)] = 1 - else: - self.stackinfo[len(self.stack)] = 0 - - end_ifclear = end_ifset - - def open_value(self): - self.startsaving() - - def close_value(self): - key = self.collectsavings() - if key in self.values.keys(): - self.write(self.values[key]) - else: - print '*** Undefined value: ', key - - # --- Beginning a file --- - - do_finalout = do_comment - do_setchapternewpage = do_comment - do_setfilename = do_comment - - def do_settitle(self, args): - print args - self.startsaving() - self.expand(args) - self.title = self.collectsavings() - print self.title - def do_parskip(self, args): pass - - # --- Ending a file --- - - def do_bye(self, args): - self.endnode() - self.done = 1 - - # --- Title page --- - - def bgn_titlepage(self, args): self.skip = self.skip + 1 - def end_titlepage(self): self.skip = self.skip - 1 - def do_shorttitlepage(self, args): pass - - def do_center(self, args): - # Actually not used outside title page... - self.write('

    ') - self.expand(args) - self.write('

    \n') - do_title = do_center - do_subtitle = do_center - do_author = do_center - - do_vskip = do_comment - do_vfill = do_comment - do_smallbook = do_comment - - do_paragraphindent = do_comment - do_setchapternewpage = do_comment - do_headings = do_comment - do_footnotestyle = do_comment - - do_evenheading = do_comment - do_evenfooting = do_comment - do_oddheading = do_comment - do_oddfooting = do_comment - do_everyheading = do_comment - do_everyfooting = do_comment - - # --- Nodes --- - - def do_node(self, args): - self.endnode() - self.nodelineno = 0 - parts = string.splitfields(args, ',') - while len(parts) < 4: parts.append('') - for i in range(4): parts[i] = string.strip(parts[i]) - self.nodelinks = parts - [name, next, prev, up] = parts[:4] - file = self.dirname + '/' + makefile(name) - if self.filenames.has_key(file): - print '*** Filename already in use: ', file - else: - if self.debugging: print '--- writing', file - self.filenames[file] = 1 - # self.nodefp = open(file, 'w') - self.nodename = name - if self.cont and self.nodestack: - self.nodestack[-1].cont = self.nodename - if not self.topname: self.topname = name - title = name - if self.title: title = title + ' -- ' + self.title - self.node = self.Node(self.dirname, self.nodename, self.topname, - title, next, prev, up) - - def link(self, label, nodename): - if nodename: - if string.lower(nodename) == '(dir)': - addr = '../dir.html' - else: - addr = makefile(nodename) - self.write(label, ': ', nodename, ' \n') - - # --- Sectioning commands --- - - def popstack(self, type): - if (self.node): - self.node.type = type - while self.nodestack: - if self.nodestack[-1].type > type: - self.nodestack[-1].finalize() - self.nodestack[-1].flush() - del self.nodestack[-1] - elif self.nodestack[-1].type == type: - if not self.nodestack[-1].next: - self.nodestack[-1].next = self.node.name - if not self.node.prev: - self.node.prev = self.nodestack[-1].name - self.nodestack[-1].finalize() - self.nodestack[-1].flush() - del self.nodestack[-1] - else: - if type > 1 and not self.node.up: - self.node.up = self.nodestack[-1].name - break - - def do_chapter(self, args): - self.heading('H1', args, 0) - self.popstack(1) - - def do_unnumbered(self, args): - self.heading('H1', args, -1) - self.popstack(1) - def do_appendix(self, args): - self.heading('H1', args, -1) - self.popstack(1) - def do_top(self, args): - self.heading('H1', args, -1) - def do_chapheading(self, args): - self.heading('H1', args, -1) - def do_majorheading(self, args): - self.heading('H1', args, -1) - - def do_section(self, args): - self.heading('H1', args, 1) - self.popstack(2) - - def do_unnumberedsec(self, args): - self.heading('H1', args, -1) - self.popstack(2) - def do_appendixsec(self, args): - self.heading('H1', args, -1) - self.popstack(2) - do_appendixsection = do_appendixsec - def do_heading(self, args): - self.heading('H1', args, -1) - - def do_subsection(self, args): - self.heading('H2', args, 2) - self.popstack(3) - def do_unnumberedsubsec(self, args): - self.heading('H2', args, -1) - self.popstack(3) - def do_appendixsubsec(self, args): - self.heading('H2', args, -1) - self.popstack(3) - def do_subheading(self, args): - self.heading('H2', args, -1) - - def do_subsubsection(self, args): - self.heading('H3', args, 3) - self.popstack(4) - def do_unnumberedsubsubsec(self, args): - self.heading('H3', args, -1) - self.popstack(4) - def do_appendixsubsubsec(self, args): - self.heading('H3', args, -1) - self.popstack(4) - def do_subsubheading(self, args): - self.heading('H3', args, -1) - - def heading(self, type, args, level): - if level >= 0: - while len(self.numbering) <= level: - self.numbering.append(0) - del self.numbering[level+1:] - self.numbering[level] = self.numbering[level] + 1 - x = '' - for i in self.numbering: - x = x + `i` + '.' - args = x + ' ' + args - self.contents.append(level, args, self.nodename) - self.write('<', type, '>') - self.expand(args) - self.write('\n') - if self.debugging or self.print_headers: - print '---', args - - def do_contents(self, args): - # pass - self.listcontents('Table of Contents', 999) - - def do_shortcontents(self, args): - pass - # self.listcontents('Short Contents', 0) - do_summarycontents = do_shortcontents - - def listcontents(self, title, maxlevel): - self.write('

    ', title, '

    \n\n' * len(prevlevels)) - - # --- Page lay-out --- - - # These commands are only meaningful in printed text - - def do_page(self, args): pass - - def do_need(self, args): pass - - def bgn_group(self, args): pass - def end_group(self): pass - - # --- Line lay-out --- - - def do_sp(self, args): - if self.nofill: - self.write('\n') - else: - self.write('

    \n') - - def do_hline(self, args): - self.write('


    ') - - # --- Function and variable definitions --- - - def bgn_deffn(self, args): - self.write('
    ') - self.do_deffnx(args) - - def end_deffn(self): - self.write('
    \n') - - def do_deffnx(self, args): - self.write('
    ') - words = splitwords(args, 2) - [category, name], rest = words[:2], words[2:] - self.expand('@b{%s}' % name) - for word in rest: self.expand(' ' + makevar(word)) - #self.expand(' -- ' + category) - self.write('\n
    ') - self.index('fn', name) - - def bgn_defun(self, args): self.bgn_deffn('Function ' + args) - end_defun = end_deffn - def do_defunx(self, args): self.do_deffnx('Function ' + args) - - def bgn_defmac(self, args): self.bgn_deffn('Macro ' + args) - end_defmac = end_deffn - def do_defmacx(self, args): self.do_deffnx('Macro ' + args) - - def bgn_defspec(self, args): self.bgn_deffn('{Special Form} ' + args) - end_defspec = end_deffn - def do_defspecx(self, args): self.do_deffnx('{Special Form} ' + args) - - def bgn_defvr(self, args): - self.write('
    ') - self.do_defvrx(args) - - end_defvr = end_deffn - - def do_defvrx(self, args): - self.write('
    ') - words = splitwords(args, 2) - [category, name], rest = words[:2], words[2:] - self.expand('@code{%s}' % name) - # If there are too many arguments, show them - for word in rest: self.expand(' ' + word) - #self.expand(' -- ' + category) - self.write('\n
    ') - self.index('vr', name) - - def bgn_defvar(self, args): self.bgn_defvr('Variable ' + args) - end_defvar = end_defvr - def do_defvarx(self, args): self.do_defvrx('Variable ' + args) - - def bgn_defopt(self, args): self.bgn_defvr('{User Option} ' + args) - end_defopt = end_defvr - def do_defoptx(self, args): self.do_defvrx('{User Option} ' + args) - - # --- Ditto for typed languages --- - - def bgn_deftypefn(self, args): - self.write('
    ') - self.do_deftypefnx(args) - - end_deftypefn = end_deffn - - def do_deftypefnx(self, args): - self.write('
    ') - words = splitwords(args, 3) - [category, datatype, name], rest = words[:3], words[3:] - self.expand('@code{%s} @b{%s}' % (datatype, name)) - for word in rest: self.expand(' ' + makevar(word)) - #self.expand(' -- ' + category) - self.write('\n
    ') - self.index('fn', name) - - - def bgn_deftypefun(self, args): self.bgn_deftypefn('Function ' + args) - end_deftypefun = end_deftypefn - def do_deftypefunx(self, args): self.do_deftypefnx('Function ' + args) - - def bgn_deftypevr(self, args): - self.write('
    ') - self.do_deftypevrx(args) - - end_deftypevr = end_deftypefn - - def do_deftypevrx(self, args): - self.write('
    ') - words = splitwords(args, 3) - [category, datatype, name], rest = words[:3], words[3:] - self.expand('@code{%s} @b{%s}' % (datatype, name)) - # If there are too many arguments, show them - for word in rest: self.expand(' ' + word) - #self.expand(' -- ' + category) - self.write('\n
    ') - self.index('fn', name) - - def bgn_deftypevar(self, args): - self.bgn_deftypevr('Variable ' + args) - end_deftypevar = end_deftypevr - def do_deftypevarx(self, args): - self.do_deftypevrx('Variable ' + args) - - # --- Ditto for object-oriented languages --- - - def bgn_defcv(self, args): - self.write('
    ') - self.do_defcvx(args) - - end_defcv = end_deftypevr - - def do_defcvx(self, args): - self.write('
    ') - words = splitwords(args, 3) - [category, classname, name], rest = words[:3], words[3:] - self.expand('@b{%s}' % name) - # If there are too many arguments, show them - for word in rest: self.expand(' ' + word) - #self.expand(' -- %s of @code{%s}' % (category, classname)) - self.write('\n
    ') - self.index('vr', '%s @r{on %s}' % (name, classname)) - - def bgn_defivar(self, args): - self.bgn_defcv('{Instance Variable} ' + args) - end_defivar = end_defcv - def do_defivarx(self, args): - self.do_defcvx('{Instance Variable} ' + args) - - def bgn_defop(self, args): - self.write('
    ') - self.do_defopx(args) - - end_defop = end_defcv - - def do_defopx(self, args): - self.write('
    ') - words = splitwords(args, 3) - [category, classname, name], rest = words[:3], words[3:] - self.expand('@b{%s}' % name) - for word in rest: self.expand(' ' + makevar(word)) - #self.expand(' -- %s of @code{%s}' % (category, classname)) - self.write('\n
    ') - self.index('fn', '%s @r{on %s}' % (name, classname)) - - def bgn_defmethod(self, args): - self.bgn_defop('Method ' + args) - end_defmethod = end_defop - def do_defmethodx(self, args): - self.do_defopx('Method ' + args) - - # --- Ditto for data types --- - - def bgn_deftp(self, args): - self.write('
    ') - self.do_deftpx(args) - - end_deftp = end_defcv - - def do_deftpx(self, args): - self.write('
    ') - words = splitwords(args, 2) - [category, name], rest = words[:2], words[2:] - self.expand('@b{%s}' % name) - for word in rest: self.expand(' ' + word) - #self.expand(' -- ' + category) - self.write('\n
    ') - self.index('tp', name) - - # --- Making Lists and Tables - - def bgn_enumerate(self, args): - if not args: - self.write('
      \n') - self.stackinfo[len(self.stack)] = '
    \n' - else: - self.itemnumber = args - self.write('
      \n') - self.stackinfo[len(self.stack)] = '
    \n' - def end_enumerate(self): - self.itemnumber = None - self.write(self.stackinfo[len(self.stack) + 1]) - del self.stackinfo[len(self.stack) + 1] - - def bgn_itemize(self, args): - self.itemarg = args - self.write('
      \n') - def end_itemize(self): - self.itemarg = None - self.write('
    \n') - - def bgn_table(self, args): - self.itemarg = args - self.write('
    \n') - def end_table(self): - self.itemarg = None - self.write('
    \n') - - def bgn_ftable(self, args): - self.itemindex = 'fn' - self.bgn_table(args) - def end_ftable(self): - self.itemindex = None - self.end_table() - - def do_item(self, args): - if self.itemindex: self.index(self.itemindex, args) - if self.itemarg: - if self.itemarg[0] == '@' and self.itemarg[1:2] and \ - self.itemarg[1] in string.letters: - args = self.itemarg + '{' + args + '}' - else: - # some other character, e.g. '-' - args = self.itemarg + ' ' + args - if self.itemnumber <> None: - args = self.itemnumber + '. ' + args - self.itemnumber = increment(self.itemnumber) - if self.stack and self.stack[-1] == 'table': - self.write('
    ') - self.expand(args) - self.write('\n
    ') - else: - self.write('
  • ') - self.expand(args) - self.write(' ') - do_itemx = do_item # XXX Should suppress leading blank line - - # --- Enumerations, displays, quotations --- - # XXX Most of these should increase the indentation somehow - - def bgn_quotation(self, args): self.write('
    ') - def end_quotation(self): self.write('
    \n') - - def bgn_example(self, args): - self.nofill = self.nofill + 1 - self.write('
    ')
    -    def end_example(self):
    -	self.write('
    \n') - self.nofill = self.nofill - 1 - - bgn_lisp = bgn_example # Synonym when contents are executable lisp code - end_lisp = end_example - - bgn_smallexample = bgn_example # XXX Should use smaller font - end_smallexample = end_example - - bgn_smalllisp = bgn_lisp # Ditto - end_smalllisp = end_lisp - - bgn_display = bgn_example - end_display = end_example - - bgn_format = bgn_display - end_format = end_display - - def do_exdent(self, args): self.expand(args + '\n') - # XXX Should really mess with indentation - - def bgn_flushleft(self, args): - self.nofill = self.nofill + 1 - self.write('
    \n')
    -    def end_flushleft(self):
    -	self.write('
    \n') - self.nofill = self.nofill - 1 - - def bgn_flushright(self, args): - self.nofill = self.nofill + 1 - self.write('
    \n') - def end_flushright(self): - self.write('
    \n') - self.nofill = self.nofill - 1 - - def bgn_menu(self, args): - self.write('\n') - self.write(' Menu

    \n') - def end_menu(self): - self.write('

    \n') - - def bgn_cartouche(self, args): pass - def end_cartouche(self): pass - - # --- Indices --- - - def resetindex(self): - self.noncodeindices = ['cp'] - self.indextitle = {} - self.indextitle['cp'] = 'Concept' - self.indextitle['fn'] = 'Function' - self.indextitle['ky'] = 'Keyword' - self.indextitle['pg'] = 'Program' - self.indextitle['tp'] = 'Type' - self.indextitle['vr'] = 'Variable' - # - self.whichindex = {} - for name in self.indextitle.keys(): - self.whichindex[name] = [] - - def user_index(self, name, args): - if self.whichindex.has_key(name): - self.index(name, args) - else: - print '*** No index named', `name` - - def do_cindex(self, args): self.index('cp', args) - def do_findex(self, args): self.index('fn', args) - def do_kindex(self, args): self.index('ky', args) - def do_pindex(self, args): self.index('pg', args) - def do_tindex(self, args): self.index('tp', args) - def do_vindex(self, args): self.index('vr', args) - - def index(self, name, args): - self.whichindex[name].append(args, self.nodename) - - def do_synindex(self, args): - words = string.split(args) - if len(words) <> 2: - print '*** bad @synindex', args - return - [old, new] = words - if not self.whichindex.has_key(old) or \ - not self.whichindex.has_key(new): - print '*** bad key(s) in @synindex', args - return - if old <> new and \ - self.whichindex[old] is not self.whichindex[new]: - inew = self.whichindex[new] - inew[len(inew):] = self.whichindex[old] - self.whichindex[old] = inew - do_syncodeindex = do_synindex # XXX Should use code font - - def do_printindex(self, args): - words = string.split(args) - for name in words: - if self.whichindex.has_key(name): - self.prindex(name) - else: - print '*** No index named', `name` - - def prindex(self, name): - iscodeindex = (name not in self.noncodeindices) - index = self.whichindex[name] - if not index: return - if self.debugging: - print '--- Generating', self.indextitle[name], 'index' - # The node already provides a title - index1 = [] - junkprog = regex.compile('^\(@[a-z]+\)?{') - for key, node in index: - sortkey = string.lower(key) - # Remove leading `@cmd{' from sort key - # -- don't bother about the matching `}' - oldsortkey = sortkey - while 1: - i = junkprog.match(sortkey) - if i < 0: break - sortkey = sortkey[i:] - index1.append(sortkey, key, node) - del index[:] - index1.sort() - self.write('
    \n') - prevkey = prevnode = None - for sortkey, key, node in index1: - if (key, node) == (prevkey, prevnode): - continue - if self.debugging > 1: print key, ':', node - self.write('
    ') - if iscodeindex: key = '@code{' + key + '}' - if key != prevkey: - self.expand(key) - self.write('\n
    %s\n' % (makefile(node), node)) - prevkey, prevnode = key, node - self.write('
    \n') - - # --- Final error reports --- - - def report(self): - if self.unknown: - print '--- Unrecognized commands ---' - cmds = self.unknown.keys() - cmds.sort() - for cmd in cmds: - print string.ljust(cmd, 20), self.unknown[cmd] - - -class TexinfoParserHTML3(TexinfoParser): - - COPYRIGHT_SYMBOL = "©" - FN_ID_PATTERN = "[%(id)s]" - FN_SOURCE_PATTERN = '' + FN_ID_PATTERN + '' - FN_TARGET_PATTERN = '\n' \ - '

    ' + FN_ID_PATTERN \ - + '\n%(text)s

    \n' - FN_HEADER = '
    \n
    \n' \ - ' Footnotes\n

    \n' - - Node = HTML3Node - - def bgn_quotation(self, args): self.write('') - def end_quotation(self): self.write('\n') - - def bgn_example(self, args): - # this use of would not be legal in HTML 2.0, - # but is in more recent DTDs. - self.nofill = self.nofill + 1 - self.write('

    ')
    -    def end_example(self):
    -	self.write("
    \n") - self.nofill = self.nofill - 1 - - def bgn_flushleft(self, args): - self.nofill = self.nofill + 1 - self.write('
    \n')
    -
    -    def bgn_flushright(self, args):
    -	self.nofill = self.nofill + 1
    -	self.write('
    \n') - def end_flushright(self): - self.write('
    \n') - self.nofill = self.nofill - 1 - - def bgn_menu(self, args): - self.write('\n') - - -# Put @var{} around alphabetic substrings -def makevar(str): - return '@var{'+str+'}' - - -# Split a string in "words" according to findwordend -def splitwords(str, minlength): - words = [] - i = 0 - n = len(str) - while i < n: - while i < n and str[i] in ' \t\n': i = i+1 - if i >= n: break - start = i - i = findwordend(str, i, n) - words.append(str[start:i]) - while len(words) < minlength: words.append('') - return words - - -# Find the end of a "word", matching braces and interpreting @@ @{ @} -fwprog = regex.compile('[@{} ]') -def findwordend(str, i, n): - level = 0 - while i < n: - i = fwprog.search(str, i) - if i < 0: break - c = str[i]; i = i+1 - if c == '@': i = i+1 # Next character is not special - elif c == '{': level = level+1 - elif c == '}': level = level-1 - elif c == ' ' and level <= 0: return i-1 - return n - - -# Convert a node name into a file name -def makefile(nodename): - return fixfunnychars(nodename) + '.html' - - -# Characters that are perfectly safe in filenames and hyperlinks -goodchars = string.letters + string.digits + '!@-=+.' - -# Replace characters that aren't perfectly safe by dashes -# Underscores are bad since Cern HTTPD treats them as delimiters for -# encoding times, so you get mismatches if you compress your files: -# a.html.gz will map to a_b.html.gz -def fixfunnychars(addr): - i = 0 - while i < len(addr): - c = addr[i] - if c not in goodchars: - c = '-' - addr = addr[:i] + c + addr[i+1:] - i = i + len(c) - return addr - - -# Increment a string used as an enumeration -def increment(s): - if not s: - return '1' - for sequence in string.digits, string.lowercase, string.uppercase: - lastc = s[-1] - if lastc in sequence: - i = string.index(sequence, lastc) + 1 - if i >= len(sequence): - if len(s) == 1: - s = sequence[0]*2 - if s == '00': - s = '10' - else: - s = increment(s[:-1]) + sequence[0] - else: - s = s[:-1] + sequence[i] - return s - return s # Don't increment - - -def test(): - import sys - debugging = 0 - print_headers = 0 - cont = 0 - html3 = 0 - - while sys.argv[1:2] == ['-d']: - debugging = debugging + 1 - del sys.argv[1:2] - if sys.argv[1] == '-p': - print_headers = 1 - del sys.argv[1] - if sys.argv[1] == '-c': - cont = 1 - del sys.argv[1] - if sys.argv[1] == '-3': - html3 = 1 - del sys.argv[1] - if len(sys.argv) <> 3: - print 'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory' - sys.exit(2) - - if html3: - parser = TexinfoParserHTML3() - else: - parser = TexinfoParser() - parser.cont = cont - parser.debugging = debugging - parser.print_headers = print_headers - - file = sys.argv[1] - parser.setdirname(sys.argv[2]) - if file == '-': - fp = sys.stdin - else: - parser.setincludedir(os.path.dirname(file)) - try: - fp = open(file, 'r') - except IOError, msg: - print file, ':', msg - sys.exit(1) - parser.parse(fp) - fp.close() - parser.report() - - -if __name__ == "__main__": - test() diff --git a/Doc/text2latex.py b/Doc/text2latex.py deleted file mode 100644 index 93d0587d304..00000000000 --- a/Doc/text2latex.py +++ /dev/null @@ -1,55 +0,0 @@ -import os -import sys -import regex -import regsub -import string -import getopt - -def main(): - process(sys.stdin, sys.stdout) - -dashes = regex.compile('^-+[ \t]*$') -equals = regex.compile('^=+[ \t]*$') -stars = regex.compile('^\*+[ \t]*$') -blank = regex.compile('^[ \t]*$') -indented = regex.compile('^\( *\t\| \)[ \t]*[^ \t]') - -def process(fi, fo): - inverbatim = 0 - line = '\n' - nextline = fi.readline() - while nextline: - prevline = line - line = nextline - nextline = fi.readline() - fmt = None - if dashes.match(nextline) >= 0: - fmt = '\\subsection{%s}\n' - elif equals.match(nextline) >= 0: - fmt = '\\section{%s}\n' - elif stars.match(nextline) >= 0: - fmt = '\\chapter{%s}\n' - if fmt: - nextline = '\n' - line = fmt % string.strip(line) - if '(' in line: - line = regsub.gsub('[a-zA-Z0-9_]+()', - '{\\\\tt \\0}', line) - elif inverbatim: - if blank.match(line) >= 0 and \ - indented.match(nextline) < 0: - inverbatim = 0 - fo.write('\\end{verbatim}\n') - else: - if indented.match(line) >= 0 and \ - blank.match(prevline) >= 0: - inverbatim = 1 - fo.write('\\begin{verbatim}\n') - if inverbatim: - line = string.expandtabs(line, 4) - elif not fmt and '(' in line: - line = regsub.gsub('[a-zA-Z0-9_]+()', - '\\\\code{\\0}', line) - fo.write(line) - -main() diff --git a/Doc/whichlibs b/Doc/whichlibs deleted file mode 100755 index 56287cbee36..00000000000 --- a/Doc/whichlibs +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sed -n 's/^\\input{\(lib[a-zA-Z0-9_]*\)}.*/\1.tex/p' lib.tex