[NTG-context] Minimal code for exporting custom tags

Aditya Mahajan adityam at umich.edu
Tue May 19 07:45:42 CEST 2020

On Mon, 18 May 2020, Aditya Mahajan wrote:

>> Thanks! This also helped me find the documentation in hybrid.pdf.

Also epub-mkiv.pdf. Not sure why I didn't think of looking there.

> How do I pass options so that the export is
> <mycommand name=whatever>...</mycommand>
> (or some variant of that). I thought that
> \startelement[mycommand][name=whatever]
> should work (there are some such examples in the texmf tree), but it does 
> not.

epub-mkiv.pdf states that I need `\setupexport[properties=yes]`, but that doesn't work either:

\setupexport [properties=my]

\setelementnature    [mycommand][mixed]

\startsection[title={Sample document}]
     This is a paragraph
     This is mycommand


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>


     input filename   : test-tag
     processing date  : 2020-05-19T01:34:41-04:00
     context version  : 2020.05.09 15:37
     exporter version : 0.35


<!-- This export file is used for filtering runtime only! -->

<document context="2020.05.09 15:37" date="2020-05-19T01:34:41-04:00" file="test-tag" language="en" version="0.35" xmlns:m="http://www.w3.org/1998/Math/MathML">
  <section detail="section" chain="section" implicit="1" level="3">
    <sectiontitle>Sample document</sectiontitle>
    <paragraph>This is a paragraph</paragraph>
    <mycommand>This is mycommand</mycommand>

What am I still missing?

On a different note, I didn't realize that interfaces.implement could create macros which could be used like this:

        align      {\exportparameter\c!align}%
        bodyfont   \dimexpr\exportparameter\c!bodyfont\relax
        width      \dimexpr\exportparameter\c!width\relax
        properties {\exportparameter\c!properties}%
        hyphen     {\exportparameter\c!hyphen}%
        title      {\exportparameter\c!title}%
        subtitle   {\exportparameter\c!subtitle}%
        author     {\exportparameter\c!author}%
        firstpage  {\exportparameter\c!firstpage}%
        lastpage   {\exportparameter\c!lastpage}%
        svgstyle   {\exportparameter\c!svgstyle}%
        cssfile    {\exportparameter\c!cssfile}%
        file       {\exportparameter\c!file}%
        export     {\backendparameter\c!export}%


This nicely gets around TeX's limitation of 9 arguments!


More information about the ntg-context mailing list