* CSS selector for elements strictly preceded by other elements
@ 2018-08-02 8:20 MF
2018-08-02 17:52 ` Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: MF @ 2018-08-02 8:20 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hello list,
please consider these XML snippets:
<e/>some text<f/>
<e/>some text<h>blah blah</h>some other text<f/>
<e/><f/>
now apply these CSS selectors to them:
e ~ f matches all
e + f matches the first and the third
There's no CSS selector to match ONLY the third.
But i have a use case for that: sometimes i have endnote markers that
immediately follow footnote markers.
Since -- in my layout -- footnotes have letter markers and endnotes
numbers, it results in something like "c30" in superscript.
It would be nice putting a comma between them ("c,30") or a thin space,
but the "e + f" selector does not discriminate between:
blah blah<footnote-ref idref="c"/><endnote-ref idref="30"/>
and
blah blah<footnote-ref idref="d"/> some other text <endnote-ref
idref="31"/>
it would match both, but it's only the first one that i want to catch.
I'd suggest a non-standard "e ++ f" operator.
Would you prefer a lpath expression (which one)?
Greetings,
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] 4+ messages in thread
* Re: CSS selector for elements strictly preceded by other elements
2018-08-02 8:20 CSS selector for elements strictly preceded by other elements MF
@ 2018-08-02 17:52 ` Hans Hagen
2018-08-03 14:31 ` MF
0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2018-08-02 17:52 UTC (permalink / raw)
To: mailing list for ConTeXt users, MF
On 8/2/2018 10:20 AM, MF wrote:
> Hello list,
> please consider these XML snippets:
>
> <e/>some text<f/>
>
> <e/>some text<h>blah blah</h>some other text<f/>
>
> <e/><f/>
>
> now apply these CSS selectors to them:
>
> e ~ f matches all
>
> e + f matches the first and the third
>
> There's no CSS selector to match ONLY the third.
>
> But i have a use case for that: sometimes i have endnote markers that
> immediately follow footnote markers.
> Since -- in my layout -- footnotes have letter markers and endnotes
> numbers, it results in something like "c30" in superscript.
> It would be nice putting a comma between them ("c,30") or a thin space,
> but the "e + f" selector does not discriminate between:
>
> blah blah<footnote-ref idref="c"/><endnote-ref idref="30"/>
>
> and
>
> blah blah<footnote-ref idref="d"/> some other text <endnote-ref
> idref="31"/>
>
> it would match both, but it's only the first one that i want to catch.
>
> I'd suggest a non-standard "e ++ f" operator.
> Would you prefer a lpath expression (which one)?
make a (real) minimal example and we'll see what can be done
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] 4+ messages in thread
* Re: CSS selector for elements strictly preceded by other elements
2018-08-02 17:52 ` Hans Hagen
@ 2018-08-03 14:31 ` MF
2018-08-04 10:10 ` Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: MF @ 2018-08-03 14:31 UTC (permalink / raw)
To: mailing list for ConTeXt users
> make a (real) minimal example and we'll see what can be done
>
Here it is:
\startbuffer[test]
<body>
<p>In this paragraph<footnote>first footnote</footnote><endnote>endnote strictly
following a footnote (no other XML nodes between them)</endnote>
a footnote marker and an endnote marker are at the same point in the text;
in the XML source, their elements are contiguous, with nothing in between.
The CSS selector <code>footnote + endnote</code> works right, and the setup
associated to that selector puts a comma between their markers to
separate them in the typesetting.</p>
<p>In this paragraph<footnote>second footnote</footnote> they don't occur at the
same point in the text<endnote>endnote comes after footnote: there's some
text between them, but no XML elements</endnote>;
for the CSS selector <code>footnote + endnote</code> it's the same case of the previous paragraph,
because there's no other XML element between the <code>footnote</code> and the
<code>endnote</code> elements: that's why you still see a comma before
the endnote's marker, but this time it's not what I want.</p>
<p>In this paragraph<footnote>third footnote</footnote> they don't occur at the
same point in the text, and the CSS selector <code>footnote + endnote</code>
does not match<endnote>endnote comes after footnote, but there are 3 nodes
between them: a text, a <code>code</code> element, another text</endnote>,
because there's a <code>code</code> element between <code>footnote</code>
and <code>endnote</code> elements.</p>
<p>CSS has no operator to discriminate between the first two cases.</p>
</body>
\stopbuffer
\setupnotation[footnote][numberconversion=a]
\setupwhitespace[line]
\startxmlsetups xml:notesetups
\xmlsetsetup{#1}{body|p|footnote|code}{xml:*}
\xmlsetsetup{#1}{{endnote}}{xml:endnote}
\xmlsetsetup{#1}{{footnote + endnote}}{xml:endnote-after-footnote}
\stopxmlsetups
\xmlregistersetup{xml:notesetups}
\startxmlsetups xml:body
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:p
\xmlflush{#1}\par
\stopxmlsetups
\startxmlsetups xml:footnote
\footnote{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:code
{\tt\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:endnote
\endnote{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:endnote-after-footnote
\high{,}\endnote{\xmlflush{#1}}
\stopxmlsetups
\starttext
\xmlprocessbuffer{main}{test}{}
\page
\placenotes[endnote]
\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] 4+ messages in thread
* Re: CSS selector for elements strictly preceded by other elements
2018-08-03 14:31 ` MF
@ 2018-08-04 10:10 ` Hans Hagen
0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2018-08-04 10:10 UTC (permalink / raw)
To: mailing list for ConTeXt users, MF
On 8/3/2018 4:31 PM, MF wrote:
>
>> make a (real) minimal example and we'll see what can be done
>>
>
> Here it is:
>
> \startbuffer[test]
> <body>
> <p>In this paragraph<footnote>first footnote</footnote><endnote>endnote strictly
> following a footnote (no other XML nodes between them)</endnote>
> a footnote marker and an endnote marker are at the same point in the text;
> in the XML source, their elements are contiguous, with nothing in between.
> The CSS selector <code>footnote + endnote</code> works right, and the setup
> associated to that selector puts a comma between their markers to
> separate them in the typesetting.</p>
>
> <p>In this paragraph<footnote>second footnote</footnote> they don't occur at the
> same point in the text<endnote>endnote comes after footnote: there's some
> text between them, but no XML elements</endnote>;
> for the CSS selector <code>footnote + endnote</code> it's the same case of the previous paragraph,
> because there's no other XML element between the <code>footnote</code> and the
> <code>endnote</code> elements: that's why you still see a comma before
> the endnote's marker, but this time it's not what I want.</p>
>
> <p>In this paragraph<footnote>third footnote</footnote> they don't occur at the
> same point in the text, and the CSS selector <code>footnote + endnote</code>
> does not match<endnote>endnote comes after footnote, but there are 3 nodes
> between them: a text, a <code>code</code> element, another text</endnote>,
> because there's a <code>code</code> element between <code>footnote</code>
> and <code>endnote</code> elements.</p>
>
> <p>CSS has no operator to discriminate between the first two cases.</p>
> </body>
> \stopbuffer
>
> \setupnotation[footnote][numberconversion=a]
> \setupwhitespace[line]
>
> \startxmlsetups xml:notesetups
> \xmlsetsetup{#1}{body|p|footnote|code}{xml:*}
> \xmlsetsetup{#1}{{endnote}}{xml:endnote}
> \xmlsetsetup{#1}{{footnote + endnote}}{xml:endnote-after-footnote}
> \stopxmlsetups
>
> \xmlregistersetup{xml:notesetups}
>
> \startxmlsetups xml:body
> \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:p
> \xmlflush{#1}\par
> \stopxmlsetups
>
> \startxmlsetups xml:footnote
> \footnote{\xmlflush{#1}}
> \stopxmlsetups
>
> \startxmlsetups xml:code
> {\tt\xmlflush{#1}}
> \stopxmlsetups
>
> \startxmlsetups xml:endnote
> \endnote{\xmlflush{#1}}
> \stopxmlsetups
>
> \startxmlsetups xml:endnote-after-footnote
> \high{,}\endnote{\xmlflush{#1}}
> \stopxmlsetups
>
> \starttext
> \xmlprocessbuffer{main}{test}{}
> \page
> \placenotes[endnote]
> \stoptext
The obvious ...
\setupnotes[textseparator={, }]
\startxmlsetups xml:notesetups
\xmlsetsetup{#1}{body|p|footnote|endnote|code}{xml:*}
\stopxmlsetups
\startxmlsetups xml:endnote
\endnote{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:footnote
\footnote{\xmlflush{#1}}
\stopxmlsetups
--
-----------------------------------------------------------------
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] 4+ messages in thread
end of thread, other threads:[~2018-08-04 10:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-02 8:20 CSS selector for elements strictly preceded by other elements MF
2018-08-02 17:52 ` Hans Hagen
2018-08-03 14:31 ` MF
2018-08-04 10:10 ` 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).