Re: [NTG-context] arbitrary context commands in xml file

2021-03-08 Thread denis.maier
Indeed. That's very useful. Thanks!

Von: ntg-context  Im Auftrag von Duncan Hothersall
Gesendet: Montag, 8. März 2021 14:06
An: Hans Hagen 
Cc: mailing list for ConTeXt users 
Betreff: Re: [NTG-context] arbitrary context commands in xml file



On Mon, 8 Mar 2021 at 12:46, Hans Hagen 
mailto:j.ha...@xs4all.nl>> wrote:
> I'd like to second Denis' request for support for XML processing
> instructions to execute ConTeXt code, rather than elements which can
> cause big problems if one is working to a fixed schema. It would be a
> boon to be able to drop in  in an XML source.
one of the things that can already be done ...

\def\xmltexdirective#1#2{\doif{#1}{command}{#2}}

\xmlinstalldirective{tex}{xmltexdirective}

 
 

(the #2 is something without spaces btu one can work around that)

Aha. Useful, thanks!
___
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
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-08 Thread Duncan Hothersall
On Mon, 8 Mar 2021 at 12:46, Hans Hagen  wrote:

> > I'd like to second Denis' request for support for XML processing
> > instructions to execute ConTeXt code, rather than elements which can
> > cause big problems if one is working to a fixed schema. It would be a
> > boon to be able to drop in  in an XML source.
> one of the things that can already be done ...
>
> \def\xmltexdirective#1#2{\doif{#1}{command}{#2}}
>
> \xmlinstalldirective{tex}{xmltexdirective}
>
>  
>  
>
> (the #2 is something without spaces btu one can work around that)
>

Aha. Useful, thanks!
___
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
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-08 Thread Hans Hagen

On 3/8/2021 12:48 PM, Duncan Hothersall wrote:



On Mon, 8 Mar 2021 at 10:21, <mailto:denis.ma...@ub.unibe.ch>> wrote:


 > -Ursprüngliche Nachricht-
 > Von: Hans Hagen mailto:j.ha...@xs4all.nl>>
 > Gesendet: Freitag, 5. März 2021 23:17
 > An: mailing list for ConTeXt users mailto:ntg-context@ntg.nl>>; Maier, Denis
 > Christian (UB) mailto:denis.ma...@ub.unibe.ch>>;
 > wolfgang.schuster.li...@gmail.com
<mailto:wolfgang.schuster.li...@gmail.com>
 > Betreff: Re: [NTG-context] arbitrary context commands in xml file


[...]

 > >
 > > Here, I was thinking if something like this could be easier:
 > >
 > > 
 > you can also do this:
 >
 > 
 >
 > \startxmlsetups xml:testpage
 >    \testpage[\xmlatt{#1}{n}]
 > \stopxmlsetup
 >
 > and register that one (as in previous examples)

Thanks,. That's a good idea, but it will also make the XML invalid.

Denis

I'd like to second Denis' request for support for XML processing 
instructions to execute ConTeXt code, rather than elements which can 
cause big problems if one is working to a fixed schema. It would be a 
boon to be able to drop in  in an XML source.

one of the things that can already be done ...

\def\xmltexdirective#1#2{\doif{#1}{command}{#2}}

\xmlinstalldirective{tex}{xmltexdirective}




(the #2 is something without spaces btu one can work around that)


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-08 Thread Duncan Hothersall
On Mon, 8 Mar 2021 at 10:21,  wrote:

> > -Ursprüngliche Nachricht-
> > Von: Hans Hagen 
> > Gesendet: Freitag, 5. März 2021 23:17
> > An: mailing list for ConTeXt users ; Maier, Denis
> > Christian (UB) ;
> > wolfgang.schuster.li...@gmail.com
> > Betreff: Re: [NTG-context] arbitrary context commands in xml file
>
>
> [...]
>
> > >
> > > Here, I was thinking if something like this could be easier:
> > >
> > > 
> > you can also do this:
> >
> > 
> >
> > \startxmlsetups xml:testpage
> >\testpage[\xmlatt{#1}{n}]
> > \stopxmlsetup
> >
> > and register that one (as in previous examples)
>
> Thanks,. That's a good idea, but it will also make the XML invalid.
>
> Denis
>

I'd like to second Denis' request for support for XML processing
instructions to execute ConTeXt code, rather than elements which can cause
big problems if one is working to a fixed schema. It would be a boon to be
able to drop in  in an XML source.

Duncan
___
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
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-08 Thread denis.maier
> -Ursprüngliche Nachricht-
> Von: Hans Hagen 
> Gesendet: Freitag, 5. März 2021 23:17
> An: mailing list for ConTeXt users ; Maier, Denis
> Christian (UB) ;
> wolfgang.schuster.li...@gmail.com
> Betreff: Re: [NTG-context] arbitrary context commands in xml file


[...]

> >
> > Here, I was thinking if something like this could be easier:
> >
> > 
> you can also do this:
> 
> 
> 
> \startxmlsetups xml:testpage
>\testpage[\xmlatt{#1}{n}]
> \stopxmlsetup
> 
> and register that one (as in previous examples)

Thanks,. That's a good idea, but it will also make the XML invalid.

Denis
___
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
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-05 Thread Hans Hagen

On 3/5/2021 10:27 PM, denis.ma...@ub.unibe.ch wrote:

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:



you can also do this:



\startxmlsetups xml:testpage
  \testpage[\xmlatt{#1}{n}]
\stopxmlsetup

and register that one (as in previous examples)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-05 Thread denis.maier
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:



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:


\testpage[4]


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  Im Auftrag von
> denis.ma...@ub.unibe.ch
> Gesendet: Freitag, 5. März 2021 16:26
> An: wolfgang.schuster.li...@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 
> 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.ma...@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
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-05 Thread denis.maier
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 
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.ma...@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
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-05 Thread Wolfgang Schuster

denis.ma...@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
___


Re: [NTG-context] arbitrary context commands in xml file

2021-03-05 Thread denis.maier
I mean without breaking the xml of course. Something like an ad hoc injector...




Von: ntg-context  im Auftrag von 
denis.ma...@ub.unibe.ch 
Gesendet: Freitag, 5. März 2021 15:39:53
An: ntg-context@ntg.nl
Betreff: [NTG-context] arbitrary context commands in xml file

Hi
Is there a way to add arbitrary context commands to an xml file without 
defining an injector first?
Best
Denis
___
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
___


[NTG-context] arbitrary context commands in xml file

2021-03-05 Thread denis.maier
Hi
Is there a way to add arbitrary context commands to an xml file without 
defining an injector first?
Best
Denis
___
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
___