@@ -290,15 +290,15 @@ from pyparsing import *
290290% \begin{macrocode}
291291def skipToMatching(opener, closer):
292292 nest = nestedExpr(opener, closer)
293- nest.setParseAction(lambda l, s, t: l[s:getTokensEndLoc()])
294- return nest
293+ return originalTextFor(nest)
295294
296295curlybrackets = skipToMatching('{', '}' )
297296squarebrackets = skipToMatching('[', ']' )
298297% \end{macrocode}
299298% Next, parser for |\sage|, |\sageplot|, and pause/unpause calls:
300299% \begin{macrocode}
301300sagemacroparser = r'\sage ' + curlybrackets('code')
301+ sagestrmacroparser = r'\sagestr ' + curlybrackets('code')
302302sageplotparser = (r'\sageplot '
303303 + Optional(squarebrackets)('opts')
304304 + Optional(squarebrackets)('format')
@@ -374,8 +374,10 @@ class DeSageTex():
374374% Parse |\sage| macros. We just need to pull in the result from the
375375% |.sout| file and increment the counter---that's what |self.sage| does.
376376% \begin{macrocode}
377+ strmacro = sagestrmacroparser
377378 smacro = sagemacroparser
378379 smacro.setParseAction(self.sage)
380+ strmacro.setParseAction(self.sage)
379381% \end{macrocode}
380382% Parse the |\usepackage{sagetex}| line. Right now we don't support
381383% comma-separated lists of packages.
@@ -419,7 +421,7 @@ class DeSageTex():
419421% looks for any one of the above bits, while ignoring anything that
420422% should be ignored.
421423% \begin{macrocode}
422- doit = smacro | senv | ssilent | usepackage | splot | stexindent
424+ doit = smacro | senv | ssilent | usepackage | splot | stexindent |strmacro
423425 doit.ignore('% ' + restOfLine)
424426 doit.ignore(r'\begin {verbatim }' + SkipTo(r' \end {verbatim }'))
425427 doit.ignore(r'\begin {comment }' + SkipTo(r'\end {comment }'))
0 commit comments