PreTeXtBook / pretext

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

xi:include in program input #1324

Closed StevenClontz closed 4 years ago

StevenClontz commented 4 years ago

The following markup (based on https://pretextbook.org/doc/guide/html/topic-xinclude.html ) seems to result in the following error:

            <listing xml:id="programming-jupyter-use-tempdata">
                <program language="python"><input><xi:include parse="text" href="./files/programming-jupyter-use-tempdata.py"/></input></program>
            </listing>
<string>:0:0:ERROR:XSLT:ERR_OK: MBX:WARNING: There are apparent XML elements in locations that should be text only (1 times).
<string>:0:0:ERROR:XSLT:ERR_OK: MBX:WARNING: There is an apparent XML element (<include>) inside an <input> element, which should only contain text.  Using an escaped "less than" ('&lt;') might be the solution, or using a CDATA section.
<string>:0:0:ERROR:XSLT:ERR_OK:              located within: "programming-jupyter-use-tempdata" (xml:id)

Fair warning, this was output from the CLI, but I believe all the MBX:WARNINGs are passed through directly. If this isn't a known deprecation, I can confirm the error directly if you like.

rbeezer commented 4 years ago

There's a double ">>" at the end. I don't think that is the problem.

I think that is a "false positive" - in other words, the PTX is OK, the error-check is working as weitten, but that should be an exception to the situations we are warning about.

(I tried to parallelize building the website, but lost the warnings. I think.)

On 6/25/20 11:54 AM, Steven Clontz wrote:

The following markup (based on https://pretextbook.org/doc/guide/html/topic-xinclude.html ) seems to result in the following error:

|

<program language="python"><xi:include parse="text" href="./files/programming-jupyter-use-tempdata.py"/>> |

|:0:0:ERROR:XSLT:ERR_OK: MBX:WARNING: There are apparent XML elements in locations that should be text only (1 times). :0:0:ERROR:XSLT:ERR_OK: MBX:WARNING: There is an apparent XML element () inside an element, which should only contain text. Using an escaped "less than" ('<') might be the solution, or using a CDATA section. :0:0:ERROR:XSLT:ERR_OK: located within: "programming-jupyter-use-tempdata" (xml:id) |

Fair warning, this was output from the CLI, but I believe all the |MBX:WARNING|s are passed through directly. If this isn't a known deprecation, I can confirm the error directly if you like.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/1324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOLM4SF6GDLQ6IPMM37ZHDRYOMPXANCNFSM4OIUUITA.

rbeezer commented 4 years ago

Hmm. I just built the Guide at a command-line (both LaTeX and HTML) and did not get that warning.

I'd think the "include" would be acting on before that error-check runs.

StevenClontz commented 4 years ago

(Yeah, the double > was a typo I edited in the original post, but that was too late for the email.)

This was completely user error; my href attribute was incorrect. Apparently the behavior of .xinclude() method in lxml is to silently pass through <xi:include/> tags with an invalid href attribute. I don't know if a better error would appear if xsltproc was used directly on the commandline. I'm adding this as an issue in the CLI. Thanks!

rbeezer commented 4 years ago

At the command-line you get a notice. Broke The Guide: (reformatted)

/home/rob/mathbook/mathbook/doc/guide/basics/basics-part.xml:95: 
element include: XInclude error : could not load 
/home/rob/mathbook/mathbook/doc/guide/basics/foo.ptx, and no fallback was found

I strongly suspect this gets parsed well before we could examine the @href and "File Not Found" is not in the XSL skill set.

I have done nothing significant in pretext\pretext.py to capture messages, error logs, return codes, etc. Is this ball in my court? I'm unclear how much of pretext\pretext.py you are using and how much is new.

StevenClontz commented 4 years ago

@oscarlevin has done 99% of the work interfacing with mathbook/pretext/pretext.py - I think finding the right way to separate concerns is a good synchronous discussion for a future web conference.