Stream: shorthand
Topic: Weird non-rendering of xhtml in generated resource
Jean Duteau (Mar 17 2022 at 16:49):
I have a Composition.section.text that I'm setting and my end tags aren't showing up:
* text.div = """<div xmlns="http://www.w3.org/1999/xhtml"><img src="allopurinol-usp-3.jpg">SPL Image</img></div>"""
This is becoming this:
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><img src=\"allopurinol-usp-3.jpg\">SPL Image</div>"
The closing </img> tag has disappeared.
Julia Afeltra (Mar 17 2022 at 19:05):
This looks like a bug in SUSHI in how it parses the XHTML. I've created an issue to track it: SUSHI #1048.
Julia Afeltra (Mar 17 2022 at 20:03):
@Jean Duteau I looked at this a bit more and chatted with @Chris Moesel, and I realized that this is actually not valid XHTML, which I think is why the end tag doesn't show up. The img
tag is an empty element, which means it cannot have any child nodes, so it should not have the "SPL Image" text between the <img>
and </img>
tags.
I think you can move the "SPL Image" text to id
or alt
attributes on the img
tag or just move it outside the img
tag completely, depending on how you are using it.
Because the img
tag should not have content in it, I think it might be okay that SUSHI does not support this. However, it might be helpful if SUSHI could output a warning to explain what happened. I will update the linked issue. Hopefully that makes sense! Sorry for any confusion!
Jean Duteau (Mar 17 2022 at 21:12):
Ah right, that is bad on my transform that wasn't putting that text in the alt attribute. I didn't look closely enough to see that was incorrect.
Last updated: Apr 12 2022 at 19:14 UTC