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