* XML-lookahead
@ 2006-08-27 12:50 Sjoerd Siebinga
2006-08-27 12:56 ` XML-lookahead Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: Sjoerd Siebinga @ 2006-08-27 12:50 UTC (permalink / raw)
Hi all,
Is it possible to use something like \doifnextcharelse for xml-
environments or is there a clever work-around? I need to know what
the next tag is in order to decide if a linebreak needs to be inserted.
For example:
\defineXMLenvironment [av] {} {} % linebreak unless followed by
<liste>-tag
\defineXMLenvironment [liste] {} {\crlf} % always a linebreak
\startXMLdata
<av> text </av> <liste> 15 </liste> <!-- \crlf -->
<av> text </av> <!-- \crlf -->
\stopXMLdata
Regards,
Sjoerd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: XML-lookahead
2006-08-27 12:50 XML-lookahead Sjoerd Siebinga
@ 2006-08-27 12:56 ` Hans Hagen
2006-08-27 13:29 ` XML-lookahead Sjoerd Siebinga
0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2006-08-27 12:56 UTC (permalink / raw)
Sjoerd Siebinga wrote:
> Hi all,
>
> Is it possible to use something like \doifnextcharelse for xml-
> environments or is there a clever work-around? I need to know what
> the next tag is in order to decide if a linebreak needs to be inserted.
>
there is a way to build a stack and look onto it but that's of no use here
> For example:
>
> \defineXMLenvironment [av] {} {} % linebreak unless followed by
> <liste>-tag
> \defineXMLenvironment [liste] {} {\crlf} % always a linebreak
>
>
> \startXMLdata
>
> <av> text </av> <liste> 15 </liste> <!-- \crlf -->
>
>
> <av> text </av> <!-- \crlf -->
>
> \stopXMLdata
>
maybe look back:
\disablemode[xml:linebreak]
\startsetups[xml:linebreak]
\doifmode{xml:linebreak}{\disablemode[xml:linebreak]\crlf}
\stopsetups
\defineXMLenvironment [av] {} {\ensablemode[xml:linebreak]}
\defineXMLenvironment [liste] {\setups[xml:linebreak]} {\crlf}
or sometign similar,
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: XML-lookahead
2006-08-27 12:56 ` XML-lookahead Hans Hagen
@ 2006-08-27 13:29 ` Sjoerd Siebinga
2006-08-27 18:00 ` XML-lookahead Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: Sjoerd Siebinga @ 2006-08-27 13:29 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 667 bytes --]
Thanks Hans, for the fast response.
On 27-aug-2006, at 14:56, Hans Hagen wrote:
> \disablemode[xml:linebreak]
>
> \startsetups[xml:linebreak]
> \doifmode{xml:linebreak}{\disablemode[xml:linebreak]\crlf}
> \stopsetups
>
> \defineXMLenvironment [av] {} {\ensablemode[xml:linebreak]}
>
> \defineXMLenvironment [liste] {\setups[xml:linebreak]} {\crlf}
>
> or sometign similar,
I have played around with this solution for a bit and
\defineXMLenvironment [liste] {} {\setups[xml:linebreak]}
seems to work for the <liste>-tag. But it not entirely clear to me
how this should work for the <av>-tag when it is not followed by
another tag on the same line.
Sjoerd
[-- Attachment #1.2: Type: text/html, Size: 2330 bytes --]
[-- Attachment #2: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: XML-lookahead
2006-08-27 13:29 ` XML-lookahead Sjoerd Siebinga
@ 2006-08-27 18:00 ` Hans Hagen
0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2006-08-27 18:00 UTC (permalink / raw)
Sjoerd Siebinga wrote:
> Thanks Hans, for the fast response.
> On 27-aug-2006, at 14:56, Hans Hagen wrote:
>
>> \disablemode[xml:linebreak]
>>
>>
>> \startsetups[xml:linebreak]
>>
>> � \doifmode{xml:linebreak}{\disablemode[xml:linebreak]\crlf} �
>>
>> \stopsetups�
>>
>>
>> \defineXMLenvironment [av] {} {\ensablemode[xml:linebreak]}
>>
>>
>> \defineXMLenvironment [liste] {\setups[xml:linebreak]} {\crlf}
>>
>>
>> or sometign similar, �
>>
>
> I have played around with this solution for a bit
> and�\defineXMLenvironment [liste] {} {\setups[xml:linebreak]}
> �seems to work for the <liste>-tag. But it not entirely clear to me
> how this should work for the <av>-tag when it is not followed by
> another tag on the same line.�
\def\dowithnextXMLelement#1%
{\pushmacro\executeXMLelement
\def\executeXMLelement{#1\popmacro\executeXMLelement}}
\defineXMLenvironment[aap]
{}
{\dowithnextXMLelement
{\doifelse{\currentXMLelement}{noot}
{ lust }
{ kust }}}
\starttext
\startXMLdata
<aap>een aap</aap><noot>een noot</noot>
<aap>een aap</aap><mies>een mies</mies>
\stopXMLdata
\stoptext
this assumes that i keep \executeXMLelement in its current location which is quite certain
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-08-27 18:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-27 12:50 XML-lookahead Sjoerd Siebinga
2006-08-27 12:56 ` XML-lookahead Hans Hagen
2006-08-27 13:29 ` XML-lookahead Sjoerd Siebinga
2006-08-27 18:00 ` XML-lookahead Hans Hagen
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).