Skip to content

Conversation

@gigamonkey
Copy link
Contributor

This seems like the Right Thing™ insofar as a data file should not need to be mangled to be legal XML text. However this change could possibly break existing books that have run into the problem this patch is fixing by adding escaping or CDATA into their datafiles.

@ascholerChemeketa
Copy link
Contributor

Initially posed on wrong PR. @rbeezer's post on -dev and this crossed in flight.

Our conclusion is that @source on datafile should probably be deprecated. (Correct me if that wasn't our conclusion Rob).

Usually @source usually means that the referenced asset is being loaded at run time. This @source is confusing because the asset is being loaded at build time (as text) into the XML before it is built. (Which is probably why you wanted to put the program into external, which is really for things that are going to be loaded at run time.)

It also is potentially confusing because you can use <pre> outside of a datafile, but @source is not going to work in those locations.

Anywhere else you wanted to include code from a file (like in the body of a <program>) you would have to use <xi:include parse="text" href="filepath"/> to inject the contents. That handles escaping the text to make it valid XML.

So pre@source is just a special case alternative to writing that.

The recommended authoring pattern for putting the contents into a separate file would be:

<datafile>
  <pre>
    <xi:include parse="text" href="filepath"/>
  </pre>
 </datafile>

@gigamonkey
Copy link
Contributor Author

Makes sense to me. At that point it's kind of weird to me to have the

 element at all, but I guess that's to contrast to the possibility of an  child.

@rbeezer
Copy link
Collaborator

rbeezer commented Jul 22, 2025

kind of weird

If you mean the pre element ("the element" is not clear to me), it is necessary to distinguish the case where the element is an image. Though maybe we coulda, shoulda, done that with an attribute.

@rbeezer rbeezer mentioned this pull request Jul 22, 2025
@gigamonkey
Copy link
Contributor Author

Lol. I forgot Markdown also lets you use arbitrary HTML. What I said, some of which got eaten by Markdown:

Makes sense to me. At that point it's kind of weird to me to have the <pre> element at all, but I guess that's to contrast to the possibility of an <image> child.

@ascholerChemeketa
Copy link
Contributor

@rbeezer I believe this could be closed. (Looking out for your open PR count!)

Possibly we need an issue to deprecate datafile/pre/@source that points to this thread.

@rbeezer
Copy link
Collaborator

rbeezer commented Dec 29, 2025

Looking out for your open PR count!

Thank-you! (That's motivating!)

Can you make an issue for the deprecation? I'm not up-to-speed on everything that is going on here. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants