@@ -41,13 +41,15 @@ class LaTeXFormatError(Error):
4141ESCAPED_CHARS = "$%#^ {}&~"
4242
4343
44- def pushing ( name , point , depth ):
44+ def dbgmsg ( msg ):
4545 if DEBUG :
46- sys .stderr .write ("%s<%s> at %s\n " % (" " * depth , name , point ))
46+ sys .stderr .write (msg + "\n " )
47+
48+ def pushing (name , point , depth ):
49+ dbgmsg ("%s<%s> at %s" % (" " * depth , name , point ))
4750
4851def popping (name , point , depth ):
49- if DEBUG :
50- sys .stderr .write ("%s</%s> at %s\n " % (" " * depth , name , point ))
52+ dbgmsg ("%s</%s> at %s" % (" " * depth , name , point ))
5153
5254
5355class Conversion :
@@ -71,11 +73,11 @@ def pop_output(self):
7173 self .write = self .ofp .write
7274
7375 def subconvert (self , endchar = None , depth = 0 ):
76+ stack = []
77+ line = self .line
7478 if DEBUG and endchar :
7579 self .err_write (
7680 "subconvert(%s)\n line = %s\n " % (`endchar` , `line[:20]` ))
77- stack = []
78- line = self .line
7981 while line :
8082 if line [0 ] == endchar and not stack :
8183 if DEBUG :
@@ -108,7 +110,7 @@ def subconvert(self, endchar=None, depth=0):
108110 # should be more careful, but this is easier to code:
109111 stack = []
110112 self .write (")document\n " )
111- elif envname == stack [- 1 ]:
113+ elif stack and envname == stack [- 1 ]:
112114 self .write (")%s\n " % envname )
113115 del stack [- 1 ]
114116 popping (envname , "a" , len (stack ) + depth )
@@ -203,7 +205,7 @@ def subconvert(self, endchar=None, depth=0):
203205 if m :
204206 line = line [m .end ():]
205207 elif type (attrname ) is type ([]):
206- # A normal subelement.
208+ # A normal subelement: <macroname><attrname>...</>.. .
207209 attrname = attrname [0 ]
208210 if not opened :
209211 opened = 1
@@ -212,7 +214,8 @@ def subconvert(self, endchar=None, depth=0):
212214 self .write ("(%s\n " % attrname )
213215 pushing (attrname , "sub-elem" , len (stack ) + depth + 1 )
214216 self .line = skip_white (line )[1 :]
215- line = subconvert ("}" , depth + len (stack ) + 2 )
217+ line = self .subconvert ("}" , len (stack ) + depth + 1 )[1 :]
218+ dbgmsg ("subconvert() ==> " + `line[:20]` )
216219 popping (attrname , "sub-elem" , len (stack ) + depth + 1 )
217220 self .write (")%s\n " % attrname )
218221 else :
@@ -376,6 +379,7 @@ def main():
376379 "item" : ([("leader" ,)], 1 , 0 , 0 , 0 ),
377380 "label" : (["id" ], 0 , 1 , 0 , 0 ),
378381 "labelwidth" : ([], 0 , 1 , 0 , 0 ),
382+ "large" : ([], 0 , 1 , 0 , 0 ),
379383 "LaTeX" : ([], 0 , 1 , 0 , 0 ),
380384 "leftmargin" : ([], 0 , 1 , 0 , 0 ),
381385 "leq" : ([], 0 , 1 , 0 , 0 ),
0 commit comments