* xml verbatim in xml...
@ 2017-08-08 20:46 Schmitz Thomas A.
2017-08-08 21:26 ` Pablo Rodriguez
0 siblings, 1 reply; 8+ messages in thread
From: Schmitz Thomas A. @ 2017-08-08 20:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi all,
excellent excuse to pester the list with a program: it’s for my presentation at the ConTeXt meeting (have YOU registered yet?)… So: I want to show verbatim xml, and I’m writing in xml. This solution: http://wiki.contextgarden.net/Verbatim_XML mostly works (for Lua and TeX code), except for one little detail: for verbatim xml, it also prints the <xmlcode> tag. Example:
\startbuffer[test]
<a>
<xmlcode>
<text>
<front>
...
</front>
<body>
...
</body>
</text>
</xmlcode>
</a>
\stopbuffer
\startxmlsetups xml:testsetups
\xmlsetsetup{\xmldocument}{a|xmlcode}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:testsetups}
\startluacode
function xml.functions.processXML(t)
buffers.assign("MyXml", "\\startXML\n" .. tostring(xml.text(t)) .. "\n\\stopXML")
context.getbuffer { "MyXml" }
end
\stopluacode
\startxmlsetups xml:a
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:xmlcode
\pushcatcodetable
\setcatcodetable\ctxcatcodes
\xmlfunction{#1}{processXML}
\popcatcodetable
\stopxmlsetups
\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext
How can this be prevented?
Thanks, and best wishes
Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: xml verbatim in xml...
2017-08-08 20:46 xml verbatim in xml Schmitz Thomas A.
@ 2017-08-08 21:26 ` Pablo Rodriguez
2017-08-08 21:37 ` Pablo Rodriguez
2017-08-09 6:48 ` Schmitz Thomas A.
0 siblings, 2 replies; 8+ messages in thread
From: Pablo Rodriguez @ 2017-08-08 21:26 UTC (permalink / raw)
To: ntg-context
On 08/08/2017 10:46 PM, Schmitz Thomas A. wrote:
> Hi all,
>
> excellent excuse to pester the list with a program: it’s for my
> presentation at the ConTeXt meeting (have YOU registered yet?)…
> So: I want to show verbatim xml, and I’m writing in xml. This
> solution: http://wiki.contextgarden.net/Verbatim_XML mostly works
> (for Lua and TeX code), except for one little detail: for verbatim
> xml, it also prints the <xmlcode> tag. Example:
Thomas,
\xmlprettyprint seems an easier approach.
And I don’t know whether there might be a bug here, but your issue
arises when it contains XML tags:
\startbuffer[test]
<a>
<texcode>
\starttext
\ConTeXt\ is awesome!
\stoptext
</texcode>
<xmlcode>
<text>
<front>
...
</front>
<body>
...
</body>
</text>
</code>
</a>
\stopbuffer
\startxmlsetups xml:testsetups %sorry, too lazy for more
\xmlsetsetup{\xmldocument}{a/xmlcode}{xml:xmlcode}
\xmlsetsetup{\xmldocument}{a/texcode}{xml:texcode}
\stopxmlsetups
\xmlregistersetup{xml:testsetups}
\startxmlsetups xml:texcode
\xmlprettyprint{#1}{none}
\stopxmlsetups
\startxmlsetups xml:xmlcode
\xmlprettyprint{#1}{none}
\stopxmlsetups
\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext
Just in case it helps,
Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: xml verbatim in xml...
2017-08-08 21:26 ` Pablo Rodriguez
@ 2017-08-08 21:37 ` Pablo Rodriguez
2017-08-09 9:03 ` Hans Hagen
2017-08-09 6:48 ` Schmitz Thomas A.
1 sibling, 1 reply; 8+ messages in thread
From: Pablo Rodriguez @ 2017-08-08 21:37 UTC (permalink / raw)
To: ntg-context
On 08/08/2017 11:26 PM, Pablo Rodriguez wrote:
> On 08/08/2017 10:46 PM, Schmitz Thomas A. wrote:
>> Hi all,
>>
>> excellent excuse to pester the list with a program: it’s for my
>> presentation at the ConTeXt meeting (have YOU registered yet?)…
>> So: I want to show verbatim xml, and I’m writing in xml. This
>> solution: http://wiki.contextgarden.net/Verbatim_XML mostly works
>> (for Lua and TeX code), except for one little detail: for verbatim
>> xml, it also prints the <xmlcode> tag. Example:
> Thomas,
>
> \xmlprettyprint seems an easier approach.
>
> And I don’t know whether there might be a bug here, but your issue
> arises when it contains XML tags:
Buffer in my previous sample was wrong (I modified something [to check
whether the string "xml" was the cause] and I copied the wrong version):
\startbuffer[test]
<a>
<texcode>
\starttext
\ConTeXt\ is awesome!
\stoptext
</texcode>
<xmlcode>
<text>
<front>
...
</front>
<body>
...
</body>
</text>
</xmlcode>
</a>
\stopbuffer
\startxmlsetups xml:testsetups
\xmlsetsetup{\xmldocument}{a/xmlcode}{xml:xmlcode}
\xmlsetsetup{\xmldocument}{a/texcode}{xml:texcode}
\stopxmlsetups
\xmlregistersetup{xml:testsetups}
\startxmlsetups xml:texcode
\xmlprettyprint{#1}{none}
\stopxmlsetups
\startxmlsetups xml:xmlcode
\xmlprettyprint{#1}{none}
\stopxmlsetups
\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext
Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: xml verbatim in xml...
2017-08-08 21:26 ` Pablo Rodriguez
2017-08-08 21:37 ` Pablo Rodriguez
@ 2017-08-09 6:48 ` Schmitz Thomas A.
2017-08-12 14:03 ` Pablo Rodriguez
1 sibling, 1 reply; 8+ messages in thread
From: Schmitz Thomas A. @ 2017-08-09 6:48 UTC (permalink / raw)
To: mailing list for ConTeXt users
> On 8. Aug 2017, at 23:26, Pablo Rodriguez <oinos@gmx.es> wrote:
>
> Thomas,
>
> \xmlprettyprint seems an easier approach.
Thank you, I did’n know about \xmlprettyprint. But I want to define my own prettyprinters, so it’s not suitable for my purpose. And it doesn’t solve the issue I was asking about.
Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: xml verbatim in xml...
2017-08-08 21:37 ` Pablo Rodriguez
@ 2017-08-09 9:03 ` Hans Hagen
2017-08-09 9:41 ` Jean-Pierre Delange
2017-08-09 14:30 ` Pablo Rodriguez
0 siblings, 2 replies; 8+ messages in thread
From: Hans Hagen @ 2017-08-09 9:03 UTC (permalink / raw)
To: ntg-context
On 8/8/2017 11:37 PM, Pablo Rodriguez wrote:
> On 08/08/2017 11:26 PM, Pablo Rodriguez wrote:
>> On 08/08/2017 10:46 PM, Schmitz Thomas A. wrote:
>>> Hi all,
>>>
>>> excellent excuse to pester the list with a program: it’s for my
>>> presentation at the ConTeXt meeting (have YOU registered yet?)…
>>> So: I want to show verbatim xml, and I’m writing in xml. This
>>> solution: http://wiki.contextgarden.net/Verbatim_XML mostly works
>>> (for Lua and TeX code), except for one little detail: for verbatim
>>> xml, it also prints the <xmlcode> tag. Example:
>> Thomas,
>>
>> \xmlprettyprint seems an easier approach.
>>
>> And I don’t know whether there might be a bug here, but your issue
>> arises when it contains XML tags:
>
> Buffer in my previous sample was wrong (I modified something [to check
> whether the string "xml" was the cause] and I copied the wrong version):
>
> \startbuffer[test]
> <a>
> <texcode>
> \starttext
> \ConTeXt\ is awesome!
> \stoptext
> </texcode>
>
> <xmlcode>
> <text>
> <front>
> ...
> </front>
> <body>
> ...
> </body>
> </text>
> </xmlcode>
> </a>
> \stopbuffer
>
> \startxmlsetups xml:testsetups
> \xmlsetsetup{\xmldocument}{a/xmlcode}{xml:xmlcode}
> \xmlsetsetup{\xmldocument}{a/texcode}{xml:texcode}
> \stopxmlsetups
>
> \xmlregistersetup{xml:testsetups}
>
> \startxmlsetups xml:texcode
> \xmlprettyprint{#1}{none}
> \stopxmlsetups
>
> \startxmlsetups xml:xmlcode
> \xmlprettyprint{#1}{none}
> \stopxmlsetups
>
> \starttext
> \xmlprocessbuffer{main}{test}{}
> \stoptext
\startbuffer[test]
<a>
<texcode>
\starttext
\ConTeXt\ is awesome!
\stoptext
</texcode>
<xmlcode>
<text>
<front>
...
</front>
<body>
...
</body>
</text>
</xmlcode>
</a>
\stopbuffer
\startxmlsetups xml:testsetups
\xmlsetsetup{\xmldocument}{a/xmlcode}{xml:xmlcode}
\xmlsetsetup{\xmldocument}{a/texcode}{xml:texcode}
\stopxmlsetups
\xmlregistersetup{xml:testsetups}
\startxmlsetups xml:texcode
\xmlprettyprint{#1}{tex}
\stopxmlsetups
\startxmlsetups xml:xmlcode
\xmlprettyprint{#1}{xml}
\stopxmlsetups
\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: xml verbatim in xml...
2017-08-09 9:03 ` Hans Hagen
@ 2017-08-09 9:41 ` Jean-Pierre Delange
2017-08-09 14:30 ` Pablo Rodriguez
1 sibling, 0 replies; 8+ messages in thread
From: Jean-Pierre Delange @ 2017-08-09 9:41 UTC (permalink / raw)
To: ntg-context
Thank you Hans ! This code is ... awesome !
JP
Le 09/08/2017 à 11:03, Hans Hagen a écrit :
> \startbuffer[test]
> <a>
> <texcode>
> \starttext
> \ConTeXt\ is awesome!
> \stoptext
> </texcode>
>
> <xmlcode>
> <text>
> <front>
> ...
> </front>
> <body>
> ...
> </body>
> </text>
> </xmlcode>
> </a>
> \stopbuffer
>
> \startxmlsetups xml:testsetups
> \xmlsetsetup{\xmldocument}{a/xmlcode}{xml:xmlcode}
> \xmlsetsetup{\xmldocument}{a/texcode}{xml:texcode}
> \stopxmlsetups
>
> \xmlregistersetup{xml:testsetups}
>
> \startxmlsetups xml:texcode
> \xmlprettyprint{#1}{tex}
> \stopxmlsetups
>
> \startxmlsetups xml:xmlcode
> \xmlprettyprint{#1}{xml}
> \stopxmlsetups
>
> \starttext
> \xmlprocessbuffer{main}{test}{}
> \stoptext
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: xml verbatim in xml...
2017-08-09 9:03 ` Hans Hagen
2017-08-09 9:41 ` Jean-Pierre Delange
@ 2017-08-09 14:30 ` Pablo Rodriguez
1 sibling, 0 replies; 8+ messages in thread
From: Pablo Rodriguez @ 2017-08-09 14:30 UTC (permalink / raw)
To: ntg-context
On 08/09/2017 11:03 AM, Hans Hagen wrote:
> \startbuffer[test]
> <a>
> <texcode>
> \starttext
> \ConTeXt\ is awesome!
> \stoptext
> </texcode>
>
> <xmlcode>
> <text>
> <front>
> ...
> </front>
> <body>
> ...
> </body>
> </text>
> </xmlcode>
> </a>
> \stopbuffer
>
> \startxmlsetups xml:testsetups
> \xmlsetsetup{\xmldocument}{a/xmlcode}{xml:xmlcode}
> \xmlsetsetup{\xmldocument}{a/texcode}{xml:texcode}
> \stopxmlsetups
>
> \xmlregistersetup{xml:testsetups}
>
> \startxmlsetups xml:texcode
> \xmlprettyprint{#1}{tex}
> \stopxmlsetups
>
> \startxmlsetups xml:xmlcode
> \xmlprettyprint{#1}{xml}
> \stopxmlsetups
>
> \starttext
> \xmlprocessbuffer{main}{test}{}
> \stoptext
Sorry, Hans, the issue isn’t coloring, but the inclusion of the
<xmlcode> tag.
As far as I know, it should behave as with the <texcode> tag, not
including it.
Many thanks for your help,
Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: xml verbatim in xml...
2017-08-09 6:48 ` Schmitz Thomas A.
@ 2017-08-12 14:03 ` Pablo Rodriguez
0 siblings, 0 replies; 8+ messages in thread
From: Pablo Rodriguez @ 2017-08-12 14:03 UTC (permalink / raw)
To: ntg-context
On 08/09/2017 08:48 AM, Schmitz Thomas A. wrote:
>
>> On 8. Aug 2017, at 23:26, Pablo Rodriguez <oinos@gmx.es> wrote:
>>
>> Thomas,
>>
>> \xmlprettyprint seems an easier approach.
>
> Thank you, I did’n know about \xmlprettyprint. But I want to define
> my own prettyprinters, so it’s not suitable for my purpose. And it
> doesn’t solve the issue I was asking about.
Thomas,
as you may already know, the issue is fixed with \xmlprettyprint (but
not with your sample) in latest beta.
Just in case it helps,
Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-08-12 14:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 20:46 xml verbatim in xml Schmitz Thomas A.
2017-08-08 21:26 ` Pablo Rodriguez
2017-08-08 21:37 ` Pablo Rodriguez
2017-08-09 9:03 ` Hans Hagen
2017-08-09 9:41 ` Jean-Pierre Delange
2017-08-09 14:30 ` Pablo Rodriguez
2017-08-09 6:48 ` Schmitz Thomas A.
2017-08-12 14:03 ` Pablo Rodriguez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).