@@ -390,15 +390,15 @@ from pyparsing import *
390
390
% \begin{macrocode}
391
391
def skipToMatching(opener, closer):
392
392
nest = nestedExpr(opener, closer)
393
- nest.setParseAction(lambda l, s, t: l[s:getTokensEndLoc()])
394
- return nest
393
+ return originalTextFor(nest)
395
394
396
395
curlybrackets = skipToMatching('{', '}' )
397
396
squarebrackets = skipToMatching('[', ']' )
398
397
% \end{macrocode}
399
398
% Next, parser for |\sage|, |\sageplot|, and pause/unpause calls:
400
399
% \begin{macrocode}
401
400
sagemacroparser = r'\sage ' + curlybrackets('code')
401
+ sagestrmacroparser = r'\sagestr ' + curlybrackets('code')
402
402
sageplotparser = (r'\sageplot '
403
403
+ Optional(squarebrackets)('opts')
404
404
+ Optional(squarebrackets)('format')
@@ -474,8 +474,10 @@ class DeSageTex():
474
474
% Parse |\sage| macros. We just need to pull in the result from the
475
475
% |.sout| file and increment the counter---that's what |self.sage| does.
476
476
% \begin{macrocode}
477
+ strmacro = sagestrmacroparser
477
478
smacro = sagemacroparser
478
479
smacro.setParseAction(self.sage)
480
+ strmacro.setParseAction(self.sage)
479
481
% \end{macrocode}
480
482
% Parse the |\usepackage{sagetex}| line. Right now we don't support
481
483
% comma-separated lists of packages.
@@ -519,7 +521,7 @@ class DeSageTex():
519
521
% looks for any one of the above bits, while ignoring anything that
520
522
% should be ignored.
521
523
% \begin{macrocode}
522
- doit = smacro | senv | ssilent | usepackage | splot | stexindent
524
+ doit = smacro | senv | ssilent | usepackage | splot | stexindent |strmacro
523
525
doit.ignore('% ' + restOfLine)
524
526
doit.ignore(r'\begin {verbatim }' + SkipTo(r' \end {verbatim }'))
525
527
doit.ignore(r'\begin {comment }' + SkipTo(r'\end {comment }'))
0 commit comments