Hi Robert,
Debugged and all, here you go.
Cheers,
Sietse

\useexternalfigure[img:fig:cow][cow.pdf]
\useexternalfigure[img:fig:mill][mill.png]

\starttext

\section{Pictures}
% The externalfigure names HAVE TO take the form 'img:FIGURELABEL',
% or the automatic image list at the end on won't be able to
% guess the image names from the figure labels.
\placefigure[here][fig:cow]
    {cap-cow}
    {\externalfigure[img:fig:cow]}

\section{More pictures}
\placefigure[here][fig:mill]
    {cap-mill}
    {\externalfigure[img:fig:mill]}


%%%% Lists start here %%%%%%%
\enablemode[draft]
\startmode[draft]

% Better list heading --- the captions are what matters
\setupheadtext[figures=List of Captions]
\completelistoffigures

% Now for printing all the images
\section{List of Pictures}
\startluacode
    -- we won't need the keys k, but still.
    for k,v in pairs(structures.lists.ordered.float.figure) do
        label_string = v.references.reference
        -- `..` is Lua for string concatenation
        image_string = "img:" .. label_string

        -- TeX <--> Lua, passing arguments to commands
        -- [stuff] <--> { 'stuff' }
        -- [stuff=bother] <--> { stuff = 'bother' }
        -- {stuff} <-->  'stuff'

        -- context.in() seems to have some Lua meaning
        -- so we print the command string directly, instead
        context("\\in{Figure}[" .. label_string .. "]")
        context.page( { 'no' } )
        context.externalfigure( { image_string }, { 'here' } )
        context.hairline()
        context.par() -- end paragraph
    end
\stopluacode
\stopmode

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

Reply via email to