Skip to content

Commit 45e696e

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 sagemath#55 by @vincek59)
1 parent b07fd4e commit 45e696e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts.dtx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,15 @@ from pyparsing import *
390390
% \begin{macrocode}
391391
def skipToMatching(opener, closer):
392392
nest = nestedExpr(opener, closer)
393-
nest.setParseAction(lambda l, s, t: l[s:getTokensEndLoc()])
394-
return nest
393+
return originalTextFor(nest)
395394
396395
curlybrackets = skipToMatching('{', '}')
397396
squarebrackets = skipToMatching('[', ']')
398397
% \end{macrocode}
399398
% Next, parser for |\sage|, |\sageplot|, and pause/unpause calls:
400399
% \begin{macrocode}
401400
sagemacroparser = r'\sage' + curlybrackets('code')
401+
sagestrmacroparser = r'\sagestr' + curlybrackets('code')
402402
sageplotparser = (r'\sageplot'
403403
+ Optional(squarebrackets)('opts')
404404
+ Optional(squarebrackets)('format')
@@ -474,8 +474,10 @@ class DeSageTex():
474474
% Parse |\sage| macros. We just need to pull in the result from the
475475
% |.sout| file and increment the counter---that's what |self.sage| does.
476476
% \begin{macrocode}
477+
strmacro = sagestrmacroparser
477478
smacro = sagemacroparser
478479
smacro.setParseAction(self.sage)
480+
strmacro.setParseAction(self.sage)
479481
% \end{macrocode}
480482
% Parse the |\usepackage{sagetex}| line. Right now we don't support
481483
% comma-separated lists of packages.
@@ -519,7 +521,7 @@ class DeSageTex():
519521
% looks for any one of the above bits, while ignoring anything that
520522
% should be ignored.
521523
% \begin{macrocode}
522-
doit = smacro | senv | ssilent | usepackage | splot | stexindent
524+
doit = smacro | senv | ssilent | usepackage | splot | stexindent |strmacro
523525
doit.ignore('%' + restOfLine)
524526
doit.ignore(r'\begin{verbatim}' + SkipTo(r'\end{verbatim}'))
525527
doit.ignore(r'\begin{comment}' + SkipTo(r'\end{comment}'))

0 commit comments

Comments
 (0)