ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Minimal code for exporting custom tags
Date: Tue, 19 May 2020 01:45:42 -0400 (EDT)	[thread overview]
Message-ID: <nycvar.YAK.7.77.849.2005190132190.414636@nqv-guvaxcnq> (raw)
In-Reply-To: <nycvar.YAK.7.77.849.2005181327070.394978@nqv-guvaxcnq>

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:

```
\setupbackend[export=xml]
\setupexport [properties=my]

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

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

gives

```
<?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">
  <metadata>
  </metadata>
  <section detail="section" chain="section" implicit="1" level="3">
   <sectioncaption>
    <sectionnumber>1</sectionnumber>
    <sectiontitle>Sample document</sectiontitle>
   </sectioncaption>
   <sectioncontent>
    <paragraph>This is a paragraph</paragraph>
    <mycommand>This is mycommand</mycommand>
   </sectioncontent>
  </section>
</document>
```

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:

```
\unexpanded\def\dostartexport
   {%\glet\dostartexport\relax
    \let\currentexport\empty
    \clf_setupexport
        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}%
    \relax}

```

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

Aditya


___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-05-19  5:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18  7:09 Aditya Mahajan
2020-05-18  9:34 ` Hans Hagen
2020-05-18 13:50   ` Aditya Mahajan
2020-05-18 17:31     ` Aditya Mahajan
2020-05-19  5:45       ` Aditya Mahajan [this message]
2020-05-19  6:16         ` Aditya Mahajan

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=nycvar.YAK.7.77.849.2005190132190.414636@nqv-guvaxcnq \
    --to=adityam@umich.edu \
    --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).