verbatim XML

32 views
Skip to first unread message

David Austin

unread,
Mar 4, 2023, 6:20:32 PM3/4/23
to pretext...@googlegroups.com
I'd like to include some verbatim XML code samples in a PTX document I'm working on.  I've tried various combinations of <listing>, <program>, <pre>, <cd>, and others.  Can someone give me a nudge in the right direction?

Thanks,
David

Mitch Keller

unread,
Mar 4, 2023, 6:22:08 PM3/4/23
to pretext...@googlegroups.com
Look in the basics reference of the Guide. The easiest thing to do is to put the code into a separate file and then xi:include it using mode (?) text. I think we use listing in the basics reference.

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/CANXmVMAN9WpzuUR1D5q6kNFohVUzNw2-XfKNboWVvhUkJeDXiw%40mail.gmail.com.


Rob Beezer

unread,
Mar 4, 2023, 9:18:23 PM3/4/23
to pretext...@googlegroups.com
Mitch's suggestion will work well, especially if you want to bring that file in
to actually also be part of your source and do what it is meant to do. I think
it is a "parse" attribute on "xi:include". Try the search function in the
Guide, it is documented.

"<" and "&" are special, no avoiding it. Gotta escape them. Search Guide on
"special characters", "xml characters", "dangerous characters".

But you won't want to escape them all! Pssst: this is a place where "CDATA" is
appropriate. I didn't just say that on the support list. Search on CDATA.

Sketchy, and reliant on our new search function. ;-) I'll trust that is enough
of a nudge. Follow-up on logistics or on overarching principles of markup
languages and the necessity of escape sequences.

Rob



On 3/4/23 15:21, Mitch Keller wrote:
> Look in the basics reference of the Guide. The easiest thing to do is to put the
> code into a separate file and then xi:include it using mode (?) text. I think we
> use listing in the basics reference.
>
>> On Mar 4, 2023, at 5:20 PM, David Austin <david.a...@gmail.com> wrote:
>>
>> I'd like to include some verbatim XML code samples in a PTX document I'm
>> working on.  I've tried various combinations of <listing>, <program>, <pre>,
>> <cd>, and others.  Can someone give me a nudge in the right direction?
>>
>> Thanks,
>> David
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "PreTeXt support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pretext-suppo...@googlegroups.com
>> <mailto:pretext-suppo...@googlegroups.com>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pretext-support/CANXmVMAN9WpzuUR1D5q6kNFohVUzNw2-XfKNboWVvhUkJeDXiw%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CANXmVMAN9WpzuUR1D5q6kNFohVUzNw2-XfKNboWVvhUkJeDXiw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> Mitch Keller
> mi...@rellek.net
>
> http://www.rellek.net/
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/4FD86769-B895-4FA4-9BEB-CD464CA5D8B1%40rellek.net <https://groups.google.com/d/msgid/pretext-support/4FD86769-B895-4FA4-9BEB-CD464CA5D8B1%40rellek.net?utm_medium=email&utm_source=footer>.

David Austin

unread,
Mar 5, 2023, 7:23:40 AM3/5/23
to pretext...@googlegroups.com
Yes, that's enough of a nudge!  I've got it working now thanks to both of you.  I put the XML in a separate file that I included with the attribute parse="text" and wrapped inside an <input>.  No need to escape anything or "use the misunderstood CDATA mechanism."  ;-)

Thanks,
David

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAyNC5iZWV6ZXI.1677982701%40quikprotect.

Steven Clontz

unread,
Mar 5, 2023, 11:45:51 AM3/5/23
to PreTeXt support
As a bonus, the xi:include parse='text' solution means your maintaining an actual XML file that can be potentially syntax highlighted appropriately by your editor or reveal errors in your markup.

David Austin

unread,
Mar 5, 2023, 12:40:51 PM3/5/23
to pretext...@googlegroups.com
Yes, that's a nice feature.

Reply all
Reply to author
Forward
0 new messages