ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Felix Ingram <f.ingram.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: \placelist summary alternative solution
Date: Wed, 14 Dec 2011 16:50:18 +0000	[thread overview]
Message-ID: <CAK5aKC-dZora4=Xx0u5yb48tCx_iAGVjk5Vh33qKuAVS9UFTPA@mail.gmail.com> (raw)

I've ended up delving into the dark art that is Lua for this solution:

\define[0]\SummaryTable{%
\placetable[force, none]{}{%
\setupTABLE[frame=off]
\bTABLE
\bTABLEhead
\bTR\bTH Reference\eTH\bTH Title\eTH\bTH Page\eTH\eTR
\eTABLEhead
\bTABLEbody
\startluacode
    for k, v in ipairs(structures.lists.collected) do
        if v.metadata.kind == "section" and v.metadata.name == "section" then
            context.bTR()
                context.bTD()
                    context("REFREF")
                context.eTD()
                context.bTD()
                    context(v.titledata.title)
                context.eTD()
                context.bTD()
                    context(v.references.realpage)
                context.eTD()
            context.eTR()
        end
    end
\stopluacode%
\eTABLEbody
\eTABLE
}%
}%
\starttext
\section{Test}
\input{knuth}
\section{Test}
\input{knuth}
\section{Test}
\input{knuth}
\section{Test}
\input{knuth}
\section{Test}
\input{knuth}
\section{Test}
\input{knuth}
\section{Test}
\input{knuth}
\SummaryTable
\stoptext

This works to some degree though I have the following questions about it:

1. Is there a way to access a document global variable from Lua? I
will use this to replace the REFREF text.

2. v.references.realpage isn't the actual page of the title. How can I
access the page number that would have appeared in the ToC? (I've
restarted the page numbering in my master doc, the above example works
fine)

3. Is there a way to store some metadata along with my title? I'd like
something similar to this:
\myheader[author=me, date=2011-12-14]{This is my header with meta-data}
and then be able to access it from Lua again.

Thanks for any help you can give with this.

Felix
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


             reply	other threads:[~2011-12-14 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 16:50 Felix Ingram [this message]
2011-12-14 22:00 ` Hans Hagen

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='CAK5aKC-dZora4=Xx0u5yb48tCx_iAGVjk5Vh33qKuAVS9UFTPA@mail.gmail.com' \
    --to=f.ingram.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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).