Skip to content

Commit fc62c3c

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 6fb60f9 commit fc62c3c

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
@@ -293,15 +293,15 @@ from pyparsing import *
293293
% \begin{macrocode}
294294
def skipToMatching(opener, closer):
295295
nest = nestedExpr(opener, closer)
296-
nest.setParseAction(lambda l, s, t: l[s:getTokensEndLoc()])
297-
return nest
296+
return originalTextFor(nest)
298297
299298
curlybrackets = skipToMatching('{', '}')
300299
squarebrackets = skipToMatching('[', ']')
301300
% \end{macrocode}
302301
% Next, parser for |\sage|, |\sageplot|, and pause/unpause calls:
303302
% \begin{macrocode}
304303
sagemacroparser = r'\sage' + curlybrackets('code')
304+
sagestrmacroparser = r'\sagestr' + curlybrackets('code')
305305
sageplotparser = (r'\sageplot'
306306
+ Optional(squarebrackets)('opts')
307307
+ Optional(squarebrackets)('format')
@@ -377,8 +377,10 @@ class DeSageTex():
377377
% Parse |\sage| macros. We just need to pull in the result from the
378378
% |.sout| file and increment the counter---that's what |self.sage| does.
379379
% \begin{macrocode}
380+
strmacro = sagestrmacroparser
380381
smacro = sagemacroparser
381382
smacro.setParseAction(self.sage)
383+
strmacro.setParseAction(self.sage)
382384
% \end{macrocode}
383385
% Parse the |\usepackage{sagetex}| line. Right now we don't support
384386
% comma-separated lists of packages.
@@ -422,7 +424,7 @@ class DeSageTex():
422424
% looks for any one of the above bits, while ignoring anything that
423425
% should be ignored.
424426
% \begin{macrocode}
425-
doit = smacro | senv | ssilent | usepackage | splot | stexindent
427+
doit = smacro | senv | ssilent | usepackage | splot | stexindent |strmacro
426428
doit.ignore('%' + restOfLine)
427429
doit.ignore(r'\begin{verbatim}' + SkipTo(r'\end{verbatim}'))
428430
doit.ignore(r'\begin{comment}' + SkipTo(r'\end{comment}'))

0 commit comments

Comments
 (0)