Re: [NTG-context] \setupmathematics oddity

2022-11-20 Thread Wolfgang Schuster via ntg-context

Alan Bowen via ntg-context schrieb am 18.11.2022 um 23:48:

The following
\setupmathematics[autopunctuation={all,semicolon}]
%\setupmathematics[autopunctuation={all, semicolon}]
%\setupmathematics[autopunctuation={all,semicolon,colon}]

\starttext
\startformula
0,0;2,0,35,17,40,41\textdegree{} \cdot 365;15 \cdot 40 = 
2,9;23,14\textdegree{}.

\stopformula
\stoptext

works as it should (no space after the “;” or the “,”).

With the second and third versions of \setupmathematics there is an 
unwanted space after each punctuation mark.


Even though it seems like the autopunctuation key accepts a list of 
values this isn't the case
at the moment. Only values from the following list are valid arguments 
for the key:


- yes
- no
- all
- comma
- yes,semicolon
- comma,semicolon
- all,semicolon

The reason for this is that values like "all,semicolon" are treated as 
keyword and the comma
is part of the keyword, this means you can't change the order of the 
words and even spaces

after the comma make the argument invalid.

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Xml filtering in Lua

2022-11-20 Thread Thomas A. Schmitz via ntg-context

On 11/17/22 11:04, Hans Hagen via ntg-context wrote:


so, basically you collect data and use it later ... for huge datasets 
that saves some time


if you have only chapters to process you can even decide to flush in 
that function


Alright, I'm making very good progress here, but right now I'm stumbling 
upon a problem I can't solve. It's difficult to make a minimal example, 
so bear with some snippets.


I load data from an external xml file (not the one I'm processing) and 
store some of it in a lua table.


local examples = lxml.load ("my_examples", "examples.xml")
local sets = lxml.load ("my_sets", "example_sets.xml")

for e in xml.collected (examples, "/examples/chapter/example") do
local ex_id = e.at.id
all_examples [ex_id] = e
end

This works as expected, with print (inspect (all_examples)), I can see 
that the table looks the way I expect.


I then retrieve some entries of the table by their key:

local current_example = all_examples [key]

Again, this appears to work; when I have a

lxml.displayverbatim (current_example)

in my file, the xml is typeset and looks like I would expect it to look. 
However, whatever I try, I get the serialized xml typeset, with all 
 verbatim, instead of processed. Here's what I've tried:


\startxmlsetups xml:chapter:example
\xmlfirst {#1} {.} \par
\stopxmlsetups

lxml.command (current_example, ".", "xml:chapter:example")

or

xml.sprint (lxml.id (current_example))

or

local problem = xml.text (lxml.id (current_example), "./[text()]")
xml.sprint (problem)

I was expecting at least the last version to retrieve the pure text, but 
it typesets again with the tags included.


So I guess my question is: how can I tell ConTeXt to parse my xml as xml 
and apply the proper setups instead of serializing it?


All best wishes

Thomas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___