Re: [NTG-context] Access current element in xmlsetsetup via xml.expressions

2019-10-02 Thread achim
Dear Hans,
that is really great. Thank's a lot.  Ill check the next beta and try to 
wikifiy (maybe I need further help for that)

Achim

-Ursprüngliche Nachricht-
Von: ntg-context  Im Auftrag von Hans Hagen
Gesendet: Mittwoch, 2. Oktober 2019 18:53
An: mailing list for ConTeXt users ; mf 

Betreff: Re: [NTG-context] Access current element in xmlsetsetup via 
xml.expressions

On 10/2/2019 12:32 PM, mf wrote:
> The answer is in lxml-lpt.lua, where built-in expressions are defined.
> You need a good knowledge of LPEG that i miss.
> 
> Some built-in expressions get the current element as first argument, 
> like count() or child() (lines 1300-1307 of lxml-lpt.lua):
> 
> expressions.child = function(e,pattern)
>  return applylpath(e,pattern) -- todo: cache end
> 
> expressions.count = function(e,pattern) -- what if pattern == empty or 
> nil
>  local collected = applylpath(e,pattern) -- todo: cache
>  return pattern and (collected and #collected) or 0 end
> 
> Some other expressions use a template that passes the "list", "ll", "l" 
> and "order" arguments you find cited in the XML manual §4.1 "Path 
> expressions - Expressions and filters".
> These are the lines 738-743 in lxml-lpt.lua:
> 
> local template_e = [[
>  local expr = xml.expressions
>  return function(list,ll,l,order)
>  return %s
>  end
> ]]
> 
> That template is used by the function that registers a new expression 
> (lines 807-812 in lxml-lpt.lua):
> 
> local function register_expression(expression)
>  local converted = lpegmatch(converter,expression)
>  local runner = load(format(template_e,converted))
>  runner = (runner and runner()) or function()
> errorrunner_e(expression,converted) end
>  return { kind = "expression", expression = expression, converted 
> = converted, evaluator = runner } end
> 
> Anyway i could not find a way to define an expression with a function 
> like this:
> 
> xml.expressions.myexpr( ... )
> 
> that gets access to those arguments.
> 
> The only arguments it gets are the ones you specify in your LPATH 
> expressions; AFAIK they are attributes values -- with the @attr syntax
> -- and strings.
Live is complex isn't it? The problem, is that we also support the normal path 
expressions which in retrospect maybe was a bad idea ... 
better be explicit. Strings without quotes are actually intercepted as element 
references (just like the @ is).

So, I added a few extra accessors:

\startbuffer[text]

 A sup 1
 B sub 1
 C sup 2
 D sub 2
 E sup 3
 F sup 4
 G sup 5
 H sub 5
 I sup 6  \stopbuffer

\startluacode
 function xml.expressions.MyCheck(list,position,what)
  -- print("list",list)
  -- print("position",position)
  -- print("what",what)
 local n = list[position+1]
 return n and n.at.style == what
 end
\stopluacode

\enabletrackers[lxml.*]

\startxmlsetups xml:textsetups

 \xmlsetsetup{#1}{para|inline}{xml:*}

 % with a helper:

% \xmlsetsetup{#1}{inline[@style='sup' and 
MyCheck(list(),position(),"sub")]}{xml:supsub}
% \xmlsetsetup{#1}{inline[@style='sup' and 
MyCheck(list(),position(),"sup")]}{xml:supsup}

 % rather verbose, we *need* to use ['at'] and not .at

% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
list()[position()+1]['at']['style']=='sub')]}{xml:supsub}
% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
list()[position()+1]['at']['style']=='sup')]}{xml:supsup}

 % also ok

% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
attribute(list()[position()+1],'style')=='sub')]}{xml:supsub}
% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
attribute(list()[position()+1],'style')=='sup')]}{xml:supsup}

 % direct checking

% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
attribute(list()[position()+1],'style','sub'))]}{xml:supsub}
% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
attribute(list()[position()+1],'style','sup'))]}{xml:supsup}

 % shorter

 \xmlsetsetup{#1}{inline[@style='sup' and 
(attribute(list()[position()+1],'style','sub'))]}{xml:supsub}
 \xmlsetsetup{#1}{inline[@style='sup' and 
(attribute(list()[position()+1],'style','sup'))]}{xml:supsup}
\stopxmlsetups

\xmlregistersetup{xml:textsetups}

\startxmlsetups xml:para
 \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:supsub
 \color[red]{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:supsup
 \color[blue]{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:inline
 \color[green]{\xmlflush{#1}}
\stopxmlsetups

\starttext
 \xmlprocessbuffer{main}{text}{}
\stoptext

In the next beta. Now, who is going to wikify this ...

Hans

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The 

Re: [NTG-context] Access current element in xmlsetsetup via xml.expressions

2019-10-02 Thread Hans Hagen

On 10/2/2019 12:32 PM, mf wrote:

The answer is in lxml-lpt.lua, where built-in expressions are defined.
You need a good knowledge of LPEG that i miss.

Some built-in expressions get the current element as first argument, 
like count() or child() (lines 1300-1307 of lxml-lpt.lua):


expressions.child = function(e,pattern)
     return applylpath(e,pattern) -- todo: cache
end

expressions.count = function(e,pattern) -- what if pattern == empty or nil
     local collected = applylpath(e,pattern) -- todo: cache
     return pattern and (collected and #collected) or 0
end

Some other expressions use a template that passes the "list", "ll", "l" 
and "order" arguments you find cited in the XML manual §4.1 "Path 
expressions - Expressions and filters".

These are the lines 738-743 in lxml-lpt.lua:

local template_e = [[
     local expr = xml.expressions
     return function(list,ll,l,order)
     return %s
     end
]]

That template is used by the function that registers a new expression 
(lines 807-812 in lxml-lpt.lua):


local function register_expression(expression)
     local converted = lpegmatch(converter,expression)
     local runner = load(format(template_e,converted))
     runner = (runner and runner()) or function() 
errorrunner_e(expression,converted) end
     return { kind = "expression", expression = expression, converted = 
converted, evaluator = runner }

end

Anyway i could not find a way to define an expression with a function 
like this:


xml.expressions.myexpr( ... )

that gets access to those arguments.

The only arguments it gets are the ones you specify in your LPATH 
expressions; AFAIK they are attributes values -- with the @attr syntax 
-- and strings.
Live is complex isn't it? The problem, is that we also support the 
normal path expressions which in retrospect maybe was a bad idea ... 
better be explicit. Strings without quotes are actually intercepted as 
element references (just like the @ is).


So, I added a few extra accessors:

\startbuffer[text]

A sup 1
B sub 1
C sup 2
D sub 2
E sup 3
F sup 4
G sup 5
H sub 5
I sup 6

\stopbuffer

\startluacode
function xml.expressions.MyCheck(list,position,what)
 -- print("list",list)
 -- print("position",position)
 -- print("what",what)
local n = list[position+1]
return n and n.at.style == what
end
\stopluacode

\enabletrackers[lxml.*]

\startxmlsetups xml:textsetups

\xmlsetsetup{#1}{para|inline}{xml:*}

% with a helper:

% \xmlsetsetup{#1}{inline[@style='sup' and 
MyCheck(list(),position(),"sub")]}{xml:supsub}
% \xmlsetsetup{#1}{inline[@style='sup' and 
MyCheck(list(),position(),"sup")]}{xml:supsup}


% rather verbose, we *need* to use ['at'] and not .at

% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
list()[position()+1]['at']['style']=='sub')]}{xml:supsub}
% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
list()[position()+1]['at']['style']=='sup')]}{xml:supsup}


% also ok

% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
attribute(list()[position()+1],'style')=='sub')]}{xml:supsub}
% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
attribute(list()[position()+1],'style')=='sup')]}{xml:supsup}


% direct checking

% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
attribute(list()[position()+1],'style','sub'))]}{xml:supsub}
% \xmlsetsetup{#1}{inline[@style='sup' and (position() < last() and 
attribute(list()[position()+1],'style','sup'))]}{xml:supsup}


% shorter

\xmlsetsetup{#1}{inline[@style='sup' and 
(attribute(list()[position()+1],'style','sub'))]}{xml:supsub}
\xmlsetsetup{#1}{inline[@style='sup' and 
(attribute(list()[position()+1],'style','sup'))]}{xml:supsup}

\stopxmlsetups

\xmlregistersetup{xml:textsetups}

\startxmlsetups xml:para
\xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:supsub
\color[red]{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:supsup
\color[blue]{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:inline
\color[green]{\xmlflush{#1}}
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{text}{}
\stoptext

In the next beta. Now, who is going to wikify this ...

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  : 

Re: [NTG-context] beta

2019-10-02 Thread Hans Hagen

On 10/2/2019 4:06 PM, Hans van der Meer wrote:

You can add to the end of the install script:

echo "Removing luatex-cache/context"
rm -r tex/texmf-cache/luatex-cache/context

i updatex mtx-cache

mtxrun --script cache --list
mtxrun --script cache --erase
mtxrun --script cache --erase --make

etc

-
  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] beta

2019-10-02 Thread Hans Hagen

On 10/2/2019 4:35 PM, Jan U. Hasecke wrote:

Am 02.10.19 um 16:06 schrieb Hans van der Meer:

You can add to the end of the install script:

echo "Removing luatex-cache/context"
rm -r tex/texmf-cache/luatex-cache/context



I reinstalled 64 bit Linux from http://www.pragma-ade.nl/install.htm and
now it works again. Thanks a lot for supporting debian stable again.

One thing, with:

mtxrun --autogenerate --script context

as suggested by the install script I get

unknown script 'context.lua' or 'mtx-context.lua'

The command "/home/juh/context-linux-64/tex/texmf-linux-64/bin/context"
works.


you need to have /home/juh/context-linux-64/tex/texmf-linux-64/bin in 
your path or use fully qualified paths


'mtxrun' and 'context' are aliases of 'luametatex'

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] beta

2019-10-02 Thread Jan U. Hasecke
Am 02.10.19 um 16:06 schrieb Hans van der Meer:
> You can add to the end of the install script:
> 
> echo "Removing luatex-cache/context"
> rm -r tex/texmf-cache/luatex-cache/context
> 

I reinstalled 64 bit Linux from http://www.pragma-ade.nl/install.htm and
now it works again. Thanks a lot for supporting debian stable again.

One thing, with:

mtxrun --autogenerate --script context

as suggested by the install script I get

unknown script 'context.lua' or 'mtx-context.lua'

The command "/home/juh/context-linux-64/tex/texmf-linux-64/bin/context"
works.

Any hints?
TIA
juh
___
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] beta

2019-10-02 Thread Hans van der Meer
You can add to the end of the install script:

echo "Removing luatex-cache/context"
rm -r tex/texmf-cache/luatex-cache/context

dr. Hans van der Meer


> On 2 Oct 2019, at 15:32, Alan Bowen  wrote:
> 
> Hi, Hans—
> 
> The latest lmtx now processes my docs as it should when texmf-cache was 
> deleted before installation. So, where is this zip that has the revised 
> install.sh script?
> 
> Alan
> 
> On Wed, Oct 2, 2019 at 7:06 AM Hans Hagen  > wrote:
> On 9/30/2019 2:11 PM, Thomas A. Schmitz wrote:
> > On 29.09.19 16:31, Hans Hagen wrote:
> >> Hi,
> >>
> >> A week ago we had the (nice and pleasant) annual context meeting and 
> >> as usual some new stuff has been presented there which was not yet in 
> >> the distribution at that moment. Some pending code is now being moved 
> >> into the distribution. Part is font related (lmtx only, not relevant 
> >> for most users), most is metafun (luametafun or metafun xl or whatever 
> >> name suits) related (including a new preliminary manual) which uses 
> >> some new interfaces and therefore (currently) is lmtx only.
> > 
> > Hi Hans,
> > 
> > I just updated. I had to delete the cache for context to work again, got 
> > weird errors compiling a file that works normally. So my question: since 
> > creating a new cache and format takes only a few seconds, wouldn't it 
> > make sense to include it in install.sh ?
> I've added that feature but one needs the new install.sh script then 
> (from the zip).
> 
> (We also added openbsd installers.)
> 
> 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 
> ___
> ___
> 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] beta

2019-10-02 Thread Alan Bowen
Hi, Hans—

The latest lmtx now processes my docs as it should when texmf-cache was
deleted before installation. So, where is this zip that has the revised
install.sh script?

Alan

On Wed, Oct 2, 2019 at 7:06 AM Hans Hagen  wrote:

> On 9/30/2019 2:11 PM, Thomas A. Schmitz wrote:
> > On 29.09.19 16:31, Hans Hagen wrote:
> >> Hi,
> >>
> >> A week ago we had the (nice and pleasant) annual context meeting and
> >> as usual some new stuff has been presented there which was not yet in
> >> the distribution at that moment. Some pending code is now being moved
> >> into the distribution. Part is font related (lmtx only, not relevant
> >> for most users), most is metafun (luametafun or metafun xl or whatever
> >> name suits) related (including a new preliminary manual) which uses
> >> some new interfaces and therefore (currently) is lmtx only.
> >
> > Hi Hans,
> >
> > I just updated. I had to delete the cache for context to work again, got
> > weird errors compiling a file that works normally. So my question: since
> > creating a new cache and format takes only a few seconds, wouldn't it
> > make sense to include it in install.sh ?
> I've added that feature but one needs the new install.sh script then
> (from the zip).
>
> (We also added openbsd installers.)
>
> 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
>
> ___
>
___
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] \startitemize + "joinedup" ("nowhite") not working in footnotes?

2019-10-02 Thread context

Hello,

in the following sample there is unwanted vertical gap between text 
"Foo" and the first item "- bar" in the footnote 1 (and also between 
"Bar" and "- bar") - see red arrows.


The same code used outside the footnote behaves as expected - there is 
no vertical space.


Is there anything special about handling itemization inside footnotes?

My code:


\def\T{%
  \startitemize[joinedup,nowhite]
\item bar
\item baz
  \stopitemize
}

\def\U{%
  Foo
   \T
  Bar
   \T
}

\starttext
  \U

  \startitemize
\item Item\footnote{\U}
  \stopitemize
\stoptext


Best regards,

Lukas\def\T{%
  \startitemize[joinedup,nowhite]
\item bar
\item baz
  \stopitemize
}

\def\U{%
  Foo
   \T
  Bar
   \T
}

\starttext
  \U

  \startitemize
\item Item\footnote{\U}
  \stopitemize
\stoptext


t~.pdf
Description: Adobe PDF document
___
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] beta

2019-10-02 Thread Hans Hagen

On 9/30/2019 2:11 PM, Thomas A. Schmitz wrote:

On 29.09.19 16:31, Hans Hagen wrote:

Hi,

A week ago we had the (nice and pleasant) annual context meeting and 
as usual some new stuff has been presented there which was not yet in 
the distribution at that moment. Some pending code is now being moved 
into the distribution. Part is font related (lmtx only, not relevant 
for most users), most is metafun (luametafun or metafun xl or whatever 
name suits) related (including a new preliminary manual) which uses 
some new interfaces and therefore (currently) is lmtx only.


Hi Hans,

I just updated. I had to delete the cache for context to work again, got 
weird errors compiling a file that works normally. So my question: since 
creating a new cache and format takes only a few seconds, wouldn't it 
make sense to include it in install.sh ?
I've added that feature but one needs the new install.sh script then 
(from the zip).


(We also added openbsd installers.)

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] Access current element in xmlsetsetup via xml.expressions

2019-10-02 Thread mf

The answer is in lxml-lpt.lua, where built-in expressions are defined.
You need a good knowledge of LPEG that i miss.

Some built-in expressions get the current element as first argument, 
like count() or child() (lines 1300-1307 of lxml-lpt.lua):


expressions.child = function(e,pattern)
return applylpath(e,pattern) -- todo: cache
end

expressions.count = function(e,pattern) -- what if pattern == empty or nil
local collected = applylpath(e,pattern) -- todo: cache
return pattern and (collected and #collected) or 0
end

Some other expressions use a template that passes the "list", "ll", "l" 
and "order" arguments you find cited in the XML manual §4.1 "Path 
expressions - Expressions and filters".

These are the lines 738-743 in lxml-lpt.lua:

local template_e = [[
local expr = xml.expressions
return function(list,ll,l,order)
return %s
end
]]

That template is used by the function that registers a new expression 
(lines 807-812 in lxml-lpt.lua):


local function register_expression(expression)
local converted = lpegmatch(converter,expression)
local runner = load(format(template_e,converted))
runner = (runner and runner()) or function() 
errorrunner_e(expression,converted) end
return { kind = "expression", expression = expression, converted = 
converted, evaluator = runner }

end

Anyway i could not find a way to define an expression with a function 
like this:


xml.expressions.myexpr( ... )

that gets access to those arguments.

The only arguments it gets are the ones you specify in your LPATH 
expressions; AFAIK they are attributes values -- with the @attr syntax 
-- and strings.


Best wishes,
Massi
___
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] Access current element in xmlsetsetup via xml.expressions

2019-10-02 Thread Taco Hoekwater


> On 1 Oct 2019, at 21:24, ac...@jander.de wrote:
> 
> Hello,
> I’m trying to build an xmlsetsetup with an own lua function. XML in MKIV says 
> on pg. 33:
> You can also use normal Lua functions as long as you make sure that you pass 
> the right arguments.
> There are a few predefined variables available inside such functions.
> list table the list of matches
> l number the current index in the list of matches
> ll element the current element that matched
> order number the position of the root of the path
>  
> But I can’t figure out how to get access to list, ll etc.

Neither can I :(

Taco

> My MWE (only for testing the access, is always true):
>  
> \startbuffer[text]
> Dies ist ein xxx style="sub">zwei noch ein sup 
> Testsub
> \stopbuffer
> %\enabletrackers[xml.parse,xml.path]
>  
> \startluacode
>   function xml.expressions.nextnodeatt(e)
> inspect(e)
> inspect(ll)
> return('sub')
>   end
> \stopluacode
>  
> \startxmlsetups xml:textsetups
> \xmlsetsetup{#1}{*}{+}
> \xmlsetsetup{#1}{para}{xml:*}
> 
> \xmlsetsetup{#1}{inline[@style='sup'][xml.expressions.nextnodeatt(ll)=='sub']}{xml:sub}
> \stopxmlsetups
>  
> \xmlregistersetup{xml:textsetups}
>  
> \startxmlsetups xml:para
> \xmlflush{#1}\par
> \stopxmlsetups
>  
> \startxmlsetups xml:sub
> \color[red]{\xmlflush{#1}}
> \stopxmlsetups
>  
>  
> \starttext
> \xmlprocessbuffer{main}{text}{}
> \stoptext
>  
> Thanks in advance,
> Achim
> ___
> 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
> ___

Taco Hoekwater
Elvenkind BV




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