ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
To: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: more register questions!
Date: Fri, 3 May 2024 23:12:32 +0200	[thread overview]
Message-ID: <7f869b28-dfe7-43a1-8b80-01d32ed5cde0@uni-bonn.de> (raw)
In-Reply-To: <02413272-536a-b0e6-a347-917e171d307d@gmail.com>

Hi Wolfgang,

powerful and elegant, as always! I think I have a solution with xml; I 
will have to test it more extensively with my complex real file; but 
here comes, also for Hraban (if it works in real life, I'll add it to 
the wiki...).

Thanks a lot!

Thomas

\startbuffer[test]
<document>
   <chapter>
     <p>Dummy text.<indexentry key="Dummy1"/><footnote
     id="chapter1:ftn1">Dummy footnote.<indexentry
     key="footnote1"/></footnote></p>
   </chapter>
   <chapter>
     <p>Dummy text.<indexentry key="Dummy2"/><footnote
     id="chapter1:ftn1">Dummy footnote.<indexentry
     key="footnote2"/></footnote></p>
   </chapter>
   <index/>
</document>
\stopbuffer

\startxmlsetups xml:testsetups
   \xmlsetsetup{#1}{*}{-}
   \xmlsetsetup{#1}{document|chapter|p|footnote|indexentry|index}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

\startxmlsetups xml:chapter
   \xmlflush {#1} \page
\stopxmlsetups

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

\startxmlsetups xml:footnote
   \footnote[\xmlatt{#1}{id}]{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:indexentry
   \xmldoiftext {#1} {ancestor::footnote}
                {\setregisterentry 
[index][keys:1=\xmlatt{#1}{key},entries:1=\xmlatt{#1}{key}][footnote={\rawcountervalue[footnote]}]}
 
{\setregisterentry[index][keys:1=\xmlatt{#1}{key},entries:1=\xmlatt{#1}{key}]}
\stopxmlsetups

\startxmlsetups xml:index
   \page \placeregister [index]
\stopxmlsetups

\def\IndexPageCommand#1%
   {#1\doifsomething
      {\currentregisterpageuserdata{footnote}}
      {\high{\currentregisterpageuserdata{footnote}}}}

\setupregister[index][pagecommand=\IndexPageCommand]
\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext




On 5/3/24 12:18, Wolfgang Schuster wrote:
> You can play with the following example, the main point use to use the 
> \setregisterentry command and pass the footnote counter with the third 
> (optional) argument.
> 
> \def\IndexPageCommand#1%
>    {#1\doifsomething
>       {\currentregisterpageuserdata{footnote}}
>       {\high{\currentregisterpageuserdata{footnote}}}}
> 
> \setupregister[index][pagecommand=\IndexPageCommand]
> 
> \starttext
> 
> \dorecurse{200}
> {\samplefile{lorem}\expanded{\setregisterentry[index][entries=\recurselevel]}%
> \samplefile{lorem}\footnote{xxx\expanded{\setregisterentry[index][entries=\recurselevel][footnote={\rawcountervalue[footnote]}]}}%
>     \samplefile{lorem}}
> 
> \page \placeindex
> 
> \stoptext
> 
> Wolfgang

-- 
Prof. Dr. Thomas A. Schmitz
Institut für Klassische und Romanische Philologie
Universität Bonn
Rabinstr. 8
53111 Bonn
http://www.philologie.uni-bonn.de/de/personal/schmitz

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

  reply	other threads:[~2024-05-03 21:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 15:01 [NTG-context] " Thomas A. Schmitz
2024-05-02 15:55 ` [NTG-context] " mf
2024-05-03 20:24   ` Thomas A. Schmitz
2024-05-03 20:36     ` Henning Hraban Ramm
2024-05-03 10:18 ` Wolfgang Schuster
2024-05-03 21:12   ` Thomas A. Schmitz [this message]
2024-05-08  2:22   ` Rik Kabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f869b28-dfe7-43a1-8b80-01d32ed5cde0@uni-bonn.de \
    --to=thomas.schmitz@uni-bonn.de \
    --cc=ntg-context@ntg.nl \
    --cc=wolfgang.schuster.lists@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).