ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: <denis.maier@ub.unibe.ch>
To: <ntg-context@ntg.nl>, <wolfgang.schuster.lists@gmail.com>
Subject: Re: arbitrary context commands in xml file
Date: Fri, 5 Mar 2021 21:27:55 +0000	[thread overview]
Message-ID: <d930c52ca8ab4a0d9482aea57ec85d3d@ub.unibe.ch> (raw)
In-Reply-To: <9c7c4e6468f0457b8dddcfc491971e9c@ub.unibe.ch>

Just to provide more information about what I was thinking:
You do your typesetting based on an XML doc. Now it is time for the finishing touches. In a tex document you'd add the usual commands to manipulate the layout:
\adaptlayout[lines=+1]
 \testpage[3]
\looseness=-1 / \looseness=+1
\blank 
\setuptolerance 
etc.

Now, of course you can define an injector for these commands, some are predefined, like page, column, blank.
But, if my understanding is correct, you'd have to define one for each of the possible parameters.

So, you'll need:

\startsetups xml:directive:injector:testpagethree
\testpage[3]
\stopsetups

\startsetups xml:directive:injector:testpagefour
\testpage[4]
\stopsetups

etc., and

\startsetups xml:directive:injector:addoneline
\adaptlayout[lines=+1]
\stopsetups

\startsetups xml:directive:injector:addtwolines
\adaptlayout[lines=+1]
\stopsetups

Here, I was thinking if something like this could be easier:

<?context-directive raw-tex-injector \testpage[4]?>

Wolfgang's solutions seems to provide that with different means. If I understand correctly, you'd just map an arbitrary XML element to this setup, and you can then do this:

<rawtex>
\testpage[4]
</rawtex>

Correct?

If yes, that would be a nice solution, but those elements  are probably not allowed if your document needs to be validated against a schema, yet processor instructions will be ignored during validation.

Any ideas for alternative approaches? What do you think about a raw-tex injector? (Another possibility would be to use Wolfgang's suggestion, and then to use an XSLT stylesheet to remove those illegal nodes for validation purposes...)

Best,
Denis

> -----Ursprüngliche Nachricht-----
> Von: ntg-context <ntg-context-bounces@ntg.nl> Im Auftrag von
> denis.maier@ub.unibe.ch
> Gesendet: Freitag, 5. März 2021 16:26
> An: wolfgang.schuster.lists@gmail.com; ntg-context@ntg.nl
> Betreff: Re: [NTG-context] arbitrary context commands in xml file
> 
> Thanks. But won't that break the xml? I'll need a new element for this right?
> But what if the schema doesn't allow this?
> 
> ________________________________________
> Von: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
> Gesendet: Freitag, 5. März 2021 16:01:25
> An: mailing list for ConTeXt users
> Cc: Maier, Denis Christian (UB)
> Betreff: Re: [NTG-context] arbitrary context commands in xml file
> 
> denis.maier@ub.unibe.ch schrieb am 05.03.2021 um 15:53:
> > I mean without breaking the xml of course. Something like an ad hoc
> injector...
> 
> \startxmlsetups ...
>      \xmlflushcontext{#1}
> \stopxmlsetups
> 
> Wolfgang
> 
> __________________________________________________________
> _________________________
> 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
> __________________________________________________________
> _________________________
___________________________________________________________________________________
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:[~2021-03-05 21:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 14:39 denis.maier
2021-03-05 14:53 ` denis.maier
2021-03-05 15:01   ` Wolfgang Schuster
2021-03-05 15:26     ` denis.maier
2021-03-05 21:27       ` denis.maier [this message]
2021-03-05 22:17         ` Hans Hagen
2021-03-08 10:20           ` denis.maier
2021-03-08 11:48             ` Duncan Hothersall
2021-03-08 12:46               ` Hans Hagen
2021-03-08 13:05                 ` Duncan Hothersall
2021-03-08 13:39                   ` denis.maier

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=d930c52ca8ab4a0d9482aea57ec85d3d@ub.unibe.ch \
    --to=denis.maier@ub.unibe.ch \
    --cc=ntg-context@ntg.nl \
    --cc=wolfgang.schuster.lists@gmail.com \
    /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).