Module latex2esis
[hide private]
[frames] | no frames]

Module latex2esis

Generate ESIS events based on a LaTeX source document and configuration data.

The conversion is not strong enough to work with arbitrary LaTeX documents; it has only been designed to work with the highly stylized markup used in the standard Python documentation. A lot of information about specific markup is encoded in the control table passed to the convert() function; changing this table can allow this tool to support additional LaTeX markups.

The format of the table is largely undocumented; see the commented headers where the table is specified in main(). There is no provision to load an alternate table from an external file.

Classes [hide private]
LaTeXFormatError
LaTeXStackError
_Stack
Conversion
TableEntry
Parameter
TableHandler
Functions [hide private]
 
dbgmsg(msg)
 
pushing(name, point, depth)
 
popping(name, point, depth)
 
new_stack()
 
convert(ifp, ofp, table)
 
skip_white(line)
 
load_table(fp)
 
main()
Variables [hide private]
  DEBUG = 0
  _begin_env_rx = re.compile(r'\\begin\{([^\}]*)\}')
  _end_env_rx = re.compile(r'\\end\{([^\}]*)\}')
  _begin_macro_rx = re.compile(r'\\([a-zA-Z]+\*?) ?(\{|\s*\n?)')
  _comment_rx = re.compile(r'%+ ?(.*)\n[ \t]*')
  _text_rx = re.compile(r'[^\]~%\\\{\}]+')
  _optional_rx = re.compile(r'(?m)\s*\[([^\]]*)\]')
  _parameter_rx = re.compile(r'[ \n]*\{(([^\{\}\}]|\{[^\}]*\})*)...
  _token_rx = re.compile(r'[a-zA-Z][a-zA-Z0-9\.-]*$')
  _start_group_rx = re.compile(r'[ \n]*\{')
  _start_optional_rx = re.compile(r'[ \n]*\[')
  ESCAPED_CHARS = '$%#^ {}&~'

Imports: errno, getopt, os, re, sys, xml, encode


Variables Details [hide private]

_parameter_rx

Value:
re.compile(r'[ \n]*\{(([^\{\}\}]|\{[^\}]*\})*)\}')