diff options
author | Fred Drake <fdrake@acm.org> | 1999-01-08 15:48:47 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-01-08 15:48:47 (GMT) |
commit | ed94dde4b93cc011defed776732a4e734d81bc13 (patch) | |
tree | 2133d8727b2d5b3bf5dd8bff9fe5755fbad82a3a /Doc/tools | |
parent | dd21c3216925f855ff182799b6fbf1137a414c7a (diff) | |
download | cpython-ed94dde4b93cc011defed776732a4e734d81bc13.zip cpython-ed94dde4b93cc011defed776732a4e734d81bc13.tar.gz cpython-ed94dde4b93cc011defed776732a4e734d81bc13.tar.bz2 |
No longer useful.
Diffstat (limited to 'Doc/tools')
-rw-r--r-- | Doc/tools/text2latex.py | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/Doc/tools/text2latex.py b/Doc/tools/text2latex.py deleted file mode 100644 index 93d0587..0000000 --- a/Doc/tools/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() |