PreTeXtBook / pretext

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

Webwork extract refactor #2044

Closed StevenClontz closed 9 months ago

StevenClontz commented 9 months ago

This PR modifies extract-pg.xsl to output an XML file, which Python reads with lxml to obtain the data it requires to create webwork-representations.xml.

I am able to successfully build webwork-representations.xml for both the minimal and sample-chapter webwork examples using this script, and they are identical to the current result of the head of the master branch.

rbeezer commented 9 months ago

I checked the first part of this yesterday, just the effect of changes to extract-pg.xsl. They are as expected with regard to new XML containers.

With a switch from text output to XML output, the ampersand and less-than are being excaped, as they would need to be. And I guess that is fine since once consumed by lxml they behave properly.

I'll check the whole pipeline here shortly. I'd also like to have input from @Alex-Jordan, or at least have him say he can't get to this one.

StevenClontz commented 9 months ago

I'd like to implement Alex's idea that there's no need to write a file to disk: use this XSL in memory to create an lxml ElementTree, then read it directly rather than writing to disk. But that will come in a later PR.

Alex-Jordan commented 9 months ago

I won't have time to directly test this out. I get the high level description of the change and it sounds good. All I would suggest is what Rob is already planning to do: compare before and after with the representations file on the WW sample chapter. There should be no changes, I think. Or if there are, they should be inconsequential.

rbeezer commented 9 months ago

Reorganized as two logical commits, but no change to the overall code.

Zero appreciable change to the representations file for the sample chapter.