ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Quads not appearing
@ 2025-02-26 15:40 Denis Maier via ntg-context
  2025-02-26 17:04 ` [NTG-context] " Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Maier via ntg-context @ 2025-02-26 15:40 UTC (permalink / raw)
  To: ntg-context; +Cc: denismaier


[-- Attachment #1.1: Type: text/plain, Size: 1740 bytes --]

Hi,

 

I have an xml setup like the one below. In my real document the qquads in
xml:index-entry don't appear, but I haven't been able to reproduce the
problem in the MWE. What could be the cause of such an issue?

 

I don't know if this is helpful, but I had to change the line

\xmlfilter{#1}{/term/command(xml:term)}\qquad\xmlfilter{#1}{/loc/command(xml
:loc)}

to

\xmlfilter{#1}{/term/command(xml:term)} -\qquad-
\xmlfilter{#1}{/loc/command(xml:loc)}

to make the qquad appear.

 

Best,

Denis

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\startxmlsetups xml:test

  \xmlsetsetup{#1}{*}{-}

  \xmlsetsetup{#1}{index|index-entry}{xml:*}

\stopxmlsetups

 

\xmlregisterdocumentsetup{test}{xml:test}

 

\definestartstop [Index] 

                [

                before={%

                \startnarrower[left]%

 
\setupalign[flushleft,verytolerant,extremestretch,nohz,nothanging]

                \setupindenting[-\leftskip,yes,first]%

                \setuphead[section][indentnext=yes]%

                },

                after=\stopnarrower,

                ]

 

\startxmlsetups xml:index

  \startIndex

    \xmlflush{#1}

  \stopIndex

\stopxmlsetups

 

\startxmlsetups xml:index-entry

  \startparagraph

 
\xmlfilter{#1}{/term/command(xml:term)}\qquad\xmlfilter{#1}{/loc/command(xml
:loc)}

  \stopparagraph

\stopxmlsetups

 

    

\startxmlsetups xml:term

  \xmlflush{#1}

\stopxmlsetups

    

\startxmlsetups xml:loc

  \xmlflush{#1}

\stopxmlsetups

 

\startbuffer[test]

<?xml version="1.0" encoding="UTF-8"?>

<index>

  <index-entry>

    <term>asdf</term>

    <loc>1</loc>

  </index-entry>

</index>

\stopbuffer

 

\starttext

 

\xmlprocessbuffer{test}{test}{}

 

\stoptext

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[-- Attachment #1.2: Type: text/html, Size: 7950 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Quads not appearing
  2025-02-26 15:40 [NTG-context] Quads not appearing Denis Maier via ntg-context
@ 2025-02-26 17:04 ` Wolfgang Schuster
  2025-02-27 14:23   ` Denis Maier via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2025-02-26 17:04 UTC (permalink / raw)
  To: ntg-context

Am 26.02.2025 um 16:40 schrieb Denis Maier via ntg-context:
> Hi,
> 
> I have an xml setup like the one below. In my real document the qquads 
> in xml:index-entry don’t appear, but I haven’t been able to reproduce 
> the problem in the MWE. What could be the cause of such an issue?
> 
> I don’t know if this is helpful, but I had to change the line
> 
> \xmlfilter{#1}{/term/command(xml:term)}\qquad\xmlfilter{#1}{/loc/ 
> command(xml:loc)}
> 
> to
> 
> \xmlfilter{#1}{/term/command(xml:term)} -\qquad- \xmlfilter{#1}{/loc/ 
> command(xml:loc)}
> 
> to make the qquad appear.

My guess is you have something before the \qquad accepts a number as 
argument and \qquad is used as number delimiter from TeX.

You can try to add either \relax, \space or \zerowidthspace before 
\qquad (just try what works).

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Quads not appearing
  2025-02-26 17:04 ` [NTG-context] " Wolfgang Schuster
@ 2025-02-27 14:23   ` Denis Maier via ntg-context
  2025-02-28 13:29     ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Maier via ntg-context @ 2025-02-27 14:23 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'; +Cc: denismaier

Ok, I've found it. The problem is that I have something in the xml file that produces spurios spaces, which I try to get rid of with \removeunwantedspaces. However, this seems to have an effect on the wanted \qquad. 
Is there a way to remove unwanted spaces inside a given element without affecting earlier spaces (in other elements) that should appear?
I guess \xmlstrip could be a solution to this problem, but I don't quite understand how this works.
Best,
Denis

%%%%%%%%%%%%% Updated Example %%%%%%%%%%%%%%%%%
\startxmlsetups xml:test
  \xmlsetsetup{#1}{*}{-}
  \xmlsetsetup{#1}{index|index-entry|num}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}


\startxmlsetups xml:index
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:index-entry
  \startparagraph
    \xmlfilter{#1}{/term/command(xml:term)}\qquad\qquad\qquad\xmlfilter{#1}{/loc/command(xml:loc)}
  \stopparagraph
\stopxmlsetups

    
\startxmlsetups xml:term
  \xmlflush{#1}
\stopxmlsetups
    
\startxmlsetups xml:loc
  \removeunwantedspaces
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:num
  \xmlflush{#1}
\stopxmlsetups

\startbuffer[test]
<?xml version="1.0" encoding="UTF-8"?>
<index>
  <index-entry>
    <term>asdf</term>
    <loc>
	  <num>1</num>
	 </loc>
  </index-entry>
</index>
\stopbuffer

\starttext

\xmlprocessbuffer{test}{test}{}

\stoptext


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Quads not appearing
  2025-02-27 14:23   ` Denis Maier via ntg-context
@ 2025-02-28 13:29     ` Hans Hagen via ntg-context
  2025-02-28 16:05       ` Denis Maier via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2025-02-28 13:29 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

On 2/27/2025 3:23 PM, Denis Maier via ntg-context wrote:
> Ok, I've found it. The problem is that I have something in the xml file that produces spurios spaces, which I try to get rid of with \removeunwantedspaces. However, this seems to have an effect on the wanted \qquad.
> Is there a way to remove unwanted spaces inside a given element without affecting earlier spaces (in other elements) that should appear?
> I guess \xmlstrip could be a solution to this problem, but I don't quite understand how this works.

\xmlstrip{#1}{.}
\xmlstrip{#1}{/*}

or s stripped finalizer .. depends on where used

> Best,
> Denis
> 
> %%%%%%%%%%%%% Updated Example %%%%%%%%%%%%%%%%%
> \startxmlsetups xml:test
>    \xmlsetsetup{#1}{*}{-}
>    \xmlsetsetup{#1}{index|index-entry|num}{xml:*}
> \stopxmlsetups
> 
> \xmlregisterdocumentsetup{test}{xml:test}
> 
> 
> \startxmlsetups xml:index
>      \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:index-entry
>    \startparagraph
>      \xmlfilter{#1}{/term/command(xml:term)}\qquad\qquad\qquad\xmlfilter{#1}{/loc/command(xml:loc)}
>    \stopparagraph
> \stopxmlsetups
> 
>      
> \startxmlsetups xml:term
>    \xmlflush{#1}
> \stopxmlsetups
>      
> \startxmlsetups xml:loc
>    \removeunwantedspaces
>    \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:num
>    \xmlflush{#1}
> \stopxmlsetups
> 
> \startbuffer[test]
> <?xml version="1.0" encoding="UTF-8"?>
> <index>
>    <index-entry>
>      <term>asdf</term>
>      <loc>
> 	  <num>1</num>
> 	 </loc>
>    </index-entry>
> </index>
> \stopbuffer
> 
> \starttext
> 
> \xmlprocessbuffer{test}{test}{}
> 
> \stoptext
> 
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


-- 

-----------------------------------------------------------------
                                           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 / 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Quads not appearing
  2025-02-28 13:29     ` Hans Hagen via ntg-context
@ 2025-02-28 16:05       ` Denis Maier via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Denis Maier via ntg-context @ 2025-02-28 16:05 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'; +Cc: denismaier

> -----Ursprüngliche Nachricht-----
> Von: Hans Hagen via ntg-context <ntg-context@ntg.nl>
> Gesendet: Freitag, 28. Februar 2025 14:30
> An: ntg-context@ntg.nl
> Cc: Hans Hagen <j.hagen@freedom.nl>
> Betreff: [NTG-context] Re: Quads not appearing
> 
> On 2/27/2025 3:23 PM, Denis Maier via ntg-context wrote:
> > Ok, I've found it. The problem is that I have something in the xml file
that
> produces spurios spaces, which I try to get rid of with
> \removeunwantedspaces. However, this seems to have an effect on the
> wanted \qquad.
> > Is there a way to remove unwanted spaces inside a given element without
> affecting earlier spaces (in other elements) that should appear?
> > I guess \xmlstrip could be a solution to this problem, but I don't quite
> understand how this works.
> 
> \xmlstrip{#1}{.}
> \xmlstrip{#1}{/*}

But this won't output anything right? This will just manipulate the
(sub)tree in place? Like some sort of preprocessor?

That means, I will need a combination of 
\xmlstrip{#1}{.}
\xmlflush{#1}

to actually produce the output. Is that correct?

Denis


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-28 16:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-26 15:40 [NTG-context] Quads not appearing Denis Maier via ntg-context
2025-02-26 17:04 ` [NTG-context] " Wolfgang Schuster
2025-02-27 14:23   ` Denis Maier via ntg-context
2025-02-28 13:29     ` Hans Hagen via ntg-context
2025-02-28 16:05       ` Denis Maier via ntg-context

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).