@@ -290,15 +290,15 @@ from pyparsing import *
290
290
% \begin{macrocode}
291
291
def skipToMatching(opener, closer):
292
292
nest = nestedExpr(opener, closer)
293
- nest.setParseAction(lambda l, s, t: l[s:getTokensEndLoc()])
294
- return nest
293
+ return originalTextFor(nest)
295
294
296
295
curlybrackets = skipToMatching('{', '}' )
297
296
squarebrackets = skipToMatching('[', ']' )
298
297
% \end{macrocode}
299
298
% Next, parser for |\sage|, |\sageplot|, and pause/unpause calls:
300
299
% \begin{macrocode}
301
300
sagemacroparser = r'\sage ' + curlybrackets('code')
301
+ sagestrmacroparser = r'\sagestr ' + curlybrackets('code')
302
302
sageplotparser = (r'\sageplot '
303
303
+ Optional(squarebrackets)('opts')
304
304
+ Optional(squarebrackets)('format')
@@ -374,8 +374,10 @@ class DeSageTex():
374
374
% Parse |\sage| macros. We just need to pull in the result from the
375
375
% |.sout| file and increment the counter---that's what |self.sage| does.
376
376
% \begin{macrocode}
377
+ strmacro = sagestrmacroparser
377
378
smacro = sagemacroparser
378
379
smacro.setParseAction(self.sage)
380
+ strmacro.setParseAction(self.sage)
379
381
% \end{macrocode}
380
382
% Parse the |\usepackage{sagetex}| line. Right now we don't support
381
383
% comma-separated lists of packages.
@@ -419,7 +421,7 @@ class DeSageTex():
419
421
% looks for any one of the above bits, while ignoring anything that
420
422
% should be ignored.
421
423
% \begin{macrocode}
422
- doit = smacro | senv | ssilent | usepackage | splot | stexindent
424
+ doit = smacro | senv | ssilent | usepackage | splot | stexindent |strmacro
423
425
doit.ignore('% ' + restOfLine)
424
426
doit.ignore(r'\begin {verbatim }' + SkipTo(r' \end {verbatim }'))
425
427
doit.ignore(r'\begin {comment }' + SkipTo(r'\end {comment }'))
0 commit comments