[NTG-context] Minimal code for exporting custom tags

Aditya Mahajan adityam at umich.edu
Mon May 18 19:31:45 CEST 2020


On Mon, 18 May 2020, Aditya Mahajan wrote:

> On Mon, 18 May 2020, Hans Hagen wrote:
>
>> On 5/18/2020 9:09 AM, Aditya Mahajan wrote:
>>> Hi,
>>> 
>>> What is needed to enable export of user defined macros? Consider the 
>>> following example:
>>> 
>>> What am I missing in order to pass user-defined macros to the exporter?
>> you're probably missing documentation + a high level define command
>>
>> This registers (extra) elements:
>>
>> \setelementbackendtag[mycommand]
>> \setelementnature    [mycommand][mixed]
>>
>
> Thanks! This also helped me find the documentation in hybrid.pdf.

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.

```
\setelementbackendtag[mycommand]
\setelementnature    [mycommand][mixed]

\setupbackend[export=xml, level=0]

\starttext
\startsection[title={Sample document}]
   \startparagraph
     This is a paragraph
   \stopparagraph
   \startelement[mycommand][name=whatever]
     This is mycommand
   \stopelement
\stopsection
\stoptext
```

Using `\dostarttagged{mycommand}{whatever}` does export as `<mycommand detail="whatever">`, and looking at the code, I don't see why `\startelement` should behave differently.

Thanks,
Aditya


More information about the ntg-context mailing list