ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: xml in mkiv
Date: Tue, 03 Jun 2008 20:13:54 +0200	[thread overview]
Message-ID: <484589E2.4080602@wxs.nl> (raw)

Hi,

[if you never use xml or don't use mkiv, you can skip this message]

Currently in mkiv, the mkii method of xml is active at the same time; 
however, this is not always what you want and eventually i suppose that 
mkiv xml usage will replace mkii usage (i'm thinking of at some point 
making the old stream based xml method a module for mkiv)

anyhow, one of aspects we need to deal with is mixed usage of documents, 
more about that later

the latest beta has a \setupxml command with the following options 
(there are a few more):

\setupxml[\c!method=mkii]                    % mixed mkiv and mkii
\setupxml[\c!method=mkiv,\c!default=]        % mkiv only
\setupxml[\c!method=mkiv,\c!default=\v!none] % mkiv only, undefined -> 
hidden
\setupxml[\c!method=mkiv,\c!default=\v!text] % mkiv only, undefined -> text

the tricky part is in dealing with entities. By default entities are 
resolved to utd code, which means that &lt;, &gt; and &amp; are part if 
the normal text stream. This is tricky because in mkii a dangling < or & 
gives an error.

However, in mkii mode (i.e. mixed mode), these three characters are 
remapped to some place safe (the location in the unicode table will 
change once we have active chars in the private planes).

i used this test:

% \defineXMLenvironment[y]{(}{)}
%
% \startxmlsetups x
%     /\xmlflush{#1}/
% \stopxmlsetups
%
% \startxmlsetups xx
%     \xmlsetsetup{main}{x}{*}
% \stopxmlsetups
%
% \xmlregistersetup{xx}
%
% \startbuffer
% <x>a &lt;&amp;&gt;<y>{b}</y> c</x>
% \stopbuffer

Another change is that 'context --env=bla whatever.xml' will use mkiv 
xml mode unless the --mkii flag is passed. The alternative is rather 
ugly and tricky overloading of the traditional XML macros, an option 
that i rejected.

An example that demonstrates mkiv usage is:

   context --ctx=x-ldx l-dimen.lua

this will produce the documentation of l-dimen.lua and does a 
transformation as defined in the ctx file. Eventually all those texexec 
goodies (--pdfwhatever) will become such scripts combined with styles.

Much is experimental and I will add more control over specific 
documents. Take for instance (from x-ldx.tex):

\usemodule[mathml]

\xmlregisterdocumentsetup{ldx}{xml:mml:define}
\xmlregisterdocumentsetup{ldx}{xml:ldx:define}

\xmlregisterns{ldx}{ldx}

\startxmlsetups xml:ldx:define
     \xmlgrab {\xmldocument} {ldx:*} {*}
\stopxmlsetups

This associates the ldx definitions to the document but also mathml.

I'm converting all traditional xml handling used in the core into mkiv 
handling (e.g. clt handling is already converted; clt deals with 
remapping filesnames into the ones that come out of preprocessing, as 
for instance in the ldx module).

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


                 reply	other threads:[~2008-06-03 18:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=484589E2.4080602@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).