sagemath / sagetex

Embed code, results of computations, and plots from the Sage mathematics software suite (https://www.sagemath.org) into LaTeX documents. Source repository for https://pypi.org/project/sagetex/ and https://ctan.org/pkg/sagetex
https://ctan.org/pkg/sagetex
Other
58 stars 22 forks source link

makestatic is back #53

Closed vincek59 closed 3 years ago

vincek59 commented 3 years ago

Hi,

I just make it works with recent version of pyparsing.

Thanks for sagetex

Vicek

dimpase commented 3 years ago

Thanks. Could you provide an example or an explanation for testing this?

dimpase commented 3 years ago

these .py files in the PR are generated files. Instead of providing them and other generated files, SageTeX generates them (just look at the first few lines of these files). So the changes should be done in the sources, not in these .py files.

vincek59 commented 3 years ago

Hi,

Oups, I did'nt see that theses files were autogenerated by scripts.dtx...

With example.tex from sagetex-master, python 3.9.2 and pyparsing 2.4.7.

./makestatic.py -o example.tex example_s.tex

I get:

Traceback (most recent call last):
  File "/home/vincent/tmp/sagemath/./makestatic.py", line 71, in <module>
    desagetexed = DeSageTex(src)
  File "/home/vincent/tmp/sagemath/sagetexparse.py", line 64, in __init__
    self.sout = SoutParser(fn + '.sagetex.sout')
  File "/home/vincent/tmp/sagemath/sagetexparse.py", line 53, in __init__
    OneOrMore(parselabel).parseFile(fn)
  File "/usr/lib/python3/dist-packages/pyparsing.py", line 2577, in parseFile
    return self.parseString(file_contents, parseAll)
  File "/usr/lib/python3/dist-packages/pyparsing.py", line 1943, in parseString
    loc, tokens = self._parse(instring, 0)
  File "/usr/lib/python3/dist-packages/pyparsing.py", line 1683, in _parseNoCache
    loc, tokens = self.parseImpl(instring, preloc, doActions)
  File "/usr/lib/python3/dist-packages/pyparsing.py", line 4697, in parseImpl
    loc, tokens = self_expr_parse(instring, loc, doActions, callPreParse=False)
  File "/usr/lib/python3/dist-packages/pyparsing.py", line 1683, in _parseNoCache
    loc, tokens = self.parseImpl(instring, preloc, doActions)
  File "/usr/lib/python3/dist-packages/pyparsing.py", line 4069, in parseImpl
    loc, exprtokens = e._parse(instring, loc, doActions)
  File "/usr/lib/python3/dist-packages/pyparsing.py", line 1716, in _parseNoCache
    tokens = fn(instring, tokensStart, retTokens)
  File "/usr/lib/python3/dist-packages/pyparsing.py", line 1316, in wrapper
    ret = func(*args[limit[0]:])
  File "/home/vincent/tmp/sagemath/sagetexparse.py", line 30, in <lambda>
    nest.setParseAction(lambda l, s, t: l[s:getTokensEndLoc()])
NameError: name 'getTokensEndLoc' is not defined

I think, it's because pyparsing changed.

I'll submit a new PR.