ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* issue with css selector in lpath
@ 2017-12-11 20:51 Pablo Rodriguez
  2017-12-11 22:51 ` mf
  0 siblings, 1 reply; 9+ messages in thread
From: Pablo Rodriguez @ 2017-12-11 20:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I have the following code:

    \xmlsetsetup{\xmldocument}
        {{header, #header}}
        {xml:titlepage}

I guess this is right, but I get the following compilation error:

tex error       > tex error on line 303 in file pandoc-xhtml.tex: !
Illegal parameter number in definition of \14>:xml:pandoc

<to be read again>
h
<argument> ...en:h1}\xmlsetsetup {\xmldocument }{{header, ##h

eader}}{xml:titlepage}\xml...
\syst_setups_start_xml_indeed ...1\expandafter {#3
                                                  }
l.303 \stopxmlsetups

If I replace the code above with the following one, everything compiles
fine:

    \xmlsetsetup{\xmldocument}
        {{header, [id="header"]}}
        {xml:titlepage}

Am I missing something, or what am I doing wrong here?

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] 9+ messages in thread

* Re: issue with css selector in lpath
  2017-12-11 20:51 issue with css selector in lpath Pablo Rodriguez
@ 2017-12-11 22:51 ` mf
  2017-12-12 21:36   ` Pablo Rodriguez
  0 siblings, 1 reply; 9+ messages in thread
From: mf @ 2017-12-11 22:51 UTC (permalink / raw)
  To: ntg-context

I think it's the "#header" without the name of an element before.
Try specifying an element you find in your document (i.e. "{{header,
tag#header}}"), just to see if it compiles.

If it compiles, it's likely you found a bug.

Best wishes,
Massi

Il giorno lun, 11/12/2017 alle 21.51 +0100, Pablo Rodriguez ha scritto:
> Dear list,
> 
> I have the following code:
> 
>     \xmlsetsetup{\xmldocument}
>         {{header, #header}}
>         {xml:titlepage}
> 
> I guess this is right, but I get the following compilation error:
> 
> tex error       > tex error on line 303 in file pandoc-xhtml.tex: !
> Illegal parameter number in definition of \14>:xml:pandoc
> 
> <to be read again>
> h
> <argument> ...en:h1}\xmlsetsetup {\xmldocument }{{header, ##h
> 
> eader}}{xml:titlepage}\xml...
> \syst_setups_start_xml_indeed ...1\expandafter {#3
>                                                   }
> l.303 \stopxmlsetups
> 
> If I replace the code above with the following one, everything
> compiles
> fine:
> 
>     \xmlsetsetup{\xmldocument}
>         {{header, [id="header"]}}
>         {xml:titlepage}
> 
> Am I missing something, or what am I doing wrong here?
> 
> Many thanks for your help,
> 
> Pablo
___________________________________________________________________________________
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] 9+ messages in thread

* Re: issue with css selector in lpath
  2017-12-11 22:51 ` mf
@ 2017-12-12 21:36   ` Pablo Rodriguez
  2017-12-13  9:22     ` MF
  0 siblings, 1 reply; 9+ messages in thread
From: Pablo Rodriguez @ 2017-12-12 21:36 UTC (permalink / raw)
  To: ntg-context

On 12/11/2017 11:51 PM, mf wrote:
> I think it's the "#header" without the name of an element before.
> Try specifying an element you find in your document (i.e. "{{header,
> tag#header}}"), just to see if it compiles.
> 
> If it compiles, it's likely you found a bug.

No, it doesn’t compile.

But {header, #header} shouldn’t be a problem, accorrding to
http://pragma-ade.com/general/manuals/xml-mkiv.pdf#page=34.

If this isn’t a bug, I wonder what I’m doing wrong.

Many thanks for your reply,

Pablo

> 
> Il giorno lun, 11/12/2017 alle 21.51 +0100, Pablo Rodriguez ha scritto:
>> Dear list,
>>
>> I have the following code:
>>
>>     \xmlsetsetup{\xmldocument}
>>         {{header, #header}}
>>         {xml:titlepage}
>>
>> I guess this is right, but I get the following compilation error:
>>
>> tex error       > tex error on line 303 in file pandoc-xhtml.tex: !
>> Illegal parameter number in definition of \14>:xml:pandoc
>>
>> <to be read again>
>> h
>> <argument> ...en:h1}\xmlsetsetup {\xmldocument }{{header, ##h
>>
>> eader}}{xml:titlepage}\xml...
>> \syst_setups_start_xml_indeed ...1\expandafter {#3
>>                                                   }
>> l.303 \stopxmlsetups
>>
>> If I replace the code above with the following one, everything
>> compiles
>> fine:
>>
>>     \xmlsetsetup{\xmldocument}
>>         {{header, [id="header"]}}
>>         {xml:titlepage}
>>
>> Am I missing something, or what am I doing wrong here?
>>
>> Many thanks for your help,
>>
>> Pablo
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 


-- 
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] 9+ messages in thread

* Re: issue with css selector in lpath
  2017-12-12 21:36   ` Pablo Rodriguez
@ 2017-12-13  9:22     ` MF
  2017-12-14 19:46       ` Pablo Rodriguez
  0 siblings, 1 reply; 9+ messages in thread
From: MF @ 2017-12-13  9:22 UTC (permalink / raw)
  To: ntg-context

Il giorno mar, 12/12/2017 alle 22.36 +0100, Pablo Rodriguez ha scritto:
> On 12/11/2017 11:51 PM, mf wrote:
> > I think it's the "#header" without the name of an element before.
> > Try specifying an element you find in your document (i.e.
> > "{{header,
> > tag#header}}"), just to see if it compiles.
> > 
> > If it compiles, it's likely you found a bug.
> 
> No, it doesn’t compile.
> 
> But {header, #header} shouldn’t be a problem, accorrding to
> http://pragma-ade.com/general/manuals/xml-mkiv.pdf#page=34.
> 
> If this isn’t a bug, I wonder what I’m doing wrong.
> 

Could you send a minimal (not) working example?

> > > I have the following code:
> > > 
> > >     \xmlsetsetup{\xmldocument}
> > >         {{header, #header}}
> > >         {xml:titlepage}
> > > 
> > > 

The error you get says that #header is read as a macro parameter, but
the "#" is not followed by a number, so the error.
Why "#header" is interpreted as a parameter? It smells like the "#" is
being parsed in a context with the wrong catcodes.

I would investigate the first (\xmldocument) and the third argument
(your xml:titlepage setup).

For the first one, I've always used the form:
\xmlsetsetup{#1}{{header, #header}}{xml:titlepage}

I'm reading from xml-mkiv.pdf, at page 19, that "The macro \xmldocument
expands to the current document id. There is also \xmlself which
expands to the current node number (#1 in setups)."

Could you modify your setup to use that form ("#1" i mean) and see if
it works?

Best wishes,
Massi
___________________________________________________________________________________
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] 9+ messages in thread

* Re: issue with css selector in lpath
  2017-12-13  9:22     ` MF
@ 2017-12-14 19:46       ` Pablo Rodriguez
  2017-12-14 20:39         ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Pablo Rodriguez @ 2017-12-14 19:46 UTC (permalink / raw)
  To: ntg-context

On 12/13/2017 10:22 AM, MF wrote:
> Il giorno mar, 12/12/2017 alle 22.36 +0100, Pablo Rodriguez ha scritto:
>> [...]
>> But {header, #header} shouldn’t be a problem, accorrding to
>> http://pragma-ade.com/general/manuals/xml-mkiv.pdf#page=34.
>>
>> If this isn’t a bug, I wonder what I’m doing wrong.
> 
> Could you send a minimal (not) working example?

Here you have it:

    \startbuffer[demo]
    <doc>
        <header>
            <p>Document Title</p>
            <p>Text from paragraph.</p>
        </header>
        <div id="header">
            <p>Document Title</p>
            <p>Text from paragraph.</p>
        </div>
        <div class="header">
            <p>Document Title</p>
            <p>Text from paragraph.</p>
        </div>
    </doc>
    \stopbuffer

    \startxmlsetups xml:initialize
         \xmlsetsetup{#1}{doc|p}{xml:*}
         \xmlsetsetup{#1}{{header}}{xml:header}
         \xmlsetsetup{#1}{{.header}}{xml:header:class}
         %~ \xmlsetsetup{#1}{{#header}}{xml:header:id}
         \xmlsetsetup{#1}{{id="header"}}{xml:header:id}
    \stopxmlsetups

    \xmlregistersetup{xml:initialize}

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

    \startxmlsetups xml:header
       \startalign[left]\xmlflush{#1}\stopalign
    \stopxmlsetups

    \startxmlsetups xml:header:class
       \start\em\xmlflush{#1}\stop
    \stopxmlsetups

    \startxmlsetups xml:header:id
       \startalign[right]\xmlflush{#1}\stopalign
    \stopxmlsetups

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

    \starttext
        \xmlprocessbuffer{main}{demo}{}
    \stoptext

.header works fine, it is only #header that breaks compiliation.

I hope Hans can fix it (or explain what I’m doing wrong).

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] 9+ messages in thread

* Re: issue with css selector in lpath
  2017-12-14 19:46       ` Pablo Rodriguez
@ 2017-12-14 20:39         ` Hans Hagen
  2017-12-14 21:18           ` Pablo Rodriguez
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2017-12-14 20:39 UTC (permalink / raw)
  To: ntg-context

On 12/14/2017 8:46 PM, Pablo Rodriguez wrote:
> On 12/13/2017 10:22 AM, MF wrote:
>> Il giorno mar, 12/12/2017 alle 22.36 +0100, Pablo Rodriguez ha scritto:
>>> [...]
>>> But {header, #header} shouldn’t be a problem, accorrding to
>>> http://pragma-ade.com/general/manuals/xml-mkiv.pdf#page=34.
>>>
>>> If this isn’t a bug, I wonder what I’m doing wrong.
>>
>> Could you send a minimal (not) working example?
> 
> Here you have it:
> 
>      \startbuffer[demo]
>      <doc>
>          <header>
>              <p>Document Title</p>
>              <p>Text from paragraph.</p>
>          </header>
>          <div id="header">
>              <p>Document Title</p>
>              <p>Text from paragraph.</p>
>          </div>
>          <div class="header">
>              <p>Document Title</p>
>              <p>Text from paragraph.</p>
>          </div>
>      </doc>
>      \stopbuffer
> 
>      \startxmlsetups xml:initialize
>           \xmlsetsetup{#1}{doc|p}{xml:*}
>           \xmlsetsetup{#1}{{header}}{xml:header}
>           \xmlsetsetup{#1}{{.header}}{xml:header:class}
>           %~ \xmlsetsetup{#1}{{#header}}{xml:header:id}
>           \xmlsetsetup{#1}{{id="header"}}{xml:header:id}
>      \stopxmlsetups
> 
>      \xmlregistersetup{xml:initialize}
> 
>      \startxmlsetups xml:doc
>         \xmlflush{#1}
>      \stopxmlsetups
> 
>      \startxmlsetups xml:header
>         \startalign[left]\xmlflush{#1}\stopalign
>      \stopxmlsetups
> 
>      \startxmlsetups xml:header:class
>         \start\em\xmlflush{#1}\stop
>      \stopxmlsetups
> 
>      \startxmlsetups xml:header:id
>         \startalign[right]\xmlflush{#1}\stopalign
>      \stopxmlsetups
> 
>      \startxmlsetups xml:p
>         \xmlflush{#1}
>      \stopxmlsetups
> 
>      \starttext
>          \xmlprocessbuffer{main}{demo}{}
>      \stoptext
> 
> .header works fine, it is only #header that breaks compiliation.
> 
> I hope Hans can fix it (or explain what I’m doing wrong).
There's nothing to fix, as mentioned already # is kind of special in 
tex, so you need to escape it:

\xmlsetsetup{#1}{{\letterhash header}}{xml:header:id}

The same is true for % : \letterpercent.

Hans

-----------------------------------------------------------------
                                           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] 9+ messages in thread

* Re: issue with css selector in lpath
  2017-12-14 20:39         ` Hans Hagen
@ 2017-12-14 21:18           ` Pablo Rodriguez
  2017-12-15  6:55             ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Pablo Rodriguez @ 2017-12-14 21:18 UTC (permalink / raw)
  To: ntg-context

On 12/14/2017 09:39 PM, Hans Hagen wrote:
> On 12/14/2017 8:46 PM, Pablo Rodriguez wrote:
>> .header works fine, it is only #header that breaks compiliation.
>>
>> I hope Hans can fix it (or explain what I’m doing wrong).
> 
> There's nothing to fix, as mentioned already # is kind of special in 
> tex, so you need to escape it:
> 
> \xmlsetsetup{#1}{{\letterhash header}}{xml:header:id}

Many thanks for your reply, Hans.

I got it now. xml-mkiv.pdf contains not escaped samples of css
identifier selectors, which contributes to the confusion.

Since the selector is basic in css (and escaping it gives a very weird
css), could you consider that it might not be required to escape # as
css selector?

(I would ask the same also for %, but I have never seen it in css.)

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] 9+ messages in thread

* Re: issue with css selector in lpath
  2017-12-14 21:18           ` Pablo Rodriguez
@ 2017-12-15  6:55             ` Hans Hagen
  2017-12-18 22:33               ` Pablo Rodriguez
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2017-12-15  6:55 UTC (permalink / raw)
  To: ntg-context

On 12/14/2017 10:18 PM, Pablo Rodriguez wrote:
> On 12/14/2017 09:39 PM, Hans Hagen wrote:
>> On 12/14/2017 8:46 PM, Pablo Rodriguez wrote:
>>> .header works fine, it is only #header that breaks compiliation.
>>>
>>> I hope Hans can fix it (or explain what I’m doing wrong).
>>
>> There's nothing to fix, as mentioned already # is kind of special in
>> tex, so you need to escape it:
>>
>> \xmlsetsetup{#1}{{\letterhash header}}{xml:header:id}
> 
> Many thanks for your reply, Hans.
> 
> I got it now. xml-mkiv.pdf contains not escaped samples of css
> identifier selectors, which contributes to the confusion.
> 
> Since the selector is basic in css (and escaping it gives a very weird
> css), could you consider that it might not be required to escape # as
> css selector?

then #1 would not work

> (I would ask the same also for %, but I have never seen it in css.)
> 
> Many thanks for your help,
> 
> Pablo
> 


-- 

-----------------------------------------------------------------
                                           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] 9+ messages in thread

* Re: issue with css selector in lpath
  2017-12-15  6:55             ` Hans Hagen
@ 2017-12-18 22:33               ` Pablo Rodriguez
  0 siblings, 0 replies; 9+ messages in thread
From: Pablo Rodriguez @ 2017-12-18 22:33 UTC (permalink / raw)
  To: ntg-context

On 12/15/2017 07:55 AM, Hans Hagen wrote:
> On 12/14/2017 10:18 PM, Pablo Rodriguez wrote:
>> [...]
>> Since the selector is basic in css (and escaping it gives a very weird
>> css), could you consider that it might not be required to escape # as
>> css selector?
> 
> then #1 would not work

Hans,

many thanks for your explanation.

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] 9+ messages in thread

end of thread, other threads:[~2017-12-18 22:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-11 20:51 issue with css selector in lpath Pablo Rodriguez
2017-12-11 22:51 ` mf
2017-12-12 21:36   ` Pablo Rodriguez
2017-12-13  9:22     ` MF
2017-12-14 19:46       ` Pablo Rodriguez
2017-12-14 20:39         ` Hans Hagen
2017-12-14 21:18           ` Pablo Rodriguez
2017-12-15  6:55             ` Hans Hagen
2017-12-18 22:33               ` 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).