denisma...@mailbox.org schrieb am 30.04.2024 um 14:28:
-----Ursprüngliche Nachricht-----
Von: Wolfgang Schuster <wolfgang.schuster.li...@gmail.com>
Gesendet: Samstag, 27. April 2024 07:40
An: Denis Maier <denisma...@mailbox.org>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Betreff: Re: [NTG-context] Re: \par and \startlines
Denis Maier schrieb am 26.04.2024 um 19:52:
I see. But there's no command that could be used to simulate an empty line?
If not, me should I perhaps try to replicate the wrapper structure
from the XML source in context? (I'll also look into the format module
of
course.) What do you think?
Below is a different solution to your problem with works without \startlines
because you already mark up each individual line in the poem which make it
possible to add a linebreak in the output.
With \blank options (samepage) you can avoid pagebreaks between stanzas.
\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|poem|stanza|line}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:test}
\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:poem
\blank[line]
\xmlflush{#1}
\blank[back,line]
\stopxmlsetups
\startxmlsetups xml:stanza
\xmlflush{#1}\blank[preference,line]
\stopxmlsetups
\startxmlsetups xml:line
\xmlflush{#1}\blank[samepage,none]
\stopxmlsetups
\startbuffer[test]
<?xml version='1.0' standalone='yes?>
<doc>
<poem>
<stanza>
<line>The</line>
<line>lines</line>
<line>are</line>
<line>there!</line>
</stanza>
<stanza>
<line>The</line>
<line>lines</line>
<line>are</line>
<line>there!</line>
</stanza>
<stanza>
<line>The</line>
<line>lines</line>
<line>are</line>
<line>there!</line>
</stanza>
</poem>
</doc>
\stopbuffer
\starttext
\samplefile{lorem}
\xmlprocessbuffer{test}{test}{}
\samplefile{lorem}
\stoptext
Thanks for this solution. I've had a quick look, and it seems to do exactly
what I need. My requirements are rather simple at the moment, but that should
be sufficient, but to repeat Hraban's question: What would be the advantage of
using the format module?
The module provides features like
- alignment of the verse lines
- numbering of the lines (which isn't supported by \startlines
unless you add the normal linenumbering mechanism)
- support for lines which don't fit on a single page where the
consecutive lines are indented
but the module is outdated and relies on an old mkii style code base.
A big difference between the \startlines environment and the format
module is that the first treats
each line in the input file as a separate line in the output while the
format module requires begin/end
tags for each line which works better for xml input.
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________