Back to index

python3.2  3.2.2
Classes | Functions | Variables
texi2html Namespace Reference

Classes

class  HTMLNode
class  HTML3Node
class  TexinfoParser
class  TexinfoParserHTML3
class  HTMLHelp

Functions

def makevar
def splitwords
def findwordend
def makefile
def fixfunnychars
def increment
def test

Variables

string MAGIC = '\\input texinfo'
tuple cmprog = re.compile('^@([a-z]+)([ \t]|$)')
tuple blprog = re.compile('^[ \t]*$')
tuple kwprog = re.compile('@[a-z]+')
tuple spprog = re.compile('[\n@{}&<>]')
tuple miprog = re.compile('^\* ([^:]*):(:|[ \t]*([^\t,\n.]+)([^ \t\n]*))[ \t\n]*')
tuple fwprog = re.compile('[@{} ]')
string goodchars = '!@-=+.'

Function Documentation

def texi2html.findwordend (   str,
  i,
  n 
)

Definition at line 1957 of file texi2html.py.

01957 
01958 def findwordend(str, i, n):
01959     level = 0
01960     while i < n:
01961         mo = fwprog.search(str, i)
01962         if not mo:
01963             break
01964         i = mo.start()
01965         c = str[i]; i = i+1
01966         if c == '@': i = i+1 # Next character is not special
01967         elif c == '{': level = level+1
01968         elif c == '}': level = level-1
01969         elif c == ' ' and level <= 0: return i-1
01970     return n
01971 
01972 
# Convert a node name into a file name

Here is the caller graph for this function:

def texi2html.fixfunnychars (   addr)

Definition at line 1985 of file texi2html.py.

01985 
01986 def fixfunnychars(addr):
01987     i = 0
01988     while i < len(addr):
01989         c = addr[i]
01990         if c not in goodchars:
01991             c = '-'
01992             addr = addr[:i] + c + addr[i+1:]
01993         i = i + len(c)
01994     return addr
01995 
01996 
# Increment a string used as an enumeration

Here is the caller graph for this function:

def texi2html.increment (   s)

Definition at line 1997 of file texi2html.py.

01997 
01998 def increment(s):
01999     if not s:
02000         return '1'
02001     for sequence in string.digits, string.ascii_lowercase, string.ascii_uppercase:
02002         lastc = s[-1]
02003         if lastc in sequence:
02004             i = sequence.index(lastc) + 1
02005             if i >= len(sequence):
02006                 if len(s) == 1:
02007                     s = sequence[0]*2
02008                     if s == '00':
02009                         s = '10'
02010                 else:
02011                     s = increment(s[:-1]) + sequence[0]
02012             else:
02013                 s = s[:-1] + sequence[i]
02014             return s
02015     return s # Don't increment
02016 

Here is the caller graph for this function:

def texi2html.makefile (   nodename)

Definition at line 1973 of file texi2html.py.

01973 
01974 def makefile(nodename):
01975     nodename = nodename.strip()
01976     return fixfunnychars(nodename) + '.html'
01977 
01978 
# Characters that are perfectly safe in filenames and hyperlinks

Here is the call graph for this function:

Here is the caller graph for this function:

def texi2html.makevar (   str)

Definition at line 1936 of file texi2html.py.

01936 
01937 def makevar(str):
01938     return '@var{'+str+'}'
01939 
01940 
# Split a string in "words" according to findwordend

Here is the caller graph for this function:

def texi2html.splitwords (   str,
  minlength 
)

Definition at line 1941 of file texi2html.py.

01941 
01942 def splitwords(str, minlength):
01943     words = []
01944     i = 0
01945     n = len(str)
01946     while i < n:
01947         while i < n and str[i] in ' \t\n': i = i+1
01948         if i >= n: break
01949         start = i
01950         i = findwordend(str, i, n)
01951         words.append(str[start:i])
01952     while len(words) < minlength: words.append('')
01953     return words
01954 
01955 
# Find the end of a "word", matching braces and interpreting @@ @{ @}

Here is the call graph for this function:

Here is the caller graph for this function:

def texi2html.test ( )

Definition at line 2017 of file texi2html.py.

02017 
02018 def test():
02019     import sys
02020     debugging = 0
02021     print_headers = 0
02022     cont = 0
02023     html3 = 0
02024     htmlhelp = ''
02025 
02026     while sys.argv[1] == ['-d']:
02027         debugging = debugging + 1
02028         del sys.argv[1]
02029     if sys.argv[1] == '-p':
02030         print_headers = 1
02031         del sys.argv[1]
02032     if sys.argv[1] == '-c':
02033         cont = 1
02034         del sys.argv[1]
02035     if sys.argv[1] == '-3':
02036         html3 = 1
02037         del sys.argv[1]
02038     if sys.argv[1] == '-H':
02039         helpbase = sys.argv[2]
02040         del sys.argv[1:3]
02041     if len(sys.argv) != 3:
02042         print('usage: texi2hh [-d [-d]] [-p] [-c] [-3] [-H htmlhelp]', \
02043               'inputfile outputdirectory')
02044         sys.exit(2)
02045 
02046     if html3:
02047         parser = TexinfoParserHTML3()
02048     else:
02049         parser = TexinfoParser()
02050     parser.cont = cont
02051     parser.debugging = debugging
02052     parser.print_headers = print_headers
02053 
02054     file = sys.argv[1]
02055     dirname  = sys.argv[2]
02056     parser.setdirname(dirname)
02057     parser.setincludedir(os.path.dirname(file))
02058 
02059     htmlhelp = HTMLHelp(helpbase, dirname)
02060     parser.sethtmlhelp(htmlhelp)
02061 
02062     try:
02063         fp = open(file, 'r')
02064     except IOError as msg:
02065         print(file, ':', msg)
02066         sys.exit(1)
02067 
02068     parser.parse(fp)
02069     fp.close()
02070     parser.report()
02071 
02072     htmlhelp.finalize()
02073 


Variable Documentation

tuple texi2html.blprog = re.compile('^[ \t]*$')

Definition at line 74 of file texi2html.py.

tuple texi2html.cmprog = re.compile('^@([a-z]+)([ \t]|$)')

Definition at line 73 of file texi2html.py.

tuple texi2html.fwprog = re.compile('[@{} ]')

Definition at line 1956 of file texi2html.py.

Definition at line 1979 of file texi2html.py.

tuple texi2html.kwprog = re.compile('@[a-z]+')

Definition at line 75 of file texi2html.py.

string texi2html.MAGIC = '\\input texinfo'

Definition at line 71 of file texi2html.py.

tuple texi2html.miprog = re.compile('^\* ([^:]*):(:|[ \t]*([^\t,\n.]+)([^ \t\n]*))[ \t\n]*')

Definition at line 81 of file texi2html.py.

tuple texi2html.spprog = re.compile('[\n@{}&<>]')

Definition at line 77 of file texi2html.py.