ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: Custom XML Export
Date: Sat, 12 Sep 2015 14:00:31 +0200	[thread overview]
Message-ID: <55F413DF.5050508@wxs.nl> (raw)
In-Reply-To: <55F40E7A.8010902@gmail.com>

On 9/12/2015 1:37 PM, Toby Miller wrote:
> Thank you! That's exactly what I was looking for.
>
> I have a few other things I'd like to be able to do with this kind of
> thing (print '<br />' self-closed tags for example, and add attributes
> as you say), but I feel bad about posting to the list for them. Is there
> any documentation for these features at all? I couldn't find any
> reference to the \startelement command when I looked, but perhaps I'm
> looking in the wrong place.

\setupbackend[export=yes]
\setupexport[properties=yes]

\starttext
      \startelement[test][this=that]whatever\stopelement
\stoptext

arbitrary empty elements are tricky as there is no content then, so that 
needs thinking

(you can of course abuse \startelement

\startelement[br]x\stopelement

and then remove the x from the exported xml. I'll think about it (no 
time now).

Hans


> I'll take your advice and not try to adapt the export system. Now that I
> can print tags at least I think XML transformation should be able to
> deal with everything I need if it comes to it.
>
> Toby
>
> On 12/09/15 10:53, Hans Hagen wrote:
>> On 9/11/2015 4:21 PM, Toby Miller wrote:
>>> I'm using ConTeXt's export to XML feature, but I'd like more control
>>> over the XML output. Is there a way to define a TeX command that will
>>> output a specific tag (<tag>content</tag>) around some text in the
>>> output?
>>
>> \setupbackend[export=yes]
>>
>> \definehighlight[this]
>>
>> \starttext
>>      \startelement[what]
>>           \this{that}  \input ward
>>      \stopelement
>> \stoptext
>>
>> (there are also ways to add extra properties)
>>
>>> Ideally I'd like to write a completely custom XML printer; it would be
>>> very simple, but would allow me to define what tags I want for different
>>> things. Is there a way to change the behaviour of the existing one, or
>>> could you recommend a starting point for writing a new one?
>>
>> the export resembles the structure used in the source and making each
>> aspect configurable not only adds much overhead but is also kind of
>> useless as one can easily transform xml into other xml; it's no
>> problem to add a few more details here or there , but th emain indea
>> behind the export is to have standardized and predictable output that
>> then can be either rendered using css or converted (for that the raw
>> file is best).
>>
>> Hans
>>
>> -----------------------------------------------------------------
>>                                            Hans Hagen | PRAGMA ADE
>>                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>      tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>>                                               | www.pragma-pod.nl
>> -----------------------------------------------------------------
>> ___________________________________________________________________________________
>>
>> 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
>> ___________________________________________________________________________________
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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	other threads:[~2015-09-12 12:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 14:21 Toby Miller
2015-09-12  9:53 ` Hans Hagen
2015-09-12 11:37   ` Toby Miller
2015-09-12 12:00     ` Hans Hagen [this message]
2015-09-12 12:22       ` Toby Miller
2015-09-12 12:04     ` Henning Hraban Ramm
2015-09-12 12:14       ` Hans Hagen
2015-09-12 12:21         ` Toby Miller
2015-09-12 12:14       ` luigi scarso
2015-09-12 12:28         ` Henning Hraban Ramm
2015-09-14  9:12           ` luigi scarso
2015-09-14 18:09           ` Jan Tosovsky
     [not found]           ` <00cd01d0ef18$6f13da50$4d3b8ef0$@tosovsky@email.cz>
2015-09-15  4:11             ` Henning Hraban Ramm
2015-09-12 14:25         ` Hans Hagen
2015-09-12 20:53       ` Aditya Mahajan
2015-09-14  9:57         ` Henning Hraban Ramm

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=55F413DF.5050508@wxs.nl \
    --to=pragma@wxs.nl \
    --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).