Re: [NTG-context] content of xml node (element) in lua

2020-10-16 Thread mf

(sorry, I sent it before refining it)

Il 16/10/20 20:57, Jano Kula ha scritto:

Hello!

Processing XML I want to manipulate content of XML elements inside Lua.

I can define the Lua function xml.functions.name 
(t), where processing happens, and use the 
command \xmlfunction{#1}{name} to pass the current node #1from ctx to 
lua as described in the xml-mkiv.pdf manual. To access the element 
content xml.text(t,"/element") Lua function is used.


However, using the same function xml.text("#1",/element) directly inside 
Lua doesn't work for me. Node #1 is available, but not the content of 
/element.


In your lua fragment, node #1 is available as "xml:name::4" or 
"xml:name::6", but not as a lua table.


When node #1 is passed to a \xmlfunction, the function gets a lua table 
as argument.


To write direct lua code instead of a xmlfunction you'd need a function 
to transform those "xml:name::..." into the lua tables representing the 
xml elements in the xml tree.


Which is what \xmlfunction does, so I wouldn't expect any performance gain.

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
___


[NTG-context] content of xml node (element) in lua

2020-10-16 Thread Jano Kula
Hello!

Processing XML I want to manipulate content of XML elements inside Lua.

I can define the Lua function xml.functions.name(t), where processing
happens, and use the command \xmlfunction{#1}{name} to pass the current
node #1 from ctx to lua as described in the xml-mkiv.pdf manual. To access
the element content xml.text(t,"/element") Lua function is used.

However, using the same function xml.text("#1",/element) directly inside
Lua doesn't work for me. Node #1 is available, but not the content of
/element.

\startluacode
local node = "#1"
local content = xml.text("#1","/color")
context.par() context("node: ") context(node)
context.par() context("lua: ")  context(content)
\stopluacode

MWE (mkiv, beta) attached.

I haven't found an example, so is it even possible? If so, which way is
more efficient?

Thanks,
Jano


xmlluanode.tex
Description: Binary data
___
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] Changing the colors of Charts in luametafun

2020-10-16 Thread Jan U. Hasecke

Hi,

as I'll need to make some business charts in the near future I had a
look into metafun xl.

Here is the first example:

\startMPcode
draw lmt_chart_circle [
samples
= { { 1, 4, 3, 2, 5, 7, 6 } },
percentage = true,
trace
= true,
] ;
\stopMPcode

How can I change the colors used for the sample?

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
___


[NTG-context] Join Foundation to Support ConTeXt for the next 50 Years

2020-10-16 Thread Suminda Sirinath Salpitikorala Dharmasena
Hello,

In order to keep ConTeXt maintained for the very long term future, I am
wondering if there a possibility to join a foundation like the Apache
Software Foundation, Linux Foundation, etc.

Also perhaps more to a more liberal license so there can be commercial use
of ConTeXt with some of it trickling to as code contributions, wider usage
which may further translate to support and consultancy work for those
familiar with ConTeXt. If commercial system uses ConTeXt as part of their
system there is a chance that is it is in their best interest to maintain
it also long as these systems are in operation.

Also perhaps it might be best than just depend on TeX maybe fork TeX and
improve it in a ConTeXt dependent way. This way ConTeXt more feature-rich
and easier to maintain than carrying the technical burden of TeX. There are
system like SILE typesetter (https://sile-typesetter.org/) which are
developed from the ground up and also The Tectonic Typesetting System (
https://tectonic-typesetting.github.io/en-US/).

This is just some ideas which I thought might be worthwhile considering.

Suminda
___
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] Thanks everyone

2020-10-16 Thread Denis Maier

Hi,

I've just published the first issue of a journal where the PDFs are 
produced directly from JATS XML with ConTeXt. That wouldn't have been 
possible without the help form you all. Thank you!


Denis

P.S.: I'l see if I can add some of the things I've learned to the wiki...
___
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
___