PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
254 stars 203 forks source link

WeBWorK: recognize DropDown macro #2050

Open Alex-Jordan opened 9 months ago

Alex-Jordan commented 9 months ago

WeBWorK has a new macro DropDown for making a "select" style multiple choice. It's just a better version of PopUp. The new DropDown has an automatic placeholder. This commit lets PTX recognize the macro and automatically load its library file.

rbeezer commented 8 months ago

No rebase, no edits, no nothing. Did you not get the same error when testing? Do I need a pre-release server to test?

I do not get better information about problem 75 with -vv other than it being the affected problem. Odd that it seems to think there is an element named "A".

rob@atoll:~/mathbook/mathbook/examples/webwork$ make sample-chapter-representations
/home/rob/mathbook/mathbook/pretext/pretext -v -c webwork -p /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/publication.xml /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/sample-chapter.xml
PTX:INFO    : parsing possible configuration files: ['/home/rob/mathbook/mathbook/pretext/pretext.cfg', '/home/rob/mathbook/mathbook/user/mbx.cfg', '/home/rob/mathbook/mathbook/user/pretext.cfg']
PTX:INFO    : dictionary of executables/commands: {'latex': 'latex', 'pdflatex': 'pdflatex', 'xelatex': 'xelatex', 'pdfsvg': 'pdf2svg', 'asy': 'asy', 'sage': '/sage/sage-10.0/sage', 'pdfpng': 'convert', 'pdfeps': 'pdftops', 'node': 'node', 'liblouis': '/usr/local/bin/file2brl'}
PTX:INFO    : verifying and expanding XML source file: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/sample-chapter.xml
PTX:INFO    : input XML source file expanded to absolute path: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/sample-chapter.xml
PTX:INFO    : verifying and expanding publisher file: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/publication.xml
PTX:INFO    : input publisher file expanded to absolute path: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/publication.xml
PTX:INFO    : discovering source file's directory name: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter
PTX:INFO    : verifying and expanding input directory: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/generated
PTX:INFO    : input directory expanded to absolute path: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/generated
PTX:INFO    : verifying and expanding input directory: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/external
PTX:INFO    : input directory expanded to absolute path: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/external
PTX:INFO    : Done examining environment and initializing setup info
PTX:INFO    : string parameters passed to extraction stylesheet: {'publisher': '/home/rob/mathbook/mathbook/examples/webwork/sample-chapter/publication.xml'}
PTX:INFO    : discovering source file's directory name: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter
PTX:INFO    : verifying and expanding input directory: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/generated
PTX:INFO    : input directory expanded to absolute path: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/generated
PTX:INFO    : verifying and expanding input directory: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/external
PTX:INFO    : input directory expanded to absolute path: /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/external
PTX:INFO    : XSL conversion of /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/sample-chapter.xml by /home/rob/mathbook/mathbook/xsl/extract-pg.xsl
PTX:INFO    : comprehensive messages, warnings, and errors:
PTX:INFO    : successful application of /home/rob/mathbook/mathbook/xsl/extract-pg.xsl
PTX:INFO    : validating, cleaning server URL: https://webwork-ptx.aimath.org
PTX:INFO    : building representations of PTX-authored WeBWorK problem
PTX:INFO    : sending webwork-add-numbers to server to save in /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/generated/webwork/webwork-representations.xml: origin is 'ptx'
PTX:INFO    : building representations of PTX-authored WeBWorK problem
PTX:INFO    : sending webwork-10 to server to save in /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/generated/webwork/webwork-representations.xml: origin is 'ptx'

<snip>

PTX:INFO    : building representations of PTX-authored WeBWorK problem
PTX:INFO    : sending webwork-75 to server to save in /home/rob/mathbook/mathbook/examples/webwork/sample-chapter/generated/webwork/webwork-representations.xml: origin is 'ptx'
Traceback (most recent call last):
  File "/home/rob/mathbook/mathbook/pretext/pretext", line 812, in <module>
    main()
  File "/home/rob/mathbook/mathbook/pretext/pretext", line 657, in main
    ptx.webwork_to_xml(
  File "/home/rob/mathbook/mathbook/pretext/pretext.py", line 1605, in webwork_to_xml
    response_root = ET.fromstring(bytes(response_text, encoding='utf-8'))
  File "src/lxml/etree.pyx", line 3252, in lxml.etree.fromstring
  File "src/lxml/parser.pxi", line 1913, in lxml.etree._parseMemoryDocument
  File "src/lxml/parser.pxi", line 1800, in lxml.etree._parseDoc
  File "src/lxml/parser.pxi", line 1141, in lxml.etree._BaseParser._parseDoc
  File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
  File "<string>", line 10
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: A line 5 and webwork, line 10, column 11
make: *** [Makefile:121: sample-chapter-representations] Error 1
Alex-Jordan commented 8 months ago

Bah, I had the server set to webwork.runestone.academy for recent testing about that.

The new tool here is a 2.18 tool, and I haven't upgraded AIM servers yet. Hold on this until I make that upgrade? Sorry for the wild goose chase.

Alex-Jordan commented 3 months ago

Once #2115 is processed, I will close this and open something similar. #2115 gets the basic idea going for how to recognize that a certain feature is only going to work in certain versions of WeBWorK, and then catch that when the server version is established at the start of gathering representations.