[NTG-context] passing the \starttabulate format in XML typesetting

massifr at fastwebnet.it massifr at fastwebnet.it
Thu Jun 16 15:16:20 CEST 2016

Hello list,
I'm trying to map HTML with tabs to \starttabulate in ConTeXt.
A div of class "tabulate" is mapped to a \starttabulate ... \stoptabulate section,
p elements are rows and span elements of class "tab" produce \NCs in ConTeXt.
That div element has a "format" attribute that must be passed to \starttabulate[...]
to format the columns.

I managed to pass that attribute using lua, but I failed using only ConTeXt:

  <div class="tabulate" format="|lw(2cm)|cw(2cm)|rw(2cm)|">
    <p>a<span class="tab"> </span>b<span class="tab"> </span>c</p>

\startxmlsetups xml:somesetups


\startxmlsetups xml:text


function xml.functions.divTabulate(t)
  local format = xml.attribute(t, "", "format")
  context.starttabulate( { format } )

\startxmlsetups xml:div:tabulate
%  \xmlfunction{#1}{divTabulate}  % this works!
% the following line can't pass the format correctly to ConTeXt

\startxmlsetups xml:div:tabulate:p

\startxmlsetups xml:div:tabulate:p:tab


I suspect it's a simple mistake of mine.
Thanks in advance,

More information about the ntg-context mailing list