Skip to content

Commit 5a855de

Browse files
vincek59pv
authored andcommitted
Fix makestatic for recent version of pyparsing
It's working with pyparsing 2.4.7 Add sagestr support. Sageexample environment is still not supported (cherry-picked from pull request #55 by @vincek59)
1 parent 7c120bc commit 5a855de

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts.dtx

+5-3
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,15 @@ from pyparsing import *
290290
% \begin{macrocode}
291291
def 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
296295
curlybrackets = skipToMatching('{', '}')
297296
squarebrackets = skipToMatching('[', ']')
298297
% \end{macrocode}
299298
% Next, parser for |\sage|, |\sageplot|, and pause/unpause calls:
300299
% \begin{macrocode}
301300
sagemacroparser = r'\sage' + curlybrackets('code')
301+
sagestrmacroparser = r'\sagestr' + curlybrackets('code')
302302
sageplotparser = (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

Comments
 (0)