[NTG-context] XML processing, unwanted indentation/alignment

2024-02-15 Thread Michael Guravage
Greetings,

I'm typesetting an address book whose addresses are in XML. A typical entry
has this structure:

  


  
  
  

  

initials and birthday are required, first_name can be left blank and email,
mobile and maiden_name are optional.

I've written a macro (name) to compose the name, i.e. initials, first_name
(maiden_name), and another macro (nameemaillink) to make the name a link
associated with an email address.

% Derive an individual's name
\def\name#1%
  {\ifxmlattempty{#1}{first_name} {\xmlatt{#1}{initials}} \else
{\xmlatt{#1}{initials}, \xmlatt{#1}{first_name}} \fi
   \ifxmlattempty{#1}{maiden_name} {} \else {
\tfxx(\xmlatt{#1}{maiden_name})} \fi}

% Create a mailto:link that associates a individual's name with their email
address.
\def\nameemaillink#1%
  {\ifxmlattempty{#1}{email} {\name{#1}} \else {\goto{\name{#1}}
[url(mailto:\xmlatt{#1}{email})]} \fi}

I thought I was done when I noticed that a composed name with an empty
first name, with or without an email address, is slightly indented. In the
mwe Moe and Curly, without first names, are indented; while Shemp and
Michael aren't.

That the undesired indentation/alignment is dependent on the presence of a
first name is baffling.  After this long description, if someone would look
at the code and tell me where I've gone wrong I would be very grateful. The
interesting bits begin on lines 8 and 12 in xml.tex.

-- 
With kind regards,

Michael
% XML processing instructions

% Turn a phone number into a tel:link - without spaces
\def\phonelink#1%
  {\goto{#1} [url(tel:\cldcontext{string.nospaces("#1")})]}

% Derive an individual's name
\def\name#1%
  {\ifxmlattempty{#1}{first_name} {\xmlatt{#1}{initials}} \else {\xmlatt{#1}{initials}, \xmlatt{#1}{first_name}} \fi
   \ifxmlattempty{#1}{maiden_name} {} \else { \tfxx(\xmlatt{#1}{maiden_name})} \fi}

% Create a mailto:link that associates a individual's name with their email address.
\def\nameemaillink#1%
  {\ifxmlattempty{#1}{email} {\name{#1}} \else {\goto{\name{#1}} [url(mailto:\xmlatt{#1}{email})]} \fi}

% Make an individual's mobile phone number a tel:link.
\def\mobilelink#1%
  {\ifxmlattempty{#1}{mobile} {} \else {\phonelink{\xmlatt{#1}{mobile}}} \fi}

% Track these several elements.
\startxmlsetups xml:list:base
  \xmlsetsetup{#1}{addressBook|family|address|members|member}{xml:list:*}
\stopxmlsetups

\xmlregisterdocumentsetup{list}{xml:list:base}

% When we encounter the root  element merely flush the rest.
\startxmlsetups xml:list:addressBook
  \xmlflush{#1}
\stopxmlsetups

% Place each family in a frametext box
\startxmlsetups xml:list:family
  \startframedtext[width=\textwidth]
{\tfb \bf \xmlatt{#1}{surname}\ifxmlattempty{#1}{prefix}{}\else{, \xmlatt{#1}{prefix}}\fi}\blank
\xmlflush{#1}
  \stopframedtext
  \blank[big]
\stopxmlsetups

% Enumerate the address information
\startxmlsetups xml:list:address
  \xmlatt{#1}{street} \xmlatt{#1}{housenumber}\crlf
  \xmlatt{#1}{postcode} \xmlatt{#1}{city}\crlf
  \ifxmlattempty{#1}{telephone}{\vskip -1em}\else{\phonelink{\xmlatt{#1}{telephone}}}\fi
  %\vskip -1em
  \xmlflush{#1}
  \blank[big]
\stopxmlsetups

% The only purpose of the  element is to make a table of members.
\startxmlsetups xml:list:members
  \starttabulate[|l|l|l|]
\xmlflush{#1}
  \stoptabulate
\stopxmlsetups

% Each  gets his own table row.
\startxmlsetups xml:list:member
  \NC \nameemaillink{#1} \NC \xmlatt{#1}{birthday} \NC \mobilelink{#1} \NC\NR
\stopxmlsetups

% finis
\environment xml.tex % XML processing instructions

\setupframedtext[frame=off, width=\textwidth, align={flushleft,broad,nothyphenated}]
\setupinteraction[state=start, color=darkblue]

\starttext
  \xmlprocessfile{list}{mwe.xml}{}
\stoptext

% finis



   


  	
  		
  	
  

  





mwe.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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] XML: flush to lua function

2023-09-11 Thread denis.maier
Hi,
I have the following xml setup with a lua function:

\startluacode
function markingLength(s)
_,n = s:gsub("%S+","")
if n > 3 then
context("yes" .. " ...") else context("no") end
end
\stopluacode

\startxmlsetups xml:ink:ink-title:marking
%\ctxlua{markingLength(\xmlflush{#1})}  % does not work
\ctxlua{markingLength{"1 2 3 4"}}
\stopxmlsetups

While the function works, I cannot use xmlflush here. How can I properly pass 
the xml content to the lua function?

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

[NTG-context] XML, multiple spaces encoded as %20 get merged into one space

2023-09-06 Thread denis.maier
Hi,

I have the example below that uses the three images in the attachment.
For some reason multiple spaces encoded as %20 get merged into a single %20.

The first image () does not get included even though the 
name is correct.
The second image () gets included. Filename is correct.
The third image () gets included even though the actual 
file name does not contain two spaces (but @xlink:href does).

Any ideas what is going on here?

Then, in the case of the link, the two %20 end up as a single %20.

Best,
Denis

\setupinteraction[state=start]

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|fig}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

\startxmlsetups xml:document
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:fig
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:graphic
  \externalfigure[\xmlfilter{#1}{./url('xlink:href')}]
\stopxmlsetups

\startxmlsetups xml:link
  https://uv-v4.netlify.app/\#?manifest=\xmlfilter{#1}{./url('xlink:href')}
\stopxmlsetups

\startxmlsetups xml:fig
\startplacefigure[title=Test]
\startalignment[center]
   \goto
   {\xmlfilter{#1}{/graphic/command(xml:graphic)}}
   [url(\xmlfilter{#1}{/link/command(xml:link)})]
\stopalignment
\stopplacefigure

\goto{test}[url(\xmlfilter{#1}{/link/command(xml:link)})]
\stopxmlsetups


\startbuffer[test]





https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>




https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>




https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>


\stopbuffer


\starttext

\xmlprocessbuffer{test}{test}{}

\stoptext



test  two spaces.pdf
Description: test  two spaces.pdf


test one space.pdf
Description: test one space.pdf


test not two spaces.pdf
Description: test not two spaces.pdf
___
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
___

[NTG-context] XML: Correct usage of hash symbol in url

2023-08-25 Thread denis.maier
Hi,

I need to process URLs in XML documents differently depending on the target. 
Thanks to Hans and Thomas I can now deal with the attributes.
Now I need to prefix certain kind of targets with a certain URL (a web viewer 
for IIIF images in this particular case). The prefix contains a #, which, as a 
special character seems to cause an error. Adding a double hash seems to work, 
but those ## will end up in the link URL. How can I properly escape a single #? 
I've already tried using \Ux{23}, but that won't work either.

Best,
Denis

\setupinteraction[state=start]

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|element}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups

\startluacode
 function xml.finalizers.tex.url(e,a)
 local u = #e > 0 and e[1].at[a]
 local s = u and lpeg.match(lpeg.patterns.urlunescaper,u)
 context(s)
 end
\stopluacode

\startxmlsetups xml:element
\xmldoifelse{#1}{.[@href and contains(@href,'https://iiif.ub.unibe.ch')]}


{\goto{\xmlflush{#1}}[url(https://uv-v4.netlify.app/##?manifest=\xmlatt{#1}{href})]}
 % gives me two hashes in the Link


%{\goto{\xmlflush{#1}}[url(https://uv-v4.netlify.app/#?manifest=\xmlatt{#1}{xlink:href})]}
 \par % does not work

{\goto{\xmlflush{#1}}[url(\xmlatt{#1}{href})]}
\stopxmlsetups


\startbuffer[test]


https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20I%20104%20fol%20a1r;>IIIF-Link
https://wiki.contextgarden.net/;>Other Link

\stopbuffer

\starttext

\xmlprocessbuffer{test}{test}{}

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

[NTG-context] XML processing beginner's question

2023-08-21 Thread Michael Löscher

Hello list,

having the xml data at the bottom, I would like to process it so that 
the result is like this:


---
What it is (e.g. bold formatted)
date: 2023-08-01 (italic)
Description (small font size)
Another text (small font size)

hd1 - Header 1

§ 1 First  (A first short description)
AA
BB

§ 2 Second (A second short description)
CC
DD

§ 3 Third (A third short description)
EE
FF
---

How can I process the s differently? The first element contains 
a  tag and so it differs from the other ones. The second element's 
 tag contains the word "Header" which makes it different again. 
The other elements contain a  tag that they all have 
in common.


What could be the appropriate xml setups to generate the above output?

Michael

---
xml data:
\startbuffer[xmlcontent]


  

  What it is
  2023-08-01


  
Description
Another text
  

  
  

  hd1
  Header 1


  
Text of Header 1
  

  
  

  1
  First
  A first short description


  
AA
BB
  

  
  

  2
  Second
  A second short description


  
CC
DD
  

  
  

  3
  Third
  A third short description


  
EE
FF
  

  

\stopbuffer

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

[NTG-context] xml: matches always child of other element

2023-07-24 Thread denis.maier
Hi,

I must be missing something obvious, but in this example the pattern for  
always matches the first element, not the one under the current .
Interestingly, using xml:index-entry-2 instead of the normal version matches 
correctly... Any hints what is going off the rails here?

Best,
Denis

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{index}{xml:*}
\xmlsetsetup{#1}{index-entry}{xml:index-entry}
%\xmlsetsetup{#1}{index-entry}{xml:index-entry-2}
\xmlsetsetup{#1}{term}{xml:index-entry-term}
\xmlsetsetup{#1}{nav-pointer-group}{xml:*}
\xmlsetsetup{#1}{nav-pointer}{xml:nav-pointer}
\xmlsetsetup{#1}{nav-pointer/ext-link}{xml:nav-pointer-link}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

% Index

\startxmlsetups xml:book-back
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:index
  
\startsectionlevel[title={\xmlfilter{#1}{/index-title-group/title/command(xml:index-title)}},]
\xmlflush{#1}
  \stopsectionlevel
\stopxmlsetups

\startxmlsetups xml:index-title
\xmlflush{#1}
\stopxmlsetups

\definedescription[indexentry]
[alternative=top,
headstyle=normal,
headcommand=\hskip-1cm,
margin=1cm,
inbetween=,
]

\startxmlsetups xml:index-entry
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:index-entry-2
\xmlfilter{#1}{/term/command(xml:index-entry-term)}%
\xmlverbatim{#1}
\stopxmlsetups

\startxmlsetups xml:index-entry-term
\indexentry{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:nav-pointer-group
\xmlconcat{#1}{/nav-pointer}{, }
\stopxmlsetups

\startxmlsetups xml:nav-pointer
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:nav-pointer-link
\xmlflush{#1}
\stopxmlsetups

\startbuffer[test]


  
Index
  
  
First

  
1
  
  
2
  
  
3
  

  
  
Second

  
1
  

  
  
Third

  
1
  

  

\stopbuffer

\starttext

\xmlprocessbuffer{test}{test}{}

\stoptext
___
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 nbsp?

2023-06-13 Thread Bruce Horrocks via ntg-context
 is not a pre-defined named character in XML (but it is in HTML which 
lulls you into a false sense of security).

See the link below for some more detail and a fix.



> On 13 Jun 2023, at 11:01, Hans van der Meer via ntg-context 
>  wrote:
> 
> What happened to the non breaking space in XML? It has disappeared in a way. 
> See the minimal example attached.
> 
> dr. Hans van der Meer
> 


test-nbsp.pdf
Description: Adobe PDF document
> 

—
Bruce Horrocks
Hampshire, UK

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


[NTG-context] xml nbsp?

2023-06-13 Thread Hans van der Meer via ntg-context
What happened to the non breaking space in XML? It has disappeared in a way. See the minimal example attached.dr. Hans van der Meer

test-nbsp.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 / 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-21 Thread Thomas A. Schmitz via ntg-context

On 11/20/22 19:19, Thomas A. Schmitz via ntg-context wrote:
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")


Replying to myself, and sorry for the noise (this was fairly easy, 
should have seen it earlier):


instead of loading the file "examples.xml," I simply include it via 
xmlinclude into the tree; this way the proper setups are applied.


All best

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
___


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
___


Re: [NTG-context] Xml filtering in Lua

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

> On 17. Nov 2022, at 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
> 
> Hans

I think this is exactly the approach I’m looking for: collecting everything in 
Lua tables and then retrieving and typesetting it later. I’m experimenting with 
it right now. I will have to define a proper lxml.command for every xml tag, I 
guess; otherwise, the xml gets serialized? I’ll play some more and will 
certainly be back with questions :-)

Thank you, as always, and all best

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
___


Re: [NTG-context] Xml filtering in Lua

2022-11-17 Thread Hans Hagen via ntg-context

On 11/16/2022 8:56 PM, mf via ntg-context wrote:

This works:

local metadata = xml.filter (t, '../../topics/topic[@t:id=="' .. ch_id 
.. '"]')


also this:

local lpath = string.format('../../topics/topic[@t:id=="%s"]', ch_id)

local metadata = xml.filter (t, lpath)


It looks like xml.filter supports only 2 arguments (see lxml-tex.lua), 
and so it doesn't let you use string formatting patterns like the 
"context" command does.


You can write:

context('the value of @t:id is "%s"', ch_id)

but you can't write:

xml.filter (t, '../../topics/topic[@t:id=="%s"]', ch_id)

In Thomas example this is also an approach:

\startxmlsetups xml:document
\xmlfunction{#1} {document}
\xmlflush{#1}
\stopxmlsetups

with

\startluacode
local topics   = { }
local chapters = { }

function xml.functions.document(t)
for c in xml.collected(t,"/topics/topic") do
topics[c.at.t_id] = c
end
 -- for c in xml.collected(t,"/chapters/chapter") do
 -- chapters[c.at.ch_id] = c
 -- -- or flush here
 -- end
end

function xml.functions.chapter (t)
local ch_id = t.at.ch_id
local metadata = topics[ch_id]
lxml.command(t, ".", "xml:chapter:content")
context.par ()
context (ch_id)
context.par ()
end
\stopluacode

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


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 / 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-16 Thread Hans Hagen via ntg-context

On 11/16/2022 10:09 PM, Thomas A. Schmitz via ntg-context wrote:

On 11/16/22 21:51, Denis Maier via ntg-context wrote:

Just a quick question regarding this?
Is xml.filter equivalent to \xmlfilter? If so, how do you pass the 
match to a command as you'd do with \xmlfilter?


I'm still digesting and playing with Massi's reply; will probably be 
back with more questions :-)


Anyway:

If you've filtered something out like this

local tree = xml.filter (t, "../chapter[@title='mytitle'")


always keep in mind that some expressions return a list of matches, that 
can be looped over and some commands just process the first


anyway, it can sometimes help to add

print(tstring(tree))

so see what you got

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 / 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-16 Thread Thomas A. Schmitz via ntg-context

On 11/16/22 21:51, Denis Maier via ntg-context wrote:

Just a quick question regarding this?
Is xml.filter equivalent to \xmlfilter? If so, how do you pass the match to a 
command as you'd do with \xmlfilter?


I'm still digesting and playing with Massi's reply; will probably be 
back with more questions :-)


Anyway:

If you've filtered something out like this

local tree = xml.filter (t, "../chapter[@title='mytitle'")

you can then apply a command to it

lxml.command(lxml.id(tree), ".", "xml:chapter:command")

and have to define the command as

\startxmlsetups xml:chapter:command
\xmltext {#1} {content}
\stopxmlsetups

for example.

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
___


Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread Denis Maier via ntg-context
Just a quick question regarding this?
Is xml.filter equivalent to \xmlfilter? If so, how do you pass the match to a 
command as you'd do with \xmlfilter?

Best,
Denis

> -Ursprüngliche Nachricht-
> Von: ntg-context  Im Auftrag von mf via ntg-
> context
> Gesendet: Mittwoch, 16. November 2022 20:56
> An: ntg-context@ntg.nl
> Cc: mf 
> Betreff: Re: [NTG-context] Xml filtering in Lua
> 
> This works:
> 
> local metadata = xml.filter (t, '../../topics/topic[@t:id=="' .. ch_id .. 
> '"]')
> 
> also this:
> 
> local lpath = string.format('../../topics/topic[@t:id=="%s"]', ch_id)
> 
> local metadata = xml.filter (t, lpath)
> 
> 
> It looks like xml.filter supports only 2 arguments (see lxml-tex.lua), and so 
> it
> doesn't let you use string formatting patterns like the "context" command
> does.
> 
> You can write:
> 
> context('the value of @t:id is "%s"', ch_id)
> 
> but you can't write:
> 
> xml.filter (t, '../../topics/topic[@t:id=="%s"]', ch_id)
> 
> 
> 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 / 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
> __
> _

> -Ursprüngliche Nachricht-----
> Von: ntg-context  Im Auftrag von Thomas A.
> Schmitz via ntg-context
> Gesendet: Mittwoch, 16. November 2022 20:56
> An: mailing list for ConTeXt users 
> Cc: Thomas A. Schmitz 
> Betreff: Re: [NTG-context] Xml filtering in Lua
> 
> On 11/16/22 19:56, mf via ntg-context wrote:
> > local ch_id = t.at["ch:id"]
> 
> You're right, of course, using a colon was a stupid idea. When I replace it 
> with
> an underscore, you can see that both are in fact identical:
> 
> \startbuffer[test]
> 
>
>   
>   This is the first test
>   22/11/16
>   
>   
>   This is the second test
>   22/11/17
>   
>
>
>   
>   
> This will be the content of the first chapter.
>   
>   
>   
>
> This will be the content of the second chapter.
>
>   
>
> 
> \stopbuffer
> 
> \startxmlsetups xml:testsetups
> \xmlsetsetup{#1}{*}{-}
>   \xmlsetsetup{#1}{document|chapters|chapter|content|emph}{xml:
> *}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:testsetups}
> 
> \startxmlsetups xml:document
>   \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:chapters
>   \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:chapter
>   \xmlfunction {#1} {chapter}
> %  \xmlflush {#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:chapter:content
>   \xmltext {#1} {content}
> \stopxmlsetups
> 
> \startxmlsetups xml:emph
>{\em \xmlflush {#1}}
> \stopxmlsetups
> 
> \startluacode
> function xml.functions.chapter (t)
>local chapter_id = t.at.ch_id
>local other_chapter_id = t.at["ch_id"]
>context (chapter_id)
>context.par ()
>context (other_chapter_id)
>context.par ()
>   local metadata = xml.filter (t, 
> '../../topics/topic[@t:id=="%s"]',
> ch_id)
>   print (inspect(metadata))
>   lxml.command(t, ".", "xml:chapter:content")
>   context.par ()
> end
> \stopluacode
> 
> \starttext
>   \xmlprocessbuffer{main}{test}{}
> \stoptext
> 
> __
> _
> 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
> __
> _
___
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-16 Thread mf via ntg-context

This works:

local metadata = xml.filter (t, '../../topics/topic[@t:id=="' .. ch_id 
.. '"]')


also this:

local lpath = string.format('../../topics/topic[@t:id=="%s"]', ch_id)

local metadata = xml.filter (t, lpath)


It looks like xml.filter supports only 2 arguments (see lxml-tex.lua), 
and so it doesn't let you use string formatting patterns like the 
"context" command does.


You can write:

context('the value of @t:id is "%s"', ch_id)

but you can't write:

xml.filter (t, '../../topics/topic[@t:id=="%s"]', ch_id)


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 / 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-16 Thread Thomas A. Schmitz via ntg-context

On 11/16/22 19:56, mf via ntg-context wrote:

local ch_id = t.at["ch:id"]


You're right, of course, using a colon was a stupid idea. When I replace 
it with an underscore, you can see that both are in fact identical:


\startbuffer[test]

  
 
This is the first test
22/11/16
 
 
This is the second test
22/11/17
 
  
  
 

  This will be the content of the first chapter.

 
 
 
  This will be the content of the second chapter.
 
 
  

\stopbuffer

\startxmlsetups xml:testsetups
   \xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|chapters|chapter|content|emph}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:chapters
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:chapter
\xmlfunction {#1} {chapter}
%\xmlflush {#1} 
\stopxmlsetups

\startxmlsetups xml:chapter:content
\xmltext {#1} {content}
\stopxmlsetups

\startxmlsetups xml:emph
  {\em \xmlflush {#1}}
\stopxmlsetups

\startluacode
function xml.functions.chapter (t)
 local chapter_id = t.at.ch_id
 local other_chapter_id = t.at["ch_id"]
 context (chapter_id)
 context.par ()
 context (other_chapter_id)
 context.par ()
local metadata = xml.filter (t, 
'../../topics/topic[@t:id=="%s"]', ch_id)
print (inspect(metadata))
lxml.command(t, ".", "xml:chapter:content")
context.par ()
end
\stopluacode

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext

___
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-16 Thread mf via ntg-context

Il 16/11/22 18:33, Thomas A. Schmitz via ntg-context ha scritto:

\startbuffer[test]

   
  
This is the first test
22/11/16
  
  
This is the second test
22/11/17
  
   
   
  

  This will be the content of the first chapter.

  
  
 
  This will be the content of the second chapter.
 
  
   

\stopbuffer

\startxmlsetups xml:testsetups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|chapters|chapter|content|emph}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:chapters
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:chapter
\xmlfunction {#1} {chapter}
 \xmlflush {#1} 
\stopxmlsetups

\startxmlsetups xml:chapter:content
\xmltext {#1} {content}
\stopxmlsetups

\startxmlsetups xml:emph
   {\em \xmlflush {#1}}
\stopxmlsetups

\startluacode
function xml.functions.chapter (t)
 local ch_id = t.at.ch:id



local ch_id = t.at["ch:id"]



local metadata = xml.filter (t, 
'../../topics/topic[@t:id=="%s"]', ch_id)
print (inspect(metadata))
lxml.command(t, ".", "xml:chapter:content")
context.par ()
context (ch_id)
context.par ()
end
\stopluacode


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 / 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-16 Thread Thomas A. Schmitz via ntg-context
Hi Duncan,

Thank you for pointing this out! I knew this was true inside the xmlns 
namespace, so you can’t have identical xml:id tags, but you’re probably right 
that it’s better to avoid this confusion altogether. Alas, this doesn’t help 
with my problem. Since there was a type in my minimal example from my 
experimentations, I include a corrected version, avoiding the identical tags

All best

Thomas

\startbuffer[test]

  
 
This is the first test
22/11/16
 
 
This is the second test
22/11/17
 
  
  
 

  This will be the content of the first chapter.

 
 
 
  This will be the content of the second chapter.
 
 
  

\stopbuffer

\startxmlsetups xml:testsetups
   \xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|chapters|chapter|content|emph}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:chapters
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:chapter
\xmlfunction {#1} {chapter}
 \xmlflush {#1} 
\stopxmlsetups

\startxmlsetups xml:chapter:content
\xmltext {#1} {content}
\stopxmlsetups

\startxmlsetups xml:emph
  {\em \xmlflush {#1}}
\stopxmlsetups

\startluacode
function xml.functions.chapter (t)
 local ch_id = t.at.ch:id
local metadata = xml.filter (t, 
'../../topics/topic[@t:id=="%s"]', ch_id)
print (inspect(metadata))
lxml.command(t, ".", "xml:chapter:content")
context.par ()
context (ch_id)
context.par ()
end
\stopluacode


> On 16. Nov 2022, at 17:18, Duncan Hothersall via ntg-context 
>  wrote:
> 
> I'm not sure about the code, sorry, but I do know that an XML document can't 
> have two IDs of the same value. Typically you would use a linkend attribute 
> on the element which is referencing an id (in this case the topics, I think).
> 
> Probably doesn't help with your problem, but it's likely a prerequisite for 
> it to work.
> 
> Bests,
> 
> Duncan


___
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-16 Thread Duncan Hothersall via ntg-context
Hi Thomas.

I'm not sure about the code, sorry, but I do know that an XML document
can't have two IDs of the same value. Typically you would use a linkend
attribute on the element which is referencing an id (in this case the
topics, I think).

Probably doesn't help with your problem, but it's likely a prerequisite for
it to work.

Bests,

Duncan

On Wed, 16 Nov 2022 at 16:11, Thomas A. Schmitz via ntg-context <
ntg-context@ntg.nl> wrote:

> Hi all,
>
> I thought this was easy, but I overestimated my competence… I want to
> filter xml elements via their attributes and retrieve and typeset parts
> belonging together. Here is a small test file that explains what I’m trying:
>
> \startbuffer[test]
> 
>
>   
> This is the first test
> 22/11/16
>   
>   
> This is the second test
> 22/11/17
>   
>
>
>   
> 
>   This will be the content of the first chapter.
> 
>   
>   
>  
>   This will be the content of the second chapter.
>  
>   
>
> 
> \stopbuffer
>
> \startxmlsetups xml:testsetups
> \xmlsetsetup{#1}{*}{-}
> \xmlsetsetup{#1}{document|chapters|chapter|content|emph}{xml:*}
> \stopxmlsetups
>
> \xmlregistersetup{xml:testsetups}
>
> \startxmlsetups xml:document
> \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:chapters
> \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:chapter
> \xmlfunction {#1} {chapter}
>  \xmlflush {#1}
> \stopxmlsetups
>
> \startxmlsetups xml:chapter:content
> \xmltext {#1} {content}
> \stopxmlsetups
>
> \startxmlsetups xml:emph
>{\em \xmlflush {#1}}
> \stopxmlsetups
>
> \startluacode
> function xml.functions.chapter (t)
>  local ch_id = t.at.id
> local metadata = xml.filter (root,
> '../../topics/topic[@id=="%s"]', ch_id)
> print (inspect(metadata))
> lxml.command(t, ".", "xml:chapter:content")
> context.par ()
> context (ch_id)
> context.par ()
> end
> \stopluacode
>
> \starttext
> \xmlprocessbuffer{main}{test}{}
> \stoptext
>
> The line with xml.filter does not work as I expected. How can I walk the
> tree, find the “topic” element with the same “id” attribute as the chapter
> I’m currently in, and then typeset the different children of the topic
> element?
>
> Thanks a lot and all best
>
> 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
>
> ___
>
___
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
___


[NTG-context] Xml filtering in Lua

2022-11-16 Thread Thomas A. Schmitz via ntg-context
Hi all,

I thought this was easy, but I overestimated my competence… I want to filter 
xml elements via their attributes and retrieve and typeset parts belonging 
together. Here is a small test file that explains what I’m trying:

\startbuffer[test]

   
  
This is the first test
22/11/16
  
  
This is the second test
22/11/17
  
   
   
  

  This will be the content of the first chapter.

  
  
 
  This will be the content of the second chapter.
 
  
   

\stopbuffer

\startxmlsetups xml:testsetups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|chapters|chapter|content|emph}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:chapters
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:chapter
\xmlfunction {#1} {chapter}
 \xmlflush {#1} 
\stopxmlsetups

\startxmlsetups xml:chapter:content
\xmltext {#1} {content}
\stopxmlsetups

\startxmlsetups xml:emph
   {\em \xmlflush {#1}}
\stopxmlsetups

\startluacode
function xml.functions.chapter (t)
 local ch_id = t.at.id
local metadata = xml.filter (root, 
'../../topics/topic[@id=="%s"]', ch_id)
print (inspect(metadata))
lxml.command(t, ".", "xml:chapter:content")
context.par ()
context (ch_id)
context.par ()
end
\stopluacode

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext

The line with xml.filter does not work as I expected. How can I walk the tree, 
find the “topic” element with the same “id” attribute as the chapter I’m 
currently in, and then typeset the different children of the topic element? 

Thanks a lot and all best

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
___


Re: [NTG-context] XML Namespaces and XML Setups

2022-05-24 Thread Bruce Horrocks via ntg-context
I haven't seen it explicitly documented - my cue to add it to the Wiki I guess!

I work with XML a fair bit and, IMHO, the WWW consortium docs do a very poor 
job of explaining namespaces because they make them seem much more complicated 
than they are. Essentially, a tag with a namespace identifier is just another 
tag i.e. treat all the characters, including the colon, as the tag name. Armed 
with that knowledge I just created a second tag definition in the sample code 
you posted.

> On 24 May 2022, at 09:50, Duncan Hothersall  wrote:
> 
> Yes, it does! Thanks Bruce. Is this documented somewhere already and I missed 
> it?
> 
> Cheers.
> 
> Duncan
> 
> On Mon, 23 May 2022 at 21:14, Bruce Horrocks  wrote:
> Does this help?
> 
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
>   \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   \xmlflush{#1}
> \stopxmlsetups
> \startxmlsetups xml:demo:otag   %% <---
>   {\bf \xmlflush{#1}}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> 
>xmlns:o="NameSpaceO">
>   text text
> 
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
> 
> > On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context 
> >  wrote:
> > 
> > I found this unanswered question on the list from November 2020 and find 
> > today that I have the same question. How can one handle elements with the 
> > same name but in different namespaces? How should the different 
> > \startxmlsetups commands be written?
> > 
> > Thanks.
> > 
> > Duncan
> > 
> > On Mon, 16 Nov 2020 at 13:37, Christoph Reller  
> > wrote:
> > Dear List,
> > 
> > Consider the following MWE:
> > 
> > \startxmlsetups xml:demo:base
> >   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> > \stopxmlsetups
> > \xmlregisterdocumentsetup{demo}{xml:demo:base}
> > \startxmlsetups xml:demo:tag
> >   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
> >   \xmlflush{#1}
> > \stopxmlsetups
> > \starttext
> > \startbuffer[test]
> > 
> >  >   xmlns:o="NameSpaceO">
> >   text text
> > 
> > \stopbuffer
> > \xmlprocessbuffer{demo}{test}{}
> > \stoptext
> > 
> > My questions:
> > - Is there a good way to have a separate XML setup for each XML namespace?
> > - Alternatively, one has to do the distinction within the same XML setup. 
> > In this case, how do we get the complete namespace? (In this example: 
> > "NameSpaceA" and "NameSpaceO")
> > 
> > Thanks in advance for your help!
> > 
> > Cheers, Christoph

—
Bruce Horrocks
Hampshire, UK

___
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] XML Namespaces and XML Setups

2022-05-24 Thread Duncan Hothersall via ntg-context
Yes, it does! Thanks Bruce. Is this documented somewhere already and I
missed it?

Cheers.

Duncan

On Mon, 23 May 2022 at 21:14, Bruce Horrocks  wrote:

> Does this help?
>
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
>   \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   \xmlflush{#1}
> \stopxmlsetups
> \startxmlsetups xml:demo:otag   %% <---
>   {\bf \xmlflush{#1}}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> 
>xmlns:o="NameSpaceO">
>   text text
> 
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
>
> > On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context <
> ntg-context@ntg.nl> wrote:
> >
> > I found this unanswered question on the list from November 2020 and find
> today that I have the same question. How can one handle elements with the
> same name but in different namespaces? How should the different
> \startxmlsetups commands be written?
> >
> > Thanks.
> >
> > Duncan
> >
> > On Mon, 16 Nov 2020 at 13:37, Christoph Reller <
> christoph.rel...@gmail.com> wrote:
> > Dear List,
> >
> > Consider the following MWE:
> >
> > \startxmlsetups xml:demo:base
> >   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> > \stopxmlsetups
> > \xmlregisterdocumentsetup{demo}{xml:demo:base}
> > \startxmlsetups xml:demo:tag
> >   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
> >   \xmlflush{#1}
> > \stopxmlsetups
> > \starttext
> > \startbuffer[test]
> > 
> >  >   xmlns:o="NameSpaceO">
> >   text text
> > 
> > \stopbuffer
> > \xmlprocessbuffer{demo}{test}{}
> > \stoptext
> >
> > My questions:
> > - Is there a good way to have a separate XML setup for each XML
> namespace?
> > - Alternatively, one has to do the distinction within the same XML
> setup. In this case, how do we get the complete namespace? (In this
> example: "NameSpaceA" and "NameSpaceO")
> >
> > Thanks in advance for your help!
> >
> > Cheers, Christoph
> >
> ___
> > 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
> >
> ___
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
___
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] XML Namespaces and XML Setups

2022-05-23 Thread Bruce Horrocks via ntg-context
Does this help?

\startxmlsetups xml:demo:base
  \xmlsetsetup{#1}{tag}{xml:demo:tag}
  \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}
\startxmlsetups xml:demo:tag
  \xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:demo:otag   %% <---
  {\bf \xmlflush{#1}}
\stopxmlsetups
\starttext
\startbuffer[test]


  text text

\stopbuffer
\xmlprocessbuffer{demo}{test}{}
\stoptext

> On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context 
>  wrote:
> 
> I found this unanswered question on the list from November 2020 and find 
> today that I have the same question. How can one handle elements with the 
> same name but in different namespaces? How should the different 
> \startxmlsetups commands be written?
> 
> Thanks.
> 
> Duncan
> 
> On Mon, 16 Nov 2020 at 13:37, Christoph Reller  
> wrote:
> Dear List,
> 
> Consider the following MWE:
> 
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
>   \xmlflush{#1}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> 
>xmlns:o="NameSpaceO">
>   text text
> 
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
> 
> My questions:
> - Is there a good way to have a separate XML setup for each XML namespace?
> - Alternatively, one has to do the distinction within the same XML setup. In 
> this case, how do we get the complete namespace? (In this example: 
> "NameSpaceA" and "NameSpaceO")
> 
> Thanks in advance for your help!
> 
> Cheers, Christoph
> ___
> 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
> ___

—
Bruce Horrocks
Hampshire, UK

___
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] XML Namespaces and XML Setups

2022-05-23 Thread Duncan Hothersall via ntg-context
I found this unanswered question on the list from November 2020 and find
today that I have the same question. How can one handle elements with the
same name but in different namespaces? How should the different
\startxmlsetups commands be written?

Thanks.

Duncan

On Mon, 16 Nov 2020 at 13:37, Christoph Reller 
wrote:

> Dear List,
>
> Consider the following MWE:
>
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
>   \xmlflush{#1}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> 
>xmlns:o="NameSpaceO">
>   text text
> 
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
>
> My questions:
> - Is there a good way to have a separate XML setup for each XML namespace?
> - Alternatively, one has to do the distinction within the same XML setup.
> In this case, how do we get the complete namespace? (In this example:
> "NameSpaceA" and "NameSpaceO")
>
> Thanks in advance for your help!
>
> Cheers, Christoph
>
> ___
> 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] XML: calculations on attribute values before output

2022-05-05 Thread Duncan Hothersall via ntg-context
Thanks so much Taco, that opens the door to a lot for me. It's a tricky
learning curve.

Just in case anyone else is copying code in future for CALS, there's a tiny
tweak to the rows calculation, it should be (t.at.morerows or 0) + 1.

I see a route to solving lots of other problems here too. Thanks again.

Duncan

On Thu, 5 May 2022 at 08:21, Taco Hoekwater  wrote:

>
>
> > On 4 May 2022, at 22:10, Duncan Hothersall via ntg-context <
> ntg-context@ntg.nl> wrote:
> >
> > Hi.
> >
> > I'm processing an XML table and need to set a row span. Because we use a
> variant of the CALS table model, spans are defined by an attribute saying
> how many *additional* rows should be spanned, as opposed to how many *in
> total*. So to translate this into TABLE \bTD[nr=X] syntax I need to add 1.
> >
> > I'm guessing this is very easily doable (in lua?) but I've tried various
> permutations and can't work it out. If anyone could give me a pointer that
> would be great.
> >
> > (In reality I'm going to need to handle lots of other conversions of
> attribute values into \bTD[...] commands, so if there's a generalised way
> of doing that sort of thing, or even better if someone has already tackled
> CALS tables in this way, that would also be great!)
>
> Not CALS, but I do a lot of HTML table processing. I find it all much
> easier on the lua side, because there the
> attributes are just in a table entry of the argument node t ( t.at ):
>
> set up a lua function in the setups:
>
> \startxmlsetups xml:demo:base
>  \xmlsetsetup{#1}{*}{xml:demo:*}
>  \xmlsetfunction {\xmldocument}{entry}{userdata.xmlfunctions.entry}
> \stopxmlsetups
>
> and then add this lua code:
>
> \startluacode
> userdata.xmlfunctions = {}
> function userdata.xmlfunctions.entry (t)
>   local rows = (t.at.morerows or 1) + 1
>   context.bTD({nr=rows})
>   lxml.flush(t)
>   context.eTD()
> end
> \stopluacode
>
> All of the tex-side commands also exist in lua, in the lxml and/or xml
> table, e.g.:
>
> direct output flushing:
>   lxml.flush(t)
>   lxml.all(t, ‘entry’)
>
> filter for processing:
>   for b in xml.collected(lxml.getid(t),'../row/entry') do … end
>
>
> (those are the ones I use a lot, there are many more)
>
> Best wishes,
> Taco



-- 
Duncan Hothersall, Operations Director
CAPDM Limited - Online Program Enablers
0131 677 2400  www.capdm.com
Registered in Scotland: SC168970   VAT: 682 846 983
Registered address: 20 Forth Street Edinburgh EH1 3LH UK


Capture, author, publish, deliver and manage your learning materials.


*Sign up to the CAPDM newsletter here *
___
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] XML: calculations on attribute values before output

2022-05-05 Thread Taco Hoekwater via ntg-context


> On 4 May 2022, at 22:10, Duncan Hothersall via ntg-context 
>  wrote:
> 
> Hi.
> 
> I'm processing an XML table and need to set a row span. Because we use a 
> variant of the CALS table model, spans are defined by an attribute saying how 
> many *additional* rows should be spanned, as opposed to how many *in total*. 
> So to translate this into TABLE \bTD[nr=X] syntax I need to add 1.
> 
> I'm guessing this is very easily doable (in lua?) but I've tried various 
> permutations and can't work it out. If anyone could give me a pointer that 
> would be great.
> 
> (In reality I'm going to need to handle lots of other conversions of 
> attribute values into \bTD[...] commands, so if there's a generalised way of 
> doing that sort of thing, or even better if someone has already tackled CALS 
> tables in this way, that would also be great!)

Not CALS, but I do a lot of HTML table processing. I find it all much easier on 
the lua side, because there the 
attributes are just in a table entry of the argument node t ( t.at ):

set up a lua function in the setups:

\startxmlsetups xml:demo:base
 \xmlsetsetup{#1}{*}{xml:demo:*}
 \xmlsetfunction {\xmldocument}{entry}{userdata.xmlfunctions.entry}
\stopxmlsetups

and then add this lua code:

\startluacode
userdata.xmlfunctions = {}
function userdata.xmlfunctions.entry (t)
  local rows = (t.at.morerows or 1) + 1
  context.bTD({nr=rows})
  lxml.flush(t) 
  context.eTD()
end
\stopluacode

All of the tex-side commands also exist in lua, in the lxml and/or xml table, 
e.g.:

direct output flushing: 
  lxml.flush(t)
  lxml.all(t, ‘entry’)

filter for processing:
  for b in xml.collected(lxml.getid(t),'../row/entry') do … end


(those are the ones I use a lot, there are many more)

Best wishes,
Taco
___
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] XML: calculations on attribute values before output

2022-05-04 Thread Duncan Hothersall via ntg-context
Hi.

I'm processing an XML table and need to set a row span. Because we use a
variant of the CALS table model, spans are defined by an attribute saying
how many *additional* rows should be spanned, as opposed to how many *in
total*. So to translate this into TABLE \bTD[nr=X] syntax I need to add 1.

I'm guessing this is very easily doable (in lua?) but I've tried various
permutations and can't work it out. If anyone could give me a pointer that
would be great.

(In reality I'm going to need to handle lots of other conversions of
attribute values into \bTD[...] commands, so if there's a generalised way
of doing that sort of thing, or even better if someone has already tackled
CALS tables in this way, that would also be great!)

MWE below, but obviously it just passes the morerows="1" value straight
through into \bTD[nr=1] so it doesn't give me a row span at all.

Thanks in advance.

Duncan

--

\startbuffer[demo]

 
  
   
1
2
   
   
3
   
  
 

\stopbuffer

\startxmlsetups xml:demo:base
 \xmlsetsetup{#1}{*}{xml:demo:*}
\stopxmlsetups

\xmlregisterdocumentsetup{demo}{xml:demo:base}

\startxmlsetups xml:demo:informaltable
 \bTABLE
  \xmlflush{#1}
 \eTABLE
\stopxmlsetups

\startxmlsetups xml:demo:tgroup
 \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:demo:tbody
 \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:demo:row
 \bTR
  \xmlflush{#1}
 \eTR
\stopxmlsetups

\startxmlsetups xml:demo:entry
 \bTD[nr=\xmlattdef{#1}{morerows}{1}]
  \xmlflush{#1}
 \eTD
\stopxmlsetups

\setupbodyfont[modern]
\starttext
\xmlprocessbuffer{demo}{demo}{}
\stoptext

--
___
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] XML processing instructions

2022-05-03 Thread Duncan Hothersall via ntg-context
Just following up on my own question in case anybody else is interested, I
realised that the logic of my preprocessor code wasn't the problem, it was
just my ignorance of lua and character escaping. Both ? and * are special
characters in string.gsub expressions, so they need to be escaped with the
lua escape character which is % (which sends my editor haywire because it
thinks I am putting in a TeX comment, but never mind!).

So my now working code to translate historic processing instructions into
directives without a separate pass is:

\startluacode
function lxml.preprocessor(data)
 data = string.gsub(data, '<%?capdm %*force_line_stop%?>',
'')
 return data
end
\stopluacode

\startsetups xml:directive:injector:newline
 \crlf
\stopsetups

Duncan

On Mon, 2 May 2022 at 09:24, Duncan Hothersall  wrote:

> Many thanks Denis. Very useful tip on the injectors and generalised
> command usage. That will definitely come in useful.
>
> My problem is that I already have a lot of XML data with the existing
> processing instructions in it. I know I could use an external preprocess in
> something like Python to change them into injectors before they are fed
> into ConTeXt, but I was hoping there was a way to handle them directly as
> part of the ConTeXt / lua process.
>
> Thanks again though.
>
> Duncan
>
>
>
>
> On Mon, 2 May 2022, 08:48 ,  wrote:
>
>> That was too quick, sorry.
>>
>>
>>
>> Hi Duncan,
>>
>>
>>
>> I have used context’s own injectors for this :
>>
>>
>>
>> 
>>
>>
>>
>> \startsetups xml:directive:injector:addlinetopage
>>
>>   \adaptlayout[lines=+1]
>>
>> \stopsetups
>>
>>
>>
>> Or, for your line break example :
>>
>>
>>
>> 
>>
>>
>>
>> \startsetups xml:directive:injector:newline
>>
>>   \crlf
>>
>> \stopsetups
>>
>>
>>
>> Also, I have learned that you can just use arbitrary context code in xml:
>>
>>
>>
>> \def\xmltexdirective#1#2{\doif{#1}{command}{#2}}
>>
>>
>>
>> \xmlinstalldirective{tex}{xmltexdirective}
>>
>>
>>
>>  
>>
>>  
>>
>>  
>>
>>
>>
>> Best,
>>
>> Denis
>>
>>
>>
>> *Von:* Maier, Denis Christian (UB)
>> *Gesendet:* Montag, 2. Mai 2022 09:45
>> *An:* 'mailing list for ConTeXt users' 
>> *Cc:* Duncan Hothersall 
>> *Betreff:* AW: [NTG-context] XML processing instructions
>>
>>
>>
>>
>>
>> *Von:* ntg-context  *Im Auftrag von *Duncan
>> Hothersall via ntg-context
>> *Gesendet:* Montag, 2. Mai 2022 09:20
>> *An:* mailing list for ConTeXt users 
>> *Cc:* Duncan Hothersall 
>> *Betreff:* [NTG-context] XML processing instructions
>>
>>
>>
>> I have a big set of existing XML books (held in a derivative of DocBook)
>> which I'm looking to start processing directly with ConTeXt. (Up to now I
>> have a system which converts the XML into ConTeXt code which is then
>> processed, but this is inefficient and lots of the code is now unsupported.)
>>
>>
>>
>> I've had some success producing output, but my first real sticking point
>> has come with processing instructions. The existing XML contains lots of
>> processing instructions of the form
>>
>> , some of which can be conditional and introduce new
>> data etc. But I'd be happy at this stage if I could just process the most
>> basic one of them, which is used to introduce a line stop in a running
>> paragraph of text.
>>
>>
>>
>> My best guess at how to do this was to use the lxml.preprocessor function
>> to convert the processing instruction into an element, and then process the
>> element as normal. But (a) my attempt didn't work, and (b) there may
>> well be a better way.
>>
>>
>>
>> Minimal working example below, except that obviously the processing
>> instruction bit doesn't work!
>>
>>
>>
>> Thanks for any help or insights.
>>
>>
>>
>> Duncan
>>
>>
>>
>>
>>
>> MWE:
>>
>> --
>>
>>
>>
>> \startbuffer[demo]
>> 
>>   A paragraph witha processing
>> instruction.
>> 
>> \stopbuffer
>>
>> \startxmlsetups xml:demo:base
>>  \xmlsetsetup{#1}{*}{xml:demo:*}
>> \stopxmlsetups
>> \xmlregisterdocumentsetup{demo}{xml:demo:base}
>>
>> \startxmlsetups xml:demo:book
>>  \xmlflush{#1}
>

Re: [NTG-context] XML processing instructions

2022-05-02 Thread Duncan Hothersall via ntg-context
Many thanks Denis. Very useful tip on the injectors and generalised command
usage. That will definitely come in useful.

My problem is that I already have a lot of XML data with the existing
processing instructions in it. I know I could use an external preprocess in
something like Python to change them into injectors before they are fed
into ConTeXt, but I was hoping there was a way to handle them directly as
part of the ConTeXt / lua process.

Thanks again though.

Duncan




On Mon, 2 May 2022, 08:48 ,  wrote:

> That was too quick, sorry.
>
>
>
> Hi Duncan,
>
>
>
> I have used context’s own injectors for this :
>
>
>
> 
>
>
>
> \startsetups xml:directive:injector:addlinetopage
>
>   \adaptlayout[lines=+1]
>
> \stopsetups
>
>
>
> Or, for your line break example :
>
>
>
> 
>
>
>
> \startsetups xml:directive:injector:newline
>
>   \crlf
>
> \stopsetups
>
>
>
> Also, I have learned that you can just use arbitrary context code in xml:
>
>
>
> \def\xmltexdirective#1#2{\doif{#1}{command}{#2}}
>
>
>
> \xmlinstalldirective{tex}{xmltexdirective}
>
>
>
>  
>
>  
>
>  
>
>
>
> Best,
>
> Denis
>
>
>
> *Von:* Maier, Denis Christian (UB)
> *Gesendet:* Montag, 2. Mai 2022 09:45
> *An:* 'mailing list for ConTeXt users' 
> *Cc:* Duncan Hothersall 
> *Betreff:* AW: [NTG-context] XML processing instructions
>
>
>
>
>
> *Von:* ntg-context  *Im Auftrag von *Duncan
> Hothersall via ntg-context
> *Gesendet:* Montag, 2. Mai 2022 09:20
> *An:* mailing list for ConTeXt users 
> *Cc:* Duncan Hothersall 
> *Betreff:* [NTG-context] XML processing instructions
>
>
>
> I have a big set of existing XML books (held in a derivative of DocBook)
> which I'm looking to start processing directly with ConTeXt. (Up to now I
> have a system which converts the XML into ConTeXt code which is then
> processed, but this is inefficient and lots of the code is now unsupported.)
>
>
>
> I've had some success producing output, but my first real sticking point
> has come with processing instructions. The existing XML contains lots of
> processing instructions of the form
>
> , some of which can be conditional and introduce new
> data etc. But I'd be happy at this stage if I could just process the most
> basic one of them, which is used to introduce a line stop in a running
> paragraph of text.
>
>
>
> My best guess at how to do this was to use the lxml.preprocessor function
> to convert the processing instruction into an element, and then process the
> element as normal. But (a) my attempt didn't work, and (b) there may well
> be a better way.
>
>
>
> Minimal working example below, except that obviously the processing
> instruction bit doesn't work!
>
>
>
> Thanks for any help or insights.
>
>
>
> Duncan
>
>
>
>
>
> MWE:
>
> --
>
>
>
> \startbuffer[demo]
> 
>   A paragraph witha processing
> instruction.
> 
> \stopbuffer
>
> \startxmlsetups xml:demo:base
>  \xmlsetsetup{#1}{*}{xml:demo:*}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
>
> \startxmlsetups xml:demo:book
>  \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:demo:para
>  \xmlflush{#1}\endgraf
> \stopxmlsetups
>
> \startluacode
>  function lxml.preprocessor(data,settings)
>   return string.find(data,"")
>and string.gsub(data," *force_line_stop?>","")
>or data
>  end
> \stopluacode
>
> \startxmlsetups xml:demo:capdmlinestop
>  \crlf
>  \xmlflush{#1}
> \stopxmlsetups
>
> \setupbodyfont[modern]
> \starttext
> \xmlprocessbuffer{demo}{demo}{}
> \stoptext
>
>
>
> --
>
___
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] XML processing instructions

2022-05-02 Thread Denis Maier via ntg-context
That was too quick, sorry.

Hi Duncan,

I have used context’s own injectors for this :



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

Or, for your line break example :



\startsetups xml:directive:injector:newline
  \crlf
\stopsetups

Also, I have learned that you can just use arbitrary context code in xml:

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

\xmlinstalldirective{tex}{xmltexdirective}

 
 
 

Best,
Denis

Von: Maier, Denis Christian (UB)
Gesendet: Montag, 2. Mai 2022 09:45
An: 'mailing list for ConTeXt users' 
Cc: Duncan Hothersall 
Betreff: AW: [NTG-context] XML processing instructions


Von: ntg-context 
mailto:ntg-context-boun...@ntg.nl>> Im Auftrag von 
Duncan Hothersall via ntg-context
Gesendet: Montag, 2. Mai 2022 09:20
An: mailing list for ConTeXt users 
mailto:ntg-context@ntg.nl>>
Cc: Duncan Hothersall mailto:d...@capdm.com>>
Betreff: [NTG-context] XML processing instructions

I have a big set of existing XML books (held in a derivative of DocBook) which 
I'm looking to start processing directly with ConTeXt. (Up to now I have a 
system which converts the XML into ConTeXt code which is then processed, but 
this is inefficient and lots of the code is now unsupported.)

I've had some success producing output, but my first real sticking point has 
come with processing instructions. The existing XML contains lots of processing 
instructions of the form
, some of which can be conditional and introduce new data 
etc. But I'd be happy at this stage if I could just process the most basic one 
of them, which is used to introduce a line stop in a running paragraph of text.

My best guess at how to do this was to use the lxml.preprocessor function to 
convert the processing instruction into an element, and then process the 
element as normal. But (a) my attempt didn't work, and (b) there may well be a 
better way.

Minimal working example below, except that obviously the processing instruction 
bit doesn't work!

Thanks for any help or insights.

Duncan


MWE:
--

\startbuffer[demo]

  A paragraph witha processing 
instruction.

\stopbuffer

\startxmlsetups xml:demo:base
 \xmlsetsetup{#1}{*}{xml:demo:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}

\startxmlsetups xml:demo:book
 \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:demo:para
 \xmlflush{#1}\endgraf
\stopxmlsetups

\startluacode
 function lxml.preprocessor(data,settings)
  return string.find(data,"")
   and string.gsub(data,"","")
   or data
 end
\stopluacode

\startxmlsetups xml:demo:capdmlinestop
 \crlf
 \xmlflush{#1}
\stopxmlsetups

\setupbodyfont[modern]
\starttext
\xmlprocessbuffer{demo}{demo}{}
\stoptext

--
___
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] XML processing instructions

2022-05-02 Thread Denis Maier via ntg-context
Hi Duncan,

I have used context’s own injectors for this :



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

Or, for your line break example :

Von: ntg-context  Im Auftrag von Duncan Hothersall 
via ntg-context
Gesendet: Montag, 2. Mai 2022 09:20
An: mailing list for ConTeXt users 
Cc: Duncan Hothersall 
Betreff: [NTG-context] XML processing instructions

I have a big set of existing XML books (held in a derivative of DocBook) which 
I'm looking to start processing directly with ConTeXt. (Up to now I have a 
system which converts the XML into ConTeXt code which is then processed, but 
this is inefficient and lots of the code is now unsupported.)

I've had some success producing output, but my first real sticking point has 
come with processing instructions. The existing XML contains lots of processing 
instructions of the form
, some of which can be conditional and introduce new data 
etc. But I'd be happy at this stage if I could just process the most basic one 
of them, which is used to introduce a line stop in a running paragraph of text.

My best guess at how to do this was to use the lxml.preprocessor function to 
convert the processing instruction into an element, and then process the 
element as normal. But (a) my attempt didn't work, and (b) there may well be a 
better way.

Minimal working example below, except that obviously the processing instruction 
bit doesn't work!

Thanks for any help or insights.

Duncan


MWE:
--

\startbuffer[demo]

  A paragraph witha processing 
instruction.

\stopbuffer

\startxmlsetups xml:demo:base
 \xmlsetsetup{#1}{*}{xml:demo:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}

\startxmlsetups xml:demo:book
 \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:demo:para
 \xmlflush{#1}\endgraf
\stopxmlsetups

\startluacode
 function lxml.preprocessor(data,settings)
  return string.find(data,"")
   and string.gsub(data,"","")
   or data
 end
\stopluacode

\startxmlsetups xml:demo:capdmlinestop
 \crlf
 \xmlflush{#1}
\stopxmlsetups

\setupbodyfont[modern]
\starttext
\xmlprocessbuffer{demo}{demo}{}
\stoptext

--
___
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] XML processing instructions

2022-05-02 Thread Duncan Hothersall via ntg-context
Apologies, there are two rogue * in the lxml.preprocessor code, but even
when they are removed it doesn't work.

On Mon, 2 May 2022 at 08:19, Duncan Hothersall  wrote:

> I have a big set of existing XML books (held in a derivative of DocBook)
> which I'm looking to start processing directly with ConTeXt. (Up to now I
> have a system which converts the XML into ConTeXt code which is then
> processed, but this is inefficient and lots of the code is now unsupported.)
>
> I've had some success producing output, but my first real sticking point
> has come with processing instructions. The existing XML contains lots of
> processing instructions of the form
> , some of which can be conditional and introduce new
> data etc. But I'd be happy at this stage if I could just process the most
> basic one of them, which is used to introduce a line stop in a running
> paragraph of text.
>
> My best guess at how to do this was to use the lxml.preprocessor function
> to convert the processing instruction into an element, and then process the
> element as normal. But (a) my attempt didn't work, and (b) there may well
> be a better way.
>
> Minimal working example below, except that obviously the processing
> instruction bit doesn't work!
>
> Thanks for any help or insights.
>
> Duncan
>
>
> MWE:
> --
>
> \startbuffer[demo]
> 
>   A paragraph witha processing
> instruction.
> 
> \stopbuffer
>
> \startxmlsetups xml:demo:base
>  \xmlsetsetup{#1}{*}{xml:demo:*}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
>
> \startxmlsetups xml:demo:book
>  \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:demo:para
>  \xmlflush{#1}\endgraf
> \stopxmlsetups
>
> \startluacode
>  function lxml.preprocessor(data,settings)
>   return string.find(data,"")
>and string.gsub(data," *force_line_stop?>","")
>or data
>  end
> \stopluacode
>
> \startxmlsetups xml:demo:capdmlinestop
>  \crlf
>  \xmlflush{#1}
> \stopxmlsetups
>
> \setupbodyfont[modern]
> \starttext
> \xmlprocessbuffer{demo}{demo}{}
> \stoptext
>
> --
>


-- 
Duncan Hothersall, Operations Director
CAPDM Limited - Online Program Enablers
0131 677 2400  www.capdm.com
Registered in Scotland: SC168970   VAT: 682 846 983
Registered address: 20 Forth Street Edinburgh EH1 3LH UK


Capture, author, publish, deliver and manage your learning materials.


*Sign up to the CAPDM newsletter here *
___
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] XML processing instructions

2022-05-02 Thread Duncan Hothersall via ntg-context
I have a big set of existing XML books (held in a derivative of DocBook)
which I'm looking to start processing directly with ConTeXt. (Up to now I
have a system which converts the XML into ConTeXt code which is then
processed, but this is inefficient and lots of the code is now unsupported.)

I've had some success producing output, but my first real sticking point
has come with processing instructions. The existing XML contains lots of
processing instructions of the form
, some of which can be conditional and introduce new data
etc. But I'd be happy at this stage if I could just process the most basic
one of them, which is used to introduce a line stop in a running paragraph
of text.

My best guess at how to do this was to use the lxml.preprocessor function
to convert the processing instruction into an element, and then process the
element as normal. But (a) my attempt didn't work, and (b) there may well
be a better way.

Minimal working example below, except that obviously the processing
instruction bit doesn't work!

Thanks for any help or insights.

Duncan


MWE:
--

\startbuffer[demo]

  A paragraph witha processing
instruction.

\stopbuffer

\startxmlsetups xml:demo:base
 \xmlsetsetup{#1}{*}{xml:demo:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}

\startxmlsetups xml:demo:book
 \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:demo:para
 \xmlflush{#1}\endgraf
\stopxmlsetups

\startluacode
 function lxml.preprocessor(data,settings)
  return string.find(data,"")
   and string.gsub(data,"","")
   or data
 end
\stopluacode

\startxmlsetups xml:demo:capdmlinestop
 \crlf
 \xmlflush{#1}
\stopxmlsetups

\setupbodyfont[modern]
\starttext
\xmlprocessbuffer{demo}{demo}{}
\stoptext

--
___
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] Xml - Lua - context

2022-03-28 Thread Thomas A. Schmitz via ntg-context


> On 28. Mar 2022, at 18:21, Adam Reviczky via ntg-context  
> wrote:
> 
> Hi Thomas,
> 
> Not sure whether it helps or not, but in regards to combinations and Lua I 
> have had some challenges as well, but Hans' and Wolfgangs' solution with 
> externalfigures works fine for me now:
> 
> https://mailman.ntg.nl/pipermail/ntg-context/2021/103822.html
> https://mailman.ntg.nl/pipermail/ntg-context/2021/103827.html
> 
> Adam


Thank you, that’s already very useful! I should have looked if there is a 
“delayed” alternative for externalfigure as well, but I also take Hans’s 
warning to heart that all of this is non-trivial. 

Thank you, 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 / 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] Xml - Lua - context

2022-03-28 Thread Adam Reviczky via ntg-context
Hi Thomas,

Not sure whether it helps or not, but in regards to combinations and Lua I
have had some challenges as well, but Hans' and Wolfgangs' solution with
externalfigures works fine for me now:

https://mailman.ntg.nl/pipermail/ntg-context/2021/103822.html
https://mailman.ntg.nl/pipermail/ntg-context/2021/103827.html

Adam

On Mon, Mar 28, 2022 at 2:42 PM Thomas A. Schmitz via ntg-context <
ntg-context@ntg.nl> wrote:

> And here comes question 2, a very basic one: on A4 landscape pages, I want
> to place two images next to each other (like the spread pages of a book).
> What would be the preferred way of the really competent users to do this,
> again keeping in mind that I want to loop over page numbers in a pdf file
> and thus am coding in Lua. So far, I have tried or thought about:
>
> 1. Embedded xtable
>
> This is what I’m using now, an xtable of two columns for every A4 page. It
> works, but I wonder if it’s a good method.
>
> 2. combinations
>
> This appeared to be the most natural approach (because it’s what
> combinations are for), but I ran into expansion problems, added a few
> “function () end” in my code, but couldn’t make it compile. Combinations,
> combined with framed and externalfigure, are difficult to write in Lua - or
> am I too stupid to find the winning combination (sorry for the puns).
>
> 3. columns
>
> Again, this would seen like a natural approach, having every A4 page set
> up as two columns, but maybe that’s overkill?
>
> I’d be curious to know what you think!
>
> All best
>
> Thomas
>
> ___
> 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] Xml - Lua - context

2022-03-28 Thread Thomas A. Schmitz via ntg-context
And here comes question 2, a very basic one: on A4 landscape pages, I want to 
place two images next to each other (like the spread pages of a book). What 
would be the preferred way of the really competent users to do this, again 
keeping in mind that I want to loop over page numbers in a pdf file and thus am 
coding in Lua. So far, I have tried or thought about:

1. Embedded xtable

This is what I’m using now, an xtable of two columns for every A4 page. It 
works, but I wonder if it’s a good method.

2. combinations

This appeared to be the most natural approach (because it’s what combinations 
are for), but I ran into expansion problems, added a few “function () end” in 
my code, but couldn’t make it compile. Combinations, combined with framed and 
externalfigure, are difficult to write in Lua - or am I too stupid to find the 
winning combination (sorry for the puns).

3. columns

Again, this would seen like a natural approach, having every A4 page set up as 
two columns, but maybe that’s overkill? 

I’d be curious to know what you think!

All best

Thomas
___
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] Xml - lua - context

2022-03-28 Thread Thomas A. Schmitz via ntg-context
Dear all,

For a small project, I have two questions (without MWE…) on processing xml via 
Lua and context. I’ll write two messages so eager volunteers can reply more 
easily!

So question one: given an xml structure like this

  

  Introduction: the Iliad


  Introduction: the Iliad

  

I want to typeset the section title with some added information. Since I’m 
processing in a loop, I thought this would be easier in Lua, so I have 
something like this:

local i = 0

local sessions = { “April 2”, “April 9”, “April 16” } -- etc.

function xml.functions.section(t)
i = i + 1
local raw_section = xml.text (t, "/sectiontitle")
local section_head = i .. ". session, " .. sessions [i] .. ": " .. 
raw_section
context.startsection { title=section_head }
lxml.flush (t)
context.stopsection ()
end

However, this means that the section_head is serialized as a string and not 
processed according to the xml setups, so I have “the Iliad” in my 
typeset document. How can this be avoided? How can I have the ... 
processed instead of serialized in the section title? 

Thanks for looking at my code!

Thomas
___
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] XML, dealing with whitespace

2022-01-17 Thread Denis Maier via ntg-context
Hi Wolfgang,

Von: Wolfgang Schuster 
Gesendet: Samstag, 15. Januar 2022 20:28
An: mailing list for ConTeXt users ; Denis Maier via 
ntg-context 
Cc: Maier, Denis Christian (UB) 
Betreff: Re: [NTG-context] XML, dealing with whitespace

Denis Maier via ntg-context schrieb am 15.01.2022 um 13:04:

Hi all,

I have sources that look like this:

%


   Bla Bla Bla
   
  
 Bla
  , Bla Bla.

%

Typesetting this with context gives me a spurious space after the underlined 
Bla in italics.

There is no spurious space, the line break is just converted to a space and I 
see no reason why this shouldn't happen. To remove space before or after 
certain parts of text within a paragraph you can use the \removeunwantedspace 
and \ignorespaces commands.

Yes, it's absolutely true. From tex's point of view, the space is not spurious. 
It's absolutely adaquate to treat the newline as a space here.

As I've outlined in my original post the problem occurs because xslt adds these 
indentations here. FWIW, I finally found this solution, which seems has been 
added to xslt 3.0 (after being available as a saxon extension: there's a new 
attribute  on xsl:output that can be used to control this:

(https://www.saxonica.com/documentation9.5/xsl-elements/output.html)

So, the solution to my problem is this:



Denis



 begin example
\starttexdefinition RemovePreceding #1
\removeunwantedspaces
#1
\stoptexdefinition

\starttexdefinition RemoveFollowing #1
#1
\ignorespaces
\stoptexdefinition

\starttext

Bla \RemovePreceding{Bla} Bla

Bla \RemoveFollowing{Bla} Bla

\stoptext
 end example

When only  following spaces are a problem a better alternative to \ignorespace 
is \autoinsertnextspace which checks the following token which ensures there is 
space when the next character is punctuation.

 begin example
\starttexdefinition Italic #1
\emphasized{#1}
\autoinsertnextspace
\stoptexdefinition

\starttexdefinition Underbar #1
\underbar{#1}
\stoptexdefinition

\starttext

Bla Bla Bla

\Underbar{\Italic{Bla} , Bla Bla.}

\stoptext
 end example

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] XML, dealing with whitespace

2022-01-15 Thread Wolfgang Schuster via ntg-context

Denis Maier via ntg-context schrieb am 15.01.2022 um 13:04:


Hi all,

I have sources that look like this:

%





   Bla Bla Bla



  

 Bla

  , Bla Bla.



%

Typesetting this with context gives me a spurious space after the 
underlined Bla in italics.




There is no spurious space, the line break is just converted to a space 
and I see no reason why this shouldn't happen. To remove space before or 
after certain parts of text within a paragraph you can use the 
\removeunwantedspace and \ignorespaces commands.


 begin example
\starttexdefinition RemovePreceding #1
    \removeunwantedspaces
    #1
\stoptexdefinition

\starttexdefinition RemoveFollowing #1
    #1
    \ignorespaces
\stoptexdefinition

\starttext

Bla \RemovePreceding{Bla} Bla

Bla \RemoveFollowing{Bla} Bla

\stoptext
 end example

When only  following spaces are a problem a better alternative to 
\ignorespace is \autoinsertnextspace which checks the following token 
which ensures there is space when the next character is punctuation.


 begin example
\starttexdefinition Italic #1
    \emphasized{#1}
    \autoinsertnextspace
\stoptexdefinition

\starttexdefinition Underbar #1
    \underbar{#1}
\stoptexdefinition

\starttext

Bla Bla Bla

\Underbar{\Italic{Bla} , Bla Bla.}

\stoptext
 end example

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
___


[NTG-context] XML, dealing with whitespace

2022-01-15 Thread Denis Maier via ntg-context
Hi all,

I have sources that look like this:

%


   Bla Bla Bla
   
  
 Bla
  , Bla Bla.

%

Typesetting this with context gives me a spurious space after the underlined 
Bla in italics. Complete MWE :

%
\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{article|p|italic|underline}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

\startxmlsetups xml:article
\starttext
\xmlflush{#1}
\stoptext
\stopxmlsetups

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

\startxmlsetups xml:italic
\emph{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:underline
\underbar{\xmlflush{#1}}
\stopxmlsetups

\startbuffer[test]


   Bla Bla Bla
   
  
 Bla
  , Bla Bla.

\stopbuffer

\xmlprocessbuffer{test}{test}{}
%

How can I get rid off spurious leading and trailing whitespace. I've found 
\xmlstrip and \xmlstripped, but I don't really understand how they work. I've 
also found out about
\ignorespaces\xmlflush{#1}\removeunwantedspaces
but this has then to be added to every definition, which would be a bit 
tedious...
There have a been a couple of similar questions by Hans van der Meer about a 
decade ago, but I couldn't find the answer.

Then, \xmlstripanywhere is also mentioned in xml-mkiv.pdf, but it's not 
explained. I found one example in the sources 
(https://source.contextgarden.net/tex/context/modules/mkiv/x-html.mkiv?search=%5Cxmlstripanywhere#l50),
 but what does that do? Is that sort of need for \xmlstrip and friends to work?

So, what would be the best way to deal with that situation? (More details 
below, perhaps there's an easier solution outside of context, because the 
problem is actually caused by xslt...)

Best,
Denis


P.S. Background:

I convert docx files with pandoc to jats xml. Pandoc does quite a decent job, 
but I need to tweak a few things with xslt. The actual transformation that I 
need works ok, but the transformation also causes other problems.
This is the original markdown file :

%%%
Bla Bla Bla

[*Bla*]{.underline} Bla Bla.
%%%

Pandoc produces a jats xml file that looks like this (simplified, empty nodes 
deleted) :

%%%



Bla Bla Bla
Bla, Bla Bla.


%%%

I use this xsl for tweaking pandoc's output

%%%

http://www.w3.org/1999/XSL/Transform 
xmlns:fo=http://www.w3.org/1999/XSL/Format>







  
 




 
   
 



%%%

This is again much simplified, I've omitted the templates that do the actual 
tweaking.
Anyway, both versions of the identity transformation produce this (using Saxon):

%%%


   
  Bla Bla Bla
  
 
Bla
 , Bla Bla.
   

%%%

I can get rid off all whitespace with indent="no", but that produces a rather 
unreadable file.
xsl:strip-space has had no effect.

Maybe someone knows a solution how to improve that step? Is there a way to 
convince an xslt-processor not to introduce the newlines after certain tags? 
Something like, treat paragraphs as a single unit or so.
Am I missing something?
___
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] xml processing: if elseif else / switch case

2021-12-10 Thread Denis Maier via ntg-context
Well, it was more a question out of curiosity, not a specific problem that 
needs to be solved. (Or actually, I found another solution for the problem I've 
had first.)
Anyway, I still think this would be handy as that would be a more maintainble 
control structure. I'll try to come up with an example next week... 

Denis 

> -Ursprüngliche Nachricht-
> Von: Wolfgang Schuster 
> Gesendet: Donnerstag, 9. Dezember 2021 18:32
> An: mailing list for ConTeXt users ; Denis Maier via ntg-
> context 
> Cc: Maier, Denis Christian (UB) 
> Betreff: Re: [NTG-context] xml processing: if elseif else / switch case
> 
> Denis Maier via ntg-context schrieb am 09.12.2021 um 18:24:
> > Thanks for all the answers. That's helpful. But I think that does not work
> with the xml tests, or does it? I mean, is this a general mechanism?
> 
> Since you didn't provide a example with your problem there is no way to tell
> how to improve it.
> 
> 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] xml processing: if elseif else / switch case

2021-12-09 Thread Wolfgang Schuster via ntg-context

Denis Maier via ntg-context schrieb am 09.12.2021 um 18:24:

Thanks for all the answers. That's helpful. But I think that does not work with 
the xml tests, or does it? I mean, is this a general mechanism?


Since you didn't provide a example with your problem there is no way to 
tell how to improve it.


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] xml processing: if elseif else / switch case

2021-12-09 Thread Denis Maier via ntg-context
Thanks for all the answers. That's helpful. But I think that does not work with 
the xml tests, or does it? I mean, is this a general mechanism?

Denis

Von: ntg-context  im Auftrag von Hans Hagen via 
ntg-context 
Gesendet: Donnerstag, 9. Dezember 2021 17:53:42
An: mailing list for ConTeXt users
Cc: Hans Hagen
Betreff: Re: [NTG-context] xml processing: if elseif else / switch case

On 12/9/2021 5:30 PM, Joey McCollum via ntg-context wrote:
> Thanks for correcting that, Wolfgang. I must have added the other \fi
> instances because I was trying to use \orelse in MKIV and couldn't get
> it to work. Is it only supported in LMTX?
yes, it's one of the native luametatex features (already there for a while)

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
___


Re: [NTG-context] xml processing: if elseif else / switch case

2021-12-09 Thread Hans Hagen via ntg-context

On 12/9/2021 5:30 PM, Joey McCollum via ntg-context wrote:
Thanks for correcting that, Wolfgang. I must have added the other \fi 
instances because I was trying to use \orelse in MKIV and couldn't get 
it to work. Is it only supported in LMTX?

yes, it's one of the native luametatex features (already there for a while)

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] xml processing: if elseif else / switch case

2021-12-09 Thread Joey McCollum via ntg-context
Thanks for correcting that, Wolfgang. I must have added the other \fi
instances because I was trying to use \orelse in MKIV and couldn't get it
to work. Is it only supported in LMTX?

Joey

On Thu, Dec 9, 2021 at 11:30 AM Hans Hagen via ntg-context <
ntg-context@ntg.nl> wrote:

> On 12/9/2021 5:11 PM, Wolfgang Schuster via ntg-context wrote:
> > Joey McCollum via ntg-context schrieb am 09.12.2021 um 15:08:
> >> I believe \orelse might be what you want. It works with most \if...
> >> macros, and it avoids nesting of \doifelse constructs. Here's an
> >> example, which I use in conditionally removing preceding punctuation
> >> if any other keys are defined before a specific one in an assignment:
> >>
> >> ```
> >>   % If any of the preceding keys was specified, then replace any
> >> preceding punctuation with a space
> >> % and typeset the number with its CSL abbreviation, followed by a
> >> comma
> >>   \ifdefined\btxsbllocvol
> >> \removeunwantedspaces\removepunctuation\btxspace
> >> \orelse\ifdefined\btxsbllocno
> >> \removeunwantedspaces\removepunctuation\btxspace
> >>   \fi
> >> \orelse\ifdefined\btxsbllocpt
> >>   [...]
> >>   \fi
> >> ```
> >
> > The \fi at the end of each \orelse branch is wrong.
> >
> > \ifdefined\btxsbllocvol
> >  ...
> > \orelse\ifdefined\btxsbllocno
> >  ...
> > \else
> >  ...
> > \fi
> and when 'string' comparison is needed one can do:
>
> \starttext
>
> \def\foo{foo}
> \def\ofo{ofo}
> \def\oof{oof}
>
> \def\XXX{ofo}
>
> \ifcstok\XXX\foo
>  FOO
> \orelse\ifcstok\XXX\ofo
>  OFO
> \orelse\ifcstok\XXX\oof
>  OOF
> \else
>  XXX
> \fi
>
> \def\XXX{\ofo}
>
> \iftok{\XXX}{\foo}%
>  FOO
> \orelse\iftok{\XXX}{\ofo}%
>  OFO
> \orelse\iftok{\XXX}{\oof}%
>  OOF
> \else
>  XXX
> \fi
>
> \ifcstok{\XXX}\foo
>  FOO
> \orelse\ifcstok{\XXX}\ofo
>  OFO
> \orelse\ifcstok\XXX}\oof
>  OOF
> \else
>  XXX
> \fi
>
> \stoptext
>
> watch the subtle differences. It all makes coding in tex primitives a
> bit more visual appealing and readable. Oone of the objectives of lmtx
> is that users can read the context code without pondering too much about
> the syntax or getting depressed by possibly obscure helper macros and
> expansion trickery.
>
> 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
___


Re: [NTG-context] xml processing: if elseif else / switch case

2021-12-09 Thread Hans Hagen via ntg-context

On 12/9/2021 5:11 PM, Wolfgang Schuster via ntg-context wrote:

Joey McCollum via ntg-context schrieb am 09.12.2021 um 15:08:
I believe \orelse might be what you want. It works with most \if... 
macros, and it avoids nesting of \doifelse constructs. Here's an 
example, which I use in conditionally removing preceding punctuation 
if any other keys are defined before a specific one in an assignment:


```
      % If any of the preceding keys was specified, then replace any 
preceding punctuation with a space
    % and typeset the number with its CSL abbreviation, followed by a 
comma

      \ifdefined\btxsbllocvol
\removeunwantedspaces\removepunctuation\btxspace
\orelse\ifdefined\btxsbllocno
\removeunwantedspaces\removepunctuation\btxspace
      \fi
\orelse\ifdefined\btxsbllocpt
      [...]
      \fi
```


The \fi at the end of each \orelse branch is wrong.

\ifdefined\btxsbllocvol
     ...
\orelse\ifdefined\btxsbllocno
     ...
\else
     ...
\fi

and when 'string' comparison is needed one can do:

\starttext

\def\foo{foo}
\def\ofo{ofo}
\def\oof{oof}

\def\XXX{ofo}

\ifcstok\XXX\foo
FOO
\orelse\ifcstok\XXX\ofo
OFO
\orelse\ifcstok\XXX\oof
OOF
\else
XXX
\fi

\def\XXX{\ofo}

\iftok{\XXX}{\foo}%
FOO
\orelse\iftok{\XXX}{\ofo}%
OFO
\orelse\iftok{\XXX}{\oof}%
OOF
\else
XXX
\fi

\ifcstok{\XXX}\foo
FOO
\orelse\ifcstok{\XXX}\ofo
OFO
\orelse\ifcstok\XXX}\oof
OOF
\else
XXX
\fi

\stoptext

watch the subtle differences. It all makes coding in tex primitives a 
bit more visual appealing and readable. Oone of the objectives of lmtx 
is that users can read the context code without pondering too much about 
the syntax or getting depressed by possibly obscure helper macros and 
expansion trickery.


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] xml processing: if elseif else / switch case

2021-12-09 Thread Wolfgang Schuster via ntg-context

Joey McCollum via ntg-context schrieb am 09.12.2021 um 15:08:
I believe \orelse might be what you want. It works with most \if... 
macros, and it avoids nesting of \doifelse constructs. Here's an 
example, which I use in conditionally removing preceding punctuation 
if any other keys are defined before a specific one in an assignment:


```
      % If any of the preceding keys was specified, then replace any 
preceding punctuation with a space
    % and typeset the number with its CSL abbreviation, followed by a 
comma

      \ifdefined\btxsbllocvol
\removeunwantedspaces\removepunctuation\btxspace
\orelse\ifdefined\btxsbllocno
\removeunwantedspaces\removepunctuation\btxspace
      \fi
\orelse\ifdefined\btxsbllocpt
      [...]
      \fi
```


The \fi at the end of each \orelse branch is wrong.

\ifdefined\btxsbllocvol
    ...
\orelse\ifdefined\btxsbllocno
    ...
\else
    ...
\fi

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] xml processing: if elseif else / switch case

2021-12-09 Thread Joey McCollum via ntg-context
I believe \orelse might be what you want. It works with most \if... macros,
and it avoids nesting of \doifelse constructs. Here's an example, which I
use in conditionally removing preceding punctuation if any other keys are
defined before a specific one in an assignment:

```
  % If any of the preceding keys was specified, then replace any
preceding punctuation with a space
  % and typeset the number with its CSL abbreviation, followed by a
comma
  \ifdefined\btxsbllocvol
\removeunwantedspaces\removepunctuation\btxspace
  \orelse\ifdefined\btxsbllocno
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocpt
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocp
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocn
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocfig
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocop
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocbk
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocep
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocchap
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocv
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocfol
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocfrag
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocpl
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsblloccol
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocl
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocsv
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocsec
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \fi
```

Joey

On Thu, Dec 9, 2021, 3:19 AM Denis Maier via ntg-context 
wrote:

> Hi,
>
>
>
> I was wondering whether we have tests similar to «if-else if-else» or
> «switch case» in context’s xml processing. (And even in context more
> general...) I have found these doifelse tests, but elseif doesn’t seem to
> exist. Is that correct? If yes, could that be added? Of course, you can
> always just nest doifelse-constructs, but that will become ugly quickly.
> Being able to specify multiple branches would be handy.
>
>
>
> 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] xml processing: if elseif else / switch case

2021-12-09 Thread Denis Maier via ntg-context
Hi,

I was wondering whether we have tests similar to  or  in context's xml processing. (And even in context more general...) I have 
found these doifelse tests, but elseif doesn't seem to exist. Is that correct? 
If yes, could that be added? Of course, you can always just nest 
doifelse-constructs, but that will become ugly quickly. Being able to specify 
multiple branches would be handy.

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
___


Re: [NTG-context] xml processing errors after latest upgrade

2021-12-01 Thread Thangalin via ntg-context
Confirmed that the following worked:

   1. Run: rm -rf /tmp/luatex-cache/   (your cache directory location will
   differ)
   2. Edit ./tex/texmf-context/tex/context/base/mkiv/scrn-ref.lua
   3. Replace line 15 to assign the empty function as Hans indicated
   4. Save the file
   5. Run: ./bin/mtxrun --generate
   6. Run: ./tex/texmf-linux-64/bin/context --make

Typesetting XML succeeds again.
___
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] xml processing errors after latest upgrade

2021-12-01 Thread Pablo Rodriguez via ntg-context
On 12/1/21 2:03 PM, Denis Maier via ntg-context wrote:
> Sorry for spamming the list, but I was able to narrow it further down:
> [...]
> \setupinteraction
>   [state=start,
>openaction=FitWidth] % comment this out to make it work
> [...]
> Can anyone confirm this?

Hi Denis,

I can confirm the issue. I get the following error message:

registered function call [929]:
...ext/tex/texmf-context/tex/context/base/mkiv/scrn-ref.lua:31: attempt
to call a nil value (upvalue 'expandcurrent')
stack traceback:
...ext/tex/texmf-context/tex/context/base/mkiv/scrn-ref.lua:31: in
function <...ext/tex/texmf-context/tex/context/base/mkiv/scrn-ref.lua:27>
(...tail calls...)

I hope it helps,

Pablo
___
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] xml processing errors after latest upgrade

2021-12-01 Thread Hans Hagen via ntg-context

On 12/1/2021 2:03 PM, denis.ma...@unibe.ch wrote:

Sorry for spamming the list, but I was able to narrow it further down:

%
\setupinteraction
[
state=start,
openaction=FitWidth, % comment this out to make it work
]

\starttext

asdf

\stoptext
%

Can anyone confirm this?



-Ursprüngliche Nachricht-
Von: ntg-context  Im Auftrag von Denis Maier
via ntg-context
Gesendet: Mittwoch, 1. Dezember 2021 11:44
An: j.ha...@xs4all.nl; ntg-context@ntg.nl
Cc: Maier, Denis Christian (UB) 
Betreff: Re: [NTG-context] xml processing errors after latest upgrade

Ok, seems unrelated to XML.

This here shows the problem:


% no problems withouth setupinteraction
\setupinteraction [
state=start,
focus=standard,
openaction=FitWidth,
color=,
contrastcolor=,
style=,
]

\starttext

asdf

\stoptext


you can patch this in scrn-ref.lua (and remakle the format)

local expandcurrent = structures.references.expandcurrent or function() end



-
  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] xml processing errors after latest upgrade

2021-12-01 Thread Denis Maier via ntg-context
Sorry for spamming the list, but I was able to narrow it further down:

%
\setupinteraction 
[
state=start,
openaction=FitWidth, % comment this out to make it work
]

\starttext

asdf

\stoptext
%

Can anyone confirm this?


> -Ursprüngliche Nachricht-
> Von: ntg-context  Im Auftrag von Denis Maier
> via ntg-context
> Gesendet: Mittwoch, 1. Dezember 2021 11:44
> An: j.ha...@xs4all.nl; ntg-context@ntg.nl
> Cc: Maier, Denis Christian (UB) 
> Betreff: Re: [NTG-context] xml processing errors after latest upgrade
> 
> Ok, seems unrelated to XML.
> 
> This here shows the problem:
> 
> 
> % no problems withouth setupinteraction
> \setupinteraction [
>   state=start,
>   focus=standard,
>   openaction=FitWidth,
>   color=,
>   contrastcolor=,
>   style=,
>   ]
> 
> \starttext
> 
> asdf
> 
> \stoptext
> 
> 
> Best,
> Denis
> 
> > -Ursprüngliche Nachricht-
> > Von: Hans Hagen 
> > Gesendet: Mittwoch, 1. Dezember 2021 10:52
> > An: mailing list for ConTeXt users 
> > Cc: Maier, Denis Christian (UB) 
> > Betreff: Re: [NTG-context] xml processing errors after latest upgrade
> >
> > On 12/1/2021 10:41 AM, Denis Maier via ntg-context wrote:
> >
> > > Not sure what is going wrong. Any hints how I can start debugging?
> > > Any ideas what could have caused that change?
> > >
> > > (Ok, let’s build a MWE..)
> > a mix of old / new files?
> >
> >
> > -
> >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
___


Re: [NTG-context] xml processing errors after latest upgrade

2021-12-01 Thread Denis Maier via ntg-context
Another problem. Maybe that's related?

Running the file with the --luatex flag gives me this error message:

tx-context | redirect luametatex -> luatex: luatex --luaonly 
"C:/context/tex/texmf-win64/bin/mtxrun.lua" --script mtx-context --luatex debug 
--redirected
mtxrun  | unknown script 'mtx-context.lua' or 'mtx-mtx-context.lua'

Denis

> -Ursprüngliche Nachricht-
> Von: ntg-context  Im Auftrag von Denis Maier
> via ntg-context
> Gesendet: Mittwoch, 1. Dezember 2021 11:44
> An: j.ha...@xs4all.nl; ntg-context@ntg.nl
> Cc: Maier, Denis Christian (UB) 
> Betreff: Re: [NTG-context] xml processing errors after latest upgrade
> 
> Ok, seems unrelated to XML.
> 
> This here shows the problem:
> 
> 
> % no problems withouth setupinteraction
> \setupinteraction [
>   state=start,
>   focus=standard,
>   openaction=FitWidth,
>   color=,
>   contrastcolor=,
>   style=,
>   ]
> 
> \starttext
> 
> asdf
> 
> \stoptext
> 
> 
> Best,
> Denis
> 
> > -Ursprüngliche Nachricht-
> > Von: Hans Hagen 
> > Gesendet: Mittwoch, 1. Dezember 2021 10:52
> > An: mailing list for ConTeXt users 
> > Cc: Maier, Denis Christian (UB) 
> > Betreff: Re: [NTG-context] xml processing errors after latest upgrade
> >
> > On 12/1/2021 10:41 AM, Denis Maier via ntg-context wrote:
> >
> > > Not sure what is going wrong. Any hints how I can start debugging?
> > > Any ideas what could have caused that change?
> > >
> > > (Ok, let’s build a MWE..)
> > a mix of old / new files?
> >
> >
> > -
> >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
___


Re: [NTG-context] xml processing errors after latest upgrade

2021-12-01 Thread Denis Maier via ntg-context
Ok, seems unrelated to XML.

This here shows the problem:


% no problems withouth setupinteraction
\setupinteraction [
state=start,
focus=standard,
openaction=FitWidth,
color=,
contrastcolor=,
style=,
]

\starttext

asdf

\stoptext


Best,
Denis

> -Ursprüngliche Nachricht-
> Von: Hans Hagen 
> Gesendet: Mittwoch, 1. Dezember 2021 10:52
> An: mailing list for ConTeXt users 
> Cc: Maier, Denis Christian (UB) 
> Betreff: Re: [NTG-context] xml processing errors after latest upgrade
> 
> On 12/1/2021 10:41 AM, Denis Maier via ntg-context wrote:
> 
> > Not sure what is going wrong. Any hints how I can start debugging? Any
> > ideas what could have caused that change?
> >
> > (Ok, let’s build a MWE..)
> a mix of old / new files?
> 
> 
> -
>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] xml processing errors after latest upgrade

2021-12-01 Thread Denis Maier via ntg-context
Still the same error.

> -Ursprüngliche Nachricht-
> Von: Maier, Denis Christian (UB)
> Gesendet: Mittwoch, 1. Dezember 2021 11:02
> An: 'Hans Hagen' ; 'mailing list for ConTeXt users'  cont...@ntg.nl>
> Betreff: AW: [NTG-context] xml processing errors after latest upgrade
> 
> Trying a fresh installation.
> 
> > -Ursprüngliche Nachricht-
> > Von: Maier, Denis Christian (UB)
> > Gesendet: Mittwoch, 1. Dezember 2021 10:59
> > An: 'Hans Hagen' ; mailing list for ConTeXt users
> > 
> > Betreff: AW: [NTG-context] xml processing errors after latest upgrade
> >
> > You mean a problem with the update?
> >
> > I've wiped the cache and ran
> > mtxrun --generate
> > context --make
> >
> > But, no change.
> >
> > Denis
> >
> > > -Ursprüngliche Nachricht-
> > > Von: Hans Hagen 
> > > Gesendet: Mittwoch, 1. Dezember 2021 10:52
> > > An: mailing list for ConTeXt users 
> > > Cc: Maier, Denis Christian (UB) 
> > > Betreff: Re: [NTG-context] xml processing errors after latest
> > > upgrade
> > >
> > > On 12/1/2021 10:41 AM, Denis Maier via ntg-context wrote:
> > >
> > > > Not sure what is going wrong. Any hints how I can start debugging?
> > > > Any ideas what could have caused that change?
> > > >
> > > > (Ok, let’s build a MWE..)
> > > a mix of old / new files?
> > >
> > >
> > > -
> > >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] xml processing errors after latest upgrade

2021-12-01 Thread Denis Maier via ntg-context
Trying a fresh installation.

> -Ursprüngliche Nachricht-
> Von: Maier, Denis Christian (UB)
> Gesendet: Mittwoch, 1. Dezember 2021 10:59
> An: 'Hans Hagen' ; mailing list for ConTeXt users  cont...@ntg.nl>
> Betreff: AW: [NTG-context] xml processing errors after latest upgrade
> 
> You mean a problem with the update?
> 
> I've wiped the cache and ran
> mtxrun --generate
> context --make
> 
> But, no change.
> 
> Denis
> 
> > -Ursprüngliche Nachricht-
> > Von: Hans Hagen 
> > Gesendet: Mittwoch, 1. Dezember 2021 10:52
> > An: mailing list for ConTeXt users 
> > Cc: Maier, Denis Christian (UB) 
> > Betreff: Re: [NTG-context] xml processing errors after latest upgrade
> >
> > On 12/1/2021 10:41 AM, Denis Maier via ntg-context wrote:
> >
> > > Not sure what is going wrong. Any hints how I can start debugging?
> > > Any ideas what could have caused that change?
> > >
> > > (Ok, let’s build a MWE..)
> > a mix of old / new files?
> >
> >
> > -
> >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] xml processing errors after latest upgrade

2021-12-01 Thread Denis Maier via ntg-context
You mean a problem with the update?

I've wiped the cache and ran 
mtxrun --generate
context --make

But, no change.

Denis

> -Ursprüngliche Nachricht-
> Von: Hans Hagen 
> Gesendet: Mittwoch, 1. Dezember 2021 10:52
> An: mailing list for ConTeXt users 
> Cc: Maier, Denis Christian (UB) 
> Betreff: Re: [NTG-context] xml processing errors after latest upgrade
> 
> On 12/1/2021 10:41 AM, Denis Maier via ntg-context wrote:
> 
> > Not sure what is going wrong. Any hints how I can start debugging? Any
> > ideas what could have caused that change?
> >
> > (Ok, let’s build a MWE..)
> a mix of old / new files?
> 
> 
> -
>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] xml processing errors after latest upgrade

2021-12-01 Thread Hans Hagen via ntg-context

On 12/1/2021 10:41 AM, Denis Maier via ntg-context wrote:

Not sure what is going wrong. Any hints how I can start debugging? Any 
ideas what could have caused that change?


(Ok, let’s build a MWE..)

a mix of old / new files?


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


[NTG-context] xml processing errors after latest upgrade

2021-12-01 Thread Denis Maier via ntg-context
Hi,

the latest update may have introduced problems for xml processing :

For a document I could convert with version 2021.10.24 21:45 without problems 
gives me now this error :

%
...
structure   > sectioning > title @ level 2 : 0.0 -> \documentvariable 
{title}
fatal lua error:

registered function call [929]: 
...ext/tex/texmf-context/tex/context/base/mkiv/scrn-ref.lua:31: attempt to call 
a nil value (upvalue 'expandcurrent')
stack traceback:
...ext/tex/texmf-context/tex/context/base/mkiv/scrn-ref.lua:31: in 
function <...ext/tex/texmf-context/tex/context/base/mkiv/scrn-ref.lua:27>
(...tail calls...)

mtx-context | fatal error: return code: 1
%

Not sure what is going wrong. Any hints how I can start debugging? Any ideas 
what could have caused that change?

(Ok, let's build a MWE..)

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
___


Re: [NTG-context] XML-processing: Error with hyphenatedurl

2021-10-27 Thread Hans Hagen via ntg-context

On 10/27/2021 5:37 PM, Denis Maier via ntg-context wrote:


Oh, actually that leads to a similar problem as in my original question where 
Wolfgang suggested using \expandUx: if the URL is broken across lines, the link 
content is also broken. Interestingly, the plain

\startxmlsetups xml:ext-link-var-var
\goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]
\stopxmlsetups

seems to work now correctly.
it depends abit on what gets flushed, in those cases a low level flush 
has to be used


\xmltext
\xmltextonly
\xmlraw

to get the raw data .. depends on content

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] XML-processing: Error with hyphenatedurl

2021-10-27 Thread Pablo Rodriguez via ntg-context
On 10/27/21 5:37 PM, Denis Maier via ntg-context wrote:
> [...]
> Oh, actually that leads to a similar problem as in my original
> question where Wolfgang suggested using \expandUx: if the URL is
> broken across lines, the link content is also broken. Interestingly,
> the plain>
> \startxmlsetups xml:ext-link-var-var
>   \goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]
> \stopxmlsetups
>
> seems to work now correctly.

Sorry, it was the wrong order:

\expanded{\goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]}

\xmlpure is for \hyphenatedurl, not for url.

But your plain \goto is what I use and I have been using it without
problems for long.

Pablo
--
http://www.ousia.tk
___
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] XML-processing: Error with hyphenatedurl

2021-10-27 Thread Denis Maier via ntg-context
> -Ursprüngliche Nachricht-
> Von: Maier, Denis Christian (UB)
> Gesendet: Mittwoch, 27. Oktober 2021 16:31
> An: 'mailing list for ConTeXt users' 
> Cc: Pablo Rodriguez 
> Betreff: AW: [NTG-context] XML-processing: Error with hyphenatedurl
> 
> > -Ursprüngliche Nachricht-
> > Von: ntg-context  Im Auftrag von Pablo
> > Rodriguez via ntg-context
> > Gesendet: Mittwoch, 27. Oktober 2021 15:43
> > An: Denis Maier via ntg-context 
> > Cc: Pablo Rodriguez 
> > Betreff: Re: [NTG-context] XML-processing: Error with hyphenatedurl
> >
> > On 10/27/21 3:03 PM, Denis Maier via ntg-context wrote:
> > > [...]
> > > I’ve receiving errors that seem to be related to hyphenatedurl. The
> > > problem is I cannot really reproduce it in a MWE. The example below
> > > works, but if I include the link in my real document, I’am getting
> > > this error message (copied from -error.log):
> > > [...]
> > > Two things seemed to make it work:
> > > 1. Remove the link.
> > > 2. Comment out \expandUx in this setup:
> >
> > Hi Denis,
> >
> > in my environments to typeset XML sources, I never need \expandUx, why
> > do you needit?
> 
> I've had a problem with special characters in URLs. Wolfgang suggested to use
> \expandUx: https://www.mail-archive.com/ntg-context@ntg.nl/msg95959.html
> 
> 
> >
> > Another approach (I don’t know whether this will work in your
> > real-world
> > document) might be using \xmlpure instead of \xmlflush as in:
> >
> >   \goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlpure{#1})]
> 
> That works. Thank  you.

Oh, actually that leads to a similar problem as in my original question where 
Wolfgang suggested using \expandUx: if the URL is broken across lines, the link 
content is also broken. Interestingly, the plain

\startxmlsetups xml:ext-link-var-var
\goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]
\stopxmlsetups

seems to work now correctly.

Best,
Denis

%%%
\setuppapersize[A6]
\setupinteraction[state=start]

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{article|ext-link|ext-link-var|ext-link-var-var}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

\startxmlsetups xml:article
\starttext
\xmlflush{#1}
\stoptext
\stopxmlsetups

\startxmlsetups xml:ext-link
\begingroup
\expandUx 

\expanded{\goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]}
\endgroup
\stopxmlsetups

\startxmlsetups xml:ext-link-var
\goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlpure{#1})]
\stopxmlsetups

\startxmlsetups xml:ext-link-var-var
\goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]
\stopxmlsetups


\startbuffer[test]



asdfasdf asdkflöasj asdf
https://wiki.contextgarden.net/Main_Page

asdfasdf asdkflöasj asdf
https://wiki.contextgarden.net/Main_Page

asdfasdf asdkflöasj asdf
https://wiki.contextgarden.net/Main_Page

\stopbuffer

\xmlprocessbuffer{test}{test}{}
%%%




___
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] XML-processing: Error with hyphenatedurl

2021-10-27 Thread Denis Maier via ntg-context
> -Ursprüngliche Nachricht-
> Von: ntg-context  Im Auftrag von Pablo
> Rodriguez via ntg-context
> Gesendet: Mittwoch, 27. Oktober 2021 15:43
> An: Denis Maier via ntg-context 
> Cc: Pablo Rodriguez 
> Betreff: Re: [NTG-context] XML-processing: Error with hyphenatedurl
> 
> On 10/27/21 3:03 PM, Denis Maier via ntg-context wrote:
> > [...]
> > I’ve receiving errors that seem to be related to hyphenatedurl. The
> > problem is I cannot really reproduce it in a MWE. The example below
> > works, but if I include the link in my real document, I’am getting
> > this error message (copied from -error.log):
> > [...]
> > Two things seemed to make it work:
> > 1. Remove the link.
> > 2. Comment out \expandUx in this setup:
> 
> Hi Denis,
> 
> in my environments to typeset XML sources, I never need \expandUx, why do
> you needit?

I've had a problem with special characters in URLs. Wolfgang suggested to use 
\expandUx: https://www.mail-archive.com/ntg-context@ntg.nl/msg95959.html


> 
> Another approach (I don’t know whether this will work in your real-world
> document) might be using \xmlpure instead of \xmlflush as in:
> 
>   \goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlpure{#1})]

That works. Thank  you.

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] XML-processing: Error with hyphenatedurl

2021-10-27 Thread Pablo Rodriguez via ntg-context
On 10/27/21 3:03 PM, Denis Maier via ntg-context wrote:
> [...]
> I’ve receiving errors that seem to be related to hyphenatedurl. The
> problem is I cannot really reproduce it in a MWE. The example below
> works, but if I include the link in my real document, I’am getting this
> error message (copied from -error.log):
> [...]
> Two things seemed to make it work:
> 1. Remove the link.
> 2. Comment out \expandUx in this setup:

Hi Denis,

in my environments to typeset XML sources, I never need \expandUx, why
do you needit?

Another approach (I don’t know whether this will work in your real-world
document) might be using \xmlpure instead of \xmlflush as in:

  \goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlpure{#1})]

The background for both commands can be found on
https://www.pragma-ade.com/general/manuals/xml-mkiv.pdf#page=103.

I hope it helps,

Pablo
--
http://www.ousia.tk
___
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] XML-processing: Error with hyphenatedurl

2021-10-27 Thread Denis Maier via ntg-context
Hi,

I've receiving errors that seem to be related to hyphenatedurl. The problem is 
I cannot really reproduce it in a MWE. The example below works, but if I 
include the link in my real document, I'am getting this error message (copied 
from -error.log):

%
return {
["errortype"]=1,
["filename"]="",
["lastcontext"]="\n \n\n\\xdef \n 
\\expanded \n#1->\\xdef \n
\\m_syst_helpers_expanded {\\noexpand 
#1}\\m_syst_helpers_expanded \n 
\\22>:xml:ext-link \n
#1->\\begingroup \\expandUx 
\\expanded \n{\\goto {\\hyphenatedurl {\\xmlflush 
{#1}}}[url(\\xmlflush {#1})]}\\endgroup \n 
\n \\22>:xml:p \n
#1->\\begingroup \\xmlfilter 
{#1}{.[@xml:lang]/command(xml:language)}\\xmlflush {#1}\n
\\endgroup \\par \n \n 
...\n\n \n\n\n",
["lastluaerror"]="",
["lasttexerror"]="Missing number, treated as zero",
["lasttexhelp"]="A number should have been here; I inserted '0'. (If you can't 
figure out why I\nneeded to see a number, look up 'weird error' in the index to 
The TeXbook.)",
["linenumber"]=9,
["offset"]=10,
["skiplinenumber"]=5,
}


Two things seemed to make it work:
1. Remove the link.
2. Comment out \expandUx in this setup:


\startxmlsetups xml:ext-link
\begingroup
\expandUx % commenting this out makes it work
   
\expanded{\goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]}
\endgroup
\stopxmlsetups



Best,
Denis



\setupinteraction[state=start]

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{article|ext-link}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

\startxmlsetups xml:article
\starttext
\xmlflush{#1}
\stoptext
\stopxmlsetups

\startxmlsetups xml:ext-link
\begingroup
\expandUx
   
\expanded{\goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlflush{#1})]}
\endgroup
\stopxmlsetups

\startbuffer[test]



asdf

asdf


\stopbuffer

\xmlprocessbuffer{test}{test}{}
%%

___
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] xml processing in latest

2021-04-21 Thread Thomas A. Schmitz


On 4/21/21 10:34 AM, denis.ma...@ub.unibe.ch wrote:

Hi

What's the exact issue?



You're not using the latest version:

2021.04.20 18:45

Thomas
___
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] xml processing in latest

2021-04-21 Thread denis.maier
Ah, now I see
ConTeXt  ver: 2021.04.20 18:45 LMTX  fmt: 2021.4.21  int: english/english
gives me the attached result.

Denis

> -Ursprüngliche Nachricht-
> Von: Maier, Denis Christian (UB)
> Gesendet: Mittwoch, 21. April 2021 10:34
> An: ntg-context@ntg.nl
> Betreff: AW: [NTG-context] xml processing in latest
> 
> Hi
> 
> What's the exact issue?
> 
> I get the same results on my TeXLive version and on the latext lmtx:
> ConTeXt  ver: 2020.01.26 18:34 MKIV beta  fmt: 2020.10.2  int: english/english
> ConTeXt  ver: 2021.04.18 18:12 LMTX  fmt: 2021.4.20  int: english/english
> 
> And even with --luatex
> ConTeXt  ver: 2021.04.18 18:12 MKIV  fmt: 2021.4.21  int: english/english
> 
> Always the result as attached.
> 
> Denis
> 
> 
> > -Ursprüngliche Nachricht-
> > Von: ntg-context  Im Auftrag von Thomas
> A.
> > Schmitz
> > Gesendet: Mittwoch, 21. April 2021 08:45
> > An: ntg-context@ntg.nl
> > Betreff: [NTG-context] xml processing in latest
> >
> >
> > Hi all,
> >
> > the latest has some strange problems with xml processing. The example
> > below shows an issue with itemize. In my real file, I also get pages
> > that are filled only two thirds and rugged right instead of justified,
> > but I haven't been able to reproduce this in a MWE. Maybe this one can
> > give a start; I assume it's some fundamental typo somewhere.
> >
> > All best
> >
> > Thomas
> >
> > \startbuffer[test]
> > 
> >test
> > 
> > 
> > one
> > 
> > 
> > two
> > 
> > 
> > 
> > \stopbuffer
> >
> > \startxmlsetups xml:testsetups
> >  \xmlsetsetup{#1}{*}{-}
> > \xmlsetsetup{#1}{document|p|numbered|item}{xml:*}
> > \stopxmlsetups
> >
> > \xmlregistersetup{xml:testsetups}
> >
> > \startxmlsetups xml:document
> > \xmlflush{#1}
> > \stopxmlsetups
> >
> > \startxmlsetups xml:p
> > \xmlflush{#1} \par
> > \stopxmlsetups
> >
> > \startxmlsetups xml:numbered
> > \startitemize [n]
> > \xmlflush{#1}
> > \stopitemize
> > \stopxmlsetups
> >
> > \startxmlsetups xml:item
> > \startitem
> > \xmlflush{#1}
> > \stopitem
> > \stopxmlsetups
> >
> > \starttext
> > \xmlprocessbuffer{main}{test}{}
> > \stoptext
> >
> __
> > _
> > 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
> >
> __
> > _


test.pdf
Description: test.pdf
___
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] xml processing in latest

2021-04-21 Thread denis.maier
Hi

What's the exact issue? 

I get the same results on my TeXLive version and on the latext lmtx:
ConTeXt  ver: 2020.01.26 18:34 MKIV beta  fmt: 2020.10.2  int: english/english
ConTeXt  ver: 2021.04.18 18:12 LMTX  fmt: 2021.4.20  int: english/english

And even with --luatex
ConTeXt  ver: 2021.04.18 18:12 MKIV  fmt: 2021.4.21  int: english/english

Always the result as attached.

Denis


> -Ursprüngliche Nachricht-
> Von: ntg-context  Im Auftrag von Thomas A.
> Schmitz
> Gesendet: Mittwoch, 21. April 2021 08:45
> An: ntg-context@ntg.nl
> Betreff: [NTG-context] xml processing in latest
> 
> 
> Hi all,
> 
> the latest has some strange problems with xml processing. The example
> below shows an issue with itemize. In my real file, I also get pages that are
> filled only two thirds and rugged right instead of justified, but I haven't 
> been
> able to reproduce this in a MWE. Maybe this one can give a start; I assume 
> it's
> some fundamental typo somewhere.
> 
> All best
> 
> Thomas
> 
> \startbuffer[test]
> 
>test
>   
>   
>   one
>   
>   
>   two
>   
>   
> 
> \stopbuffer
> 
> \startxmlsetups xml:testsetups
>  \xmlsetsetup{#1}{*}{-}
>   \xmlsetsetup{#1}{document|p|numbered|item}{xml:*}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:testsetups}
> 
> \startxmlsetups xml:document
>   \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:p
>   \xmlflush{#1} \par
> \stopxmlsetups
> 
> \startxmlsetups xml:numbered
>   \startitemize [n]
>   \xmlflush{#1}
>   \stopitemize
> \stopxmlsetups
> 
> \startxmlsetups xml:item
>   \startitem
>   \xmlflush{#1}
>   \stopitem
> \stopxmlsetups
> 
> \starttext
>   \xmlprocessbuffer{main}{test}{}
> \stoptext
> __
> _
> 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
> __
> _


test.pdf
Description: test.pdf
___
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] xml processing in latest

2021-04-21 Thread Thomas A. Schmitz


Hi all,

the latest has some strange problems with xml processing. The example 
below shows an issue with itemize. In my real file, I also get pages 
that are filled only two thirds and rugged right instead of justified, 
but I haven't been able to reproduce this in a MWE. Maybe this one can 
give a start; I assume it's some fundamental typo somewhere.


All best

Thomas

\startbuffer[test]

  test


one


two



\stopbuffer

\startxmlsetups xml:testsetups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|p|numbered|item}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
\xmlflush{#1}
\stopxmlsetups

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

\startxmlsetups xml:numbered
\startitemize [n]
\xmlflush{#1}
\stopitemize
\stopxmlsetups

\startxmlsetups xml:item
\startitem
\xmlflush{#1}
\stopitem
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext
___
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] XML/MathML namespace handling bug

2021-03-26 Thread Hans Hagen

On 3/26/2021 6:02 AM, Hugo Landau wrote:

in x-math.mkiv search for

\startxmlsetups mml:apply

and replace this bit:

 \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
 \doifelsesetups {mml:apply:mml:\mmlapplyaction} {
 \xmlsetup{#1}{mml:apply:mml:\mmlapplyaction}
  } {
 \xmlsetup{#1}{mml:\mmlapplyaction}
  }

(btw, isn't content mathml more fun than presentation mathml?)

Works nicely. For  I also had to change this part from name() to
tag():

\startxmlsetups mml:relation
 \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
 \MMLcreset 
\xmlsetup{#1}{mml:relation:\xmlattdef{#1}{align}{\MMLrelationalign}}
\stopxmlsetups

can you also check

\startxmlsetups mml:apply:inverse
\settrue\xmlinversefunction
\xmlsetup{#1}{mml:\xmlfilter{#1}{/mml:apply/*[2]/tag()}}
\stopxmlsetups


-
  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] XML/MathML namespace handling bug

2021-03-25 Thread Hugo Landau
> in x-math.mkiv search for
> 
>\startxmlsetups mml:apply
> 
> and replace this bit:
> 
> \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
> \doifelsesetups {mml:apply:mml:\mmlapplyaction} {
> \xmlsetup{#1}{mml:apply:mml:\mmlapplyaction}
>  } {
> \xmlsetup{#1}{mml:\mmlapplyaction}
>  }
> 
> (btw, isn't content mathml more fun than presentation mathml?)
Works nicely. For  I also had to change this part from name() to
tag():

\startxmlsetups mml:relation
\edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
\MMLcreset 
\xmlsetup{#1}{mml:relation:\xmlattdef{#1}{align}{\MMLrelationalign}}
\stopxmlsetups
___
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] XML/MathML namespace handling bug

2021-03-20 Thread Hans Hagen

On 3/20/2021 10:52 PM, Hugo Landau wrote:

Thanks for ConTeXt, it is an amazing system.

The following test case demonstrates the bug.

   \usemodule[mathml]
   \starttext
   \xmlprocessdata{}{
   
   http://www.example.com/ns/foo; 
xmlns:m="http://www.w3.org/1998/Math/MathML;>
   
 ab
   
   
 ab
   
   
   }{}
   \stoptext

No output is produced. This has been verified with live.contextgarden.net.

In order for output to be produced,  must be changed to  and
 must be changed to , but these are in the wrong
namespace in this context. In other words, this bug applies to the keyword
element in an apply element.

in x-math.mkiv search for

   \startxmlsetups mml:apply

and replace this bit:

\edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}}
\doifelsesetups {mml:apply:mml:\mmlapplyaction} {
\xmlsetup{#1}{mml:apply:mml:\mmlapplyaction}
 } {
\xmlsetup{#1}{mml:\mmlapplyaction}
 }

(btw, isn't content mathml more fun than presentation mathml?)

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
___


[NTG-context] XML/MathML namespace handling bug

2021-03-20 Thread Hugo Landau
Thanks for ConTeXt, it is an amazing system.

The following test case demonstrates the bug.

  \usemodule[mathml]
  \starttext
  \xmlprocessdata{}{
  
  http://www.example.com/ns/foo; 
xmlns:m="http://www.w3.org/1998/Math/MathML;>
  
ab
  
  
ab
  
  
  }{}
  \stoptext

No output is produced. This has been verified with live.contextgarden.net.

In order for output to be produced,  must be changed to  and
 must be changed to , but these are in the wrong
namespace in this context. In other words, this bug applies to the keyword
element in an apply element. 

Hugo Landau
___
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] XML Namespaces and XML Setups

2020-11-16 Thread Christoph Reller
Dear List,

Consider the following MWE:

\startxmlsetups xml:demo:base
  \xmlsetsetup{#1}{tag}{xml:demo:tag}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}
\startxmlsetups xml:demo:tag
  %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
  \xmlflush{#1}
\stopxmlsetups
\starttext
\startbuffer[test]


  text text

\stopbuffer
\xmlprocessbuffer{demo}{test}{}
\stoptext

My questions:
- Is there a good way to have a separate XML setup for each XML namespace?
- Alternatively, one has to do the distinction within the same XML setup.
In this case, how do we get the complete namespace? (In this example:
"NameSpaceA" and "NameSpaceO")

Thanks in advance for your help!

Cheers, Christoph
___
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] xml bookmarks + chapter no. in header

2020-10-07 Thread Pablo Rodriguez
On 10/7/20 5:06 PM, Tomas Hala wrote:
> Hi,
>
> I tried
> \setuphead[section][expansion=yes]
> with no effect before I wrote my question to the list here.
>
> With the \setuphead, the .tuc file still contains macro names instead of the 
> text:
>  ["title"]="\\expanded \\name ",
> whereas without it only:
>  ["title"]=" \\name ",
>
> So is there any way how to solve it?

Sorry, Tomáš, for not giving a reply to you.

I noticed that your case didn’t work with my approach.

But the problem is different in that case, I think (Wolfgang may correct
me [or explain this better]).

Expansion in list and bookmarks seems to be different:

\setupinteraction[state=start]
\setupinteractionscreen[option=bookmarks]
\placebookmarks[section][section]
\setuphead[title][page=no]
\starttext

%~ \placelist[section] % this doesn’t work
\def\name{aa}
\placelist[section]
 \startsection[title=\name, list=\expanded\name] \stopsection
\def\name{bb}
\startsection[title=\name, list=\expanded\name] \stopsection
\completecontent

\stoptext

I’m afraid I don’t know why.

Sorry not helping,

Pablo
--
http://www.ousia.tk
___
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] xml bookmarks + chapter no. in header

2020-10-07 Thread Tomas Hala
Hi,

I tried 
\setuphead[section][expansion=yes]
with no effect before I wrote my question to the list here.

With the \setuphead, the .tuc file still contains macro names instead of the 
text:
 ["title"]="\\expanded \\name ",
whereas without it only:
 ["title"]=" \\name ",

So is there any way how to solve it?

Best wishes,

Tomáš 

Wed, Oct 07, 2020 ve 04:36:48PM +0200 Jano Kula napsal(a):
#On Wed, 7 Oct 2020 at 15:04, Pablo Rodriguez <[1]oi...@gmx.es> wrote:
# 
#  On 10/7/20 1:28 PM, Jano Kula wrote:
#  > Hello to everybody!
#  >
#  > I have a similar problem as Tomas two days ago. When inserting
#  bookmarks
#  > from XML the reference to the node is stored in TUC file
#  >
#  >   ["titledata"]={
#  >    ["label"]="section",
#  >    ["title"]="\\xmlatt {xml:name::4}{title}"
#  >
#  > and this reference ends up in bookmarks. Any advice on how to change
#  it
#  > to text in bookmarks?
# 
#  Hi Jano,
# 
#  I think I had a similar problem.
# 
#  You may try:
# 
#    \setuphead
#      [section]
#      [expansion=yes]
# 
#  As I reported before "expansion=xml" was problematic for me (but it may
#  work for you, if "expansion=yes" doesn’t).
# 
#  Just in case it helps,
# 
#  Pablo
#  [2]http://www.ousia.tk
# 
#Hi Pablo,
#That's likely the problem of Tomas, too: when and how to do the expansion
#(his use case is different). Thank you, problem solved and [3]wikified.
#Jano
# 
# References
# 
#Visible links
#1. mailto:oi...@gmx.es
#2. http://www.ousia.tk/
#3. https://wiki.contextgarden.net/Interaction#XML_source

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


 Tomáš Hála

Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky
Zemědělská 1, CZ-613 00 Brno,  tel. +420 545 13 22 28

http://akela.mendelu.cz/~thala
___
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] xml bookmarks

2020-10-07 Thread Jano Kula
On Wed, 7 Oct 2020 at 15:04, Pablo Rodriguez  wrote:

> On 10/7/20 1:28 PM, Jano Kula wrote:
> > Hello to everybody!
> >
> > I have a similar problem as Tomas two days ago. When inserting bookmarks
> > from XML the reference to the node is stored in TUC file
> >
> >   ["titledata"]={
> >["label"]="section",
> >["title"]="\\xmlatt {xml:name::4}{title}"
> >
> > and this reference ends up in bookmarks. Any advice on how to change it
> > to text in bookmarks?
>
> Hi Jano,
>
> I think I had a similar problem.
>
> You may try:
>
>   \setuphead
> [section]
> [expansion=yes]
>
> As I reported before "expansion=xml" was problematic for me (but it may
> work for you, if "expansion=yes" doesn’t).
>
> Just in case it helps,
>
> Pablo
> http://www.ousia.tk
>

Hi Pablo,

That's likely the problem of Tomas, too: when and how to do the expansion
(his use case is different). Thank you, problem solved and wikified
.

Jano
___
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] xml bookmarks

2020-10-07 Thread Pablo Rodriguez
On 10/7/20 1:28 PM, Jano Kula wrote:
> Hello to everybody!
>
> I have a similar problem as Tomas two days ago. When inserting bookmarks
> from XML the reference to the node is stored in TUC file
>
>   ["titledata"]={
>    ["label"]="section",
>    ["title"]="\\xmlatt {xml:name::4}{title}"
>
> and this reference ends up in bookmarks. Any advice on how to change it
> to text in bookmarks?

Hi Jano,

I think I had a similar problem.

You may try:

  \setuphead
[section]
[expansion=yes]

As I reported before "expansion=xml" was problematic for me (but it may
work for you, if "expansion=yes" doesn’t).

Just in case it helps,

Pablo
--
http://www.ousia.tk
___
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] xml bookmarks

2020-10-07 Thread Jano Kula
Hello to everybody!

I have a similar problem as Tomas two days ago. When inserting bookmarks
from XML the reference to the node is stored in TUC file

  ["titledata"]={
   ["label"]="section",
   ["title"]="\\xmlatt {xml:name::4}{title}"

and this reference ends up in bookmarks. Any advice on how to change it to
text in bookmarks?

Find attached MWE (mkiv, current beta), third section is inserted manually.

Thank you,
Jano


xml-bookmarks.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
___


Re: [NTG-context] XML to ConTeXt: converting date attribute from ISO date

2020-03-11 Thread Hans Hagen

On 3/11/2020 4:54 PM, Axel Kielhorn wrote:

Hello Hans and mailing list!

Thank you so much.

With this example and the help I received earlier from Massi,
I’ve been able to write my first finalizer today.

It is amazing how powerful luatex is.


indeed (and luametatex is supposed to be even bit more powerful)


My project needs some cleanup and documentation but I hope to put it on GitHub 
soon.
After that I will try to put a minimal version into the wiki.

that would be nice. thanks

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] XML to ConTeXt: converting date attribute from ISO date

2020-03-11 Thread Axel Kielhorn
Hello Hans and mailing list!

Thank you so much.

With this example and the help I received earlier from Massi, 
I’ve been able to write my first finalizer today.

It is amazing how powerful luatex is.

My project needs some cleanup and documentation but I hope to put it on GitHub 
soon.
After that I will try to put a minimal version into the wiki.

Greetings Axel
___
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] XML to ConTeXt: converting date attribute from ISO date

2020-03-11 Thread Axel Kielhorn


> Am 11.03.2020 um 15:19 schrieb Hans Hagen :
> 
> On 3/11/2020 3:12 PM, Axel Kielhorn wrote:
>>> Am 11.03.2020 um 15:01 schrieb Hans Hagen :
>>> 
>>> On 3/11/2020 2:14 PM, Axel Kielhorn wrote:
 
 Had to change it to:
 \startluacode
function xml.finalizers.tex.MyDate(e,what,how)
local ee = e[1].at[what]
local t = (string.split(ee,"-"))
context.date(
{ y = t[1], m = t[2], d = t[3] },
{ how }
)
end
 \stopluacode
>>> You mean the () around the split? weird. Anyway, there's also a time 
>>> splitter (dedicated to Alan who needed one):
>> No, sorry that’s an artifact from testing.
>> I had to assign:
>> local ee = e[1].at[what]
>> and
>> string.split(ee,"-")
>> in two steps while the original had
>> local t = string.split(e[1].at[what],"-")
> still strange because it's one value, if it were multiple you could do

This is strange.
Now it works.

Earlier I had context.date complaining that it got a table and not a string.
That’s why I took the t = assignment apart into pieces.

Now I copied the code from the original reply and it works.

Sorry for the noise.

Axel


___
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] XML to ConTeXt: converting date attribute from ISO date

2020-03-11 Thread Hans Hagen

On 3/11/2020 2:14 PM, Axel Kielhorn wrote:




Am 15.08.2018 um 14:04 schrieb Hans Hagen :

On 8/15/2018 12:27 PM, Mike O'Connor wrote:

G’Day,
Having a first go at converting TEI XML to ConTeXt.
Steep learning curve, but easier (for me) than XSLT, and first results were 
amazing.  Using http://www.pragma-ade.com/general/manuals/xml-mkiv.pdf as a 
guide.
Currently stuck on converting an ISO format date (eg. 1908-01-10) into 
something more readable (eg. 10 January 1908) in the output.  I presume I 
should create a function (?luacode) that can take any ISO value and output the 
readable form.  The following works but seems to me inefficient.
Grateful for any pointers.
Mike
Here is my MWE:
\startbuffer[demo]

 
 
 
 
 10.I.08
 
 
19 Mar '08
 
 
 
 

\stopbuffer
\startxmlsetups xml:initialize
\xmlsetsetup{#1}{date}{xml:date}
\stopxmlsetups
\xmlregistersetup{xml:initialize}
\startxmlsetups xml:date
\xmldoifelse {#1}{.[@type='divDate']} {
\def\docdate{\ctxlua{
local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4)
local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7)
local tday = string.sub('\xmlatt{#1}{when-iso}',9,10)
context.date{d = tday, m = tmonth, y = tyear}
}}
\docdate[day,month,year] = Document Date \par
 } {
\def\docdate{\ctxlua{
local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4)
local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7)
local tday = string.sub('\xmlatt{#1}{when-iso}',9,10)
context.date{d = tday, m = tmonth, y = tyear}
}}
\docdate[day,month,year] = Event Date\par
}
\stopxmlsetups
\starttext
\xmlprocessbuffer{main}{demo}{}
\stoptext

Can be wikified ...

\startluacode
function xml.finalizers.tex.MyDate(e,what,how)
local t = string.split(e[1].at[what],"-")
context.date(
{ y = t[1], m = t[2], d = t[3] },
{ how }
)
end
\stopluacode

\startxmlsetups xml:date

\xmldoifelse {#1}{.[@type='divDate']} {
\xmlfilter{#1}{./MyDate("when-iso","day,month,year")}\
Document Date \par
} {
\xmlfilter{#1}{./MyDate("when-iso","day,month,year")}\
Event Date\par

}
\stopxmlsetups


I couldn’t get this to work.
Had to change it to:

\startluacode
function xml.finalizers.tex.MyDate(e,what,how)
local ee = e[1].at[what]
local t = (string.split(ee,"-"))
context.date(
{ y = t[1], m = t[2], d = t[3] },
{ how }
)
end
\stopluacode
You mean the () around the split? weird. Anyway, there's also a time 
splitter (dedicated to Alan who needed one):


print(os.time(utilities.parsers.totime("2019-03-05 12:12:12")))
print(os.time(utilities.parsers.totime("2019/03/05 12:12:12")))
print(os.time(utilities.parsers.totime("05-03-2019 12:12:12")))
print(os.time(utilities.parsers.totime("05/03/2019 12:12:12")))

inspect(utilities.parsers.totime("2019-03-05 12:12:12"))
inspect(utilities.parsers.totime("2019/03/05 12:12:12"))
inspect(utilities.parsers.totime("05-03-2019 12:12:12"))
inspect(utilities.parsers.totime("05/03/2019 12:12:12"))


-
  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] XML to ConTeXt: converting date attribute from ISO date

2020-03-11 Thread Axel Kielhorn


> Am 15.08.2018 um 14:04 schrieb Hans Hagen :
> 
> On 8/15/2018 12:27 PM, Mike O'Connor wrote:
>> G’Day,
>> Having a first go at converting TEI XML to ConTeXt.
>> Steep learning curve, but easier (for me) than XSLT, and first results were 
>> amazing.  Using http://www.pragma-ade.com/general/manuals/xml-mkiv.pdf as a 
>> guide.
>> Currently stuck on converting an ISO format date (eg. 1908-01-10) into 
>> something more readable (eg. 10 January 1908) in the output.  I presume I 
>> should create a function (?luacode) that can take any ISO value and output 
>> the readable form.  The following works but seems to me inefficient.
>> Grateful for any pointers.
>> Mike
>> Here is my MWE:
>> \startbuffer[demo]
>> 
>> 
>> 
>> 
>> 
>> 10.I.08
>> 
>> 
>> 19 Mar '08
>> 
>> 
>> 
>> 
>> 
>> \stopbuffer
>> \startxmlsetups xml:initialize
>> \xmlsetsetup{#1}{date}{xml:date}
>> \stopxmlsetups
>> \xmlregistersetup{xml:initialize}
>> \startxmlsetups xml:date
>> \xmldoifelse {#1}{.[@type='divDate']} {
>> \def\docdate{\ctxlua{
>> local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4)
>> local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7)
>> local tday = string.sub('\xmlatt{#1}{when-iso}',9,10)
>> context.date{d = tday, m = tmonth, y = tyear}
>> }}
>> \docdate[day,month,year] = Document Date \par
>> } {
>> \def\docdate{\ctxlua{
>> local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4)
>> local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7)
>> local tday = string.sub('\xmlatt{#1}{when-iso}',9,10)
>> context.date{d = tday, m = tmonth, y = tyear}
>> }}
>> \docdate[day,month,year] = Event Date\par
>> }
>> \stopxmlsetups
>> \starttext
>> \xmlprocessbuffer{main}{demo}{}
>> \stoptext
> Can be wikified ...
> 
> \startluacode
>function xml.finalizers.tex.MyDate(e,what,how)
>local t = string.split(e[1].at[what],"-")
>context.date(
>{ y = t[1], m = t[2], d = t[3] },
>{ how }
>)
>end
> \stopluacode
> 
> \startxmlsetups xml:date
> 
>   \xmldoifelse {#1}{.[@type='divDate']} {
>\xmlfilter{#1}{./MyDate("when-iso","day,month,year")}\
>   Document Date \par
>} {
>\xmlfilter{#1}{./MyDate("when-iso","day,month,year")}\
>Event Date\par
> 
>   }
> \stopxmlsetups

I couldn’t get this to work.
Had to change it to:

\startluacode
   function xml.finalizers.tex.MyDate(e,what,how)
   local ee = e[1].at[what]
   local t = (string.split(ee,"-"))
   context.date(
   { y = t[1], m = t[2], d = t[3] },
   { how }
   ) 
   end
\stopluacode

mtx-context | ConTeXt Process Management 1.03
mtx-context |
mtx-context | main context file: /Volumes/Macintosh 
HD/usr/local/texlive/context-109/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2020.01.30 14:13
mtx-context | main context file: /Volumes/Macintosh 
HD/usr/local/texlive/context-109/tex/texmf-context/tex/context/base/mkiv/context.mkxl
mtx-context | current version: 2020.01.30 14:13

Greetings Axel

___
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] xml differences between old context and lmtx

2019-12-27 Thread Jan U. Hasecke
Am 27.12.19 um 14:03 schrieb Hans Hagen:
> On 12/26/2019 1:19 PM, Jan U. Hasecke wrote:
>> Hi all,
>>
>> are there any documented differences between the xml features of normal
>> context and lmtx?
>>
>> In a fun project I compile xml sources from www.deutschestextarchiv.de
>> to pdf via context using xmlsetups which kinda works with normal context
>> current version: 2019.08.09 18:29
>>
>> With lmtx current version: 2019.12.12 01:08 I don't get a usable result.
>>
>> And there is a change in file naming I discovered.
>>
>> Files from the deutschestextarchiv have names like
>> marx_kapital01_1867.TEI-P5.xml
>>
>> lmtx skips the TEI-P5 part
>>
>> Any hints how I can adjust my xmlsetups?
> how do you load the file

With the --environment switch:

context --environment=tei-style.tex marx_kapital01_1867.TEI-P5.xml

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] xml differences between old context and lmtx

2019-12-27 Thread Hans Hagen

On 12/26/2019 1:19 PM, Jan U. Hasecke wrote:

Hi all,

are there any documented differences between the xml features of normal
context and lmtx?

In a fun project I compile xml sources from www.deutschestextarchiv.de
to pdf via context using xmlsetups which kinda works with normal context
current version: 2019.08.09 18:29

With lmtx current version: 2019.12.12 01:08 I don't get a usable result.

And there is a change in file naming I discovered.

Files from the deutschestextarchiv have names like
marx_kapital01_1867.TEI-P5.xml

lmtx skips the TEI-P5 part

Any hints how I can adjust my xmlsetups?

how do you load the file

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


[NTG-context] xml differences between old context and lmtx

2019-12-26 Thread Jan U. Hasecke
Hi all,

are there any documented differences between the xml features of normal
context and lmtx?

In a fun project I compile xml sources from www.deutschestextarchiv.de
to pdf via context using xmlsetups which kinda works with normal context
current version: 2019.08.09 18:29

With lmtx current version: 2019.12.12 01:08 I don't get a usable result.

And there is a change in file naming I discovered.

Files from the deutschestextarchiv have names like
marx_kapital01_1867.TEI-P5.xml

lmtx skips the TEI-P5 part

Any hints how I can adjust my xmlsetups?

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] XML/HTML output of Math

2019-08-09 Thread Atsuhito Kohda
Hi all,

I will attach a screenshot of firefox on Ubuntu 10.04 but I'm not familiar
with Gmail so I'm uncertain if it goes well or not.

Thanks for your help.
Best regards,
Atsuhito Kohda

___
> 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] XML/HTML output of Math

2019-08-09 Thread Hans Hagen

On 8/8/2019 9:41 AM, Taco Hoekwater wrote:


In case display math mode, we get very weird output of "\int_a^b”.


ConTeXt outputs b_a^\int in display mode; the order of the objects
inside the generated  is wrong, which is clearly a bug.
And it seems to do this for all large operators.

i'll look into it

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] XML/HTML output of Math

2019-08-09 Thread Taco Hoekwater
Hi,

> On 9 Aug 2019, at 07:35, Atsuhito Kohda  wrote:
> 
> Dear Taco, thanks for your reply.
> 
> > I opened the xhtml with firefox and the only problem I see
> > is the ignored \displaystyle (which is why the integral looks small).
> > Inline looks fine otherwise, no interchanging of limits.
> 
> Hmm, I use firefox 68.0.1 of Ubuntu 19.04 and firefox 60.8.0
> of Debian/unstable.  I see the interchanging of limits with
> both firefoxes.  BTW, it seems Chromium doesn't support MathML.
> If any Linux users could test the xhtml with firefox (or any browsers)
> I believe it would help us much.

My firefox is 68.0.1 on MacOS. Small (ugly) screenshot attached.

___
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] XML/HTML output of Math

2019-08-08 Thread Atsuhito Kohda
Dear Taco, thanks for your reply.

> I opened the xhtml with firefox and the only problem I see
> is the ignored \displaystyle (which is why the integral looks small).
> Inline looks fine otherwise, no interchanging of limits.

Hmm, I use firefox 68.0.1 of Ubuntu 19.04 and firefox 60.8.0
of Debian/unstable.  I see the interchanging of limits with
both firefoxes.  BTW, it seems Chromium doesn't support MathML.
If any Linux users could test the xhtml with firefox (or any browsers)
I believe it would help us much.

> Well, as fine as it can be in firefox, which is pretty bad.

I'm not sure if I understand you correctly but I think MathJax
might be much better than MathML.

> ConTeXt outputs b_a^\int in display mode; the order of the objects
> inside the generated  is wrong, which is clearly a bug.
> And it seems to do this for all large operators.

I see.

> I think this somehow triggered by the nested mode switch (\text{\math{}})
in the \vsym.
> If I change that definition to the more simple:

>   \define[1]\vsym{{\textstyle\bi #1}}

> it works ok. Whether that helps you ...

It helps me to some extent but with the original definition, we can
use \vI in both math mode (\math{\vI}) and text mode like "vector \vI".
So if ConTeXt could convert the nested mode switch correctly
it would be very nice.

Thanks for your info.
Best regards,
Atsuhito Kohda



>
> ___
> 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] XML/HTML output of Math

2019-08-08 Thread Taco Hoekwater
Hi,

> On 8 Aug 2019, at 01:06, Atsuhito Kohda  wrote:
> 
> Hi all,
> I used to compile a beamer file with LuaLaTeX to generate a PDF
> for presentation then convert the beamer file to XHTML with LaTeXML
> for Web page.
> Recently I begin to use ConTeXt so I try to get a PDF for presentation
> and also XML/HTML output from a single ConTeXt file.
> I have a few questions about XML/HTML output of Math.
> 
> 1. In case inline math mode with \displaystyle, we get wrong output
> of "\int_a^b"; lower limit and upper limit are interchanged 
> and further "b" is a bit larger and an integral symbol is rather small.
> (It looks "\displaystyle" is not effective, e.g see "\frac”.)

I opened the xhtml with firefox and the only problem I see
is the ignored \displaystyle (which is why the integral looks small). 
Inline looks fine otherwise, no interchanging of limits.

Well, as fine as it can be in firefox, which is pretty bad.

> In case display math mode, we get very weird output of "\int_a^b”.

ConTeXt outputs b_a^\int in display mode; the order of the objects
inside the generated  is wrong, which is clearly a bug.
And it seems to do this for all large operators.

> 
> 2. \math{\Vmatrix{\vI, \vj, \vk; a_{1}, a_{2}, a_{3}; b_{1}, b_{2}, b_{3}}}
> \vI, \vj, \vk are disappeared in xml/html output.  What happend?

I think this somehow triggered by the nested mode switch (\text{\math{}}) in 
the \vsym. 
If I change that definition to the more simple:

  \define[1]\vsym{{\textstyle\bi #1}}

it works ok. Whether that helps you ...

Best wishes,
Taco

___
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] XML/HTML output of Math

2019-08-07 Thread Atsuhito Kohda
Hi all,
I used to compile a beamer file with LuaLaTeX to generate a PDF
for presentation then convert the beamer file to XHTML with LaTeXML
for Web page.
Recently I begin to use ConTeXt so I try to get a PDF for presentation
and also XML/HTML output from a single ConTeXt file.
I have a few questions about XML/HTML output of Math.

1. In case inline math mode with \displaystyle, we get wrong output
of "\int_a^b"; lower limit and upper limit are interchanged
and further "b" is a bit larger and an integral symbol is rather small.
(It looks "\displaystyle" is not effective, e.g see "\frac".)

In case display math mode, we get very weird output of "\int_a^b".
It is difficult to explain how weird it is but something like
an output of "b_{\int}^a". Please check an attatched sample.
We get the similar kind of weird output of "\sum_{n=0}^{\infty}".
Due to these, it is impossible to use XML/HTML output of ConTeXt
in real use.

2. \math{\Vmatrix{\vI, \vj, \vk; a_{1}, a_{2}, a_{3}; b_{1}, b_{2}, b_{3}}}
\vI, \vj, \vk are disappeared in xml/html output.  What happend?
BTW, if we put "a" (or any alphabet?) in fron of \vI, then
we get every elements (but of course we get unnecessary "a" also).
- bSample
\setupbackend[export=yes]
\definemathmatrix[vmatrix][matrix:bars]
 [simplecommand=Vmatrix]
\define[1]\vsym{\text{\math{\bi #1}}}
\define\vI{\vsym{i}}
% \define\vi{\vsym{i}}
\define\vj{\vsym{j}}
\define\vk{\vsym{k}}
\starttext
A simple math. \m{y=\sin x}, \m{\displaystyle y=\frac{\log x}{x}},

\m{\mathbf{A+B=C}}, \m{\mathbb{R}}, \m{\mathfrak{A}}, \m{\mathcal{S}},

A bit complex math.
\m{\displaystyle\int_{a}^{b}x\sin x\,dx=-[x\cos x]_{a}^{b}+\int_{a}^{b}\cos
x\,dx}
\startformula
  \int_{a}^{b}x\sin x\,dx=-[x\cos x]_{a}^{b}+\int_{a}^{b}\cos x\,dx
\stopformula
\m{\displaystyle\sum_{n=0}^{\infty}\frac{x^n}{n!}}
\startformula
\sum_{n=0}^{\infty}\frac{x^n}{n!}
\stopformula
\math{\Vmatrix{\vI, \vj, \vk; a_{1}, a_{2}, a_{3}; b_{1}, b_{2}, b_{3}}}
\math{\Vmatrix{a\vI, \vj, \vk; a_{1}, a_{2}, a_{3}; b_{1}, b_{2}, b_{3}}}
\stoptext
- eSample

Thanks in advance.
Best regards,
Atsuhito Kohda
___
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] XML Export: Suppressing Presentation Forms in Arabic Script Fonts

2019-06-19 Thread Hamid,Idris
Dear gang,

Just documented the following in the wiki:

https://wiki.contextgarden.net/Export#Suppressing_Presentation_Forms_in_Arabic_Script_Fonts

For those who use certain commercial Arabic-script fonts with XML export:  
In the course of ConTeXt processing, many standard codepoints from the  
U+600 block are substituted with those from a subset of Presentation Forms  
B, which breaks the input in critical ways.

Many thanks to Hans for pointing out this simple way to solve the issue.  
For details, see the link above.

Best wishes
Idris
-- 
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80512
___
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] XML in latest betas (MkIV & LMTX)

2019-06-02 Thread Hans Hagen

On 6/2/2019 3:07 PM, Pablo Rodriguez wrote:


Font expansion (as reported in
https://mailman.ntg.nl/pipermail/ntg-context/2019/095175.html).


font expansion is always slower (but i admit that i never use it)

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] XML in latest betas (MkIV & LMTX)

2019-06-02 Thread Pablo Rodriguez
On 6/2/19 2:12 PM, Hans Hagen wrote:
> On 6/2/2019 1:17 PM, Pablo Rodriguez wrote:
>> [...]
>> Compiling exactly the same XML sources (a book on ConTeXt in Spanish),
>> MkIV needs 40s and LMTX more than 52s.
>
> Hm. Is that the first time you compare a MKIV runs with an LMTX run for
> that document? I assume that you time multiple runs.

No, it isn’t the first time I compare and I time multiple runs.

>> This is the first time I get such a difference in compilation times.
>
> On the average LMTX should be faster than MKIV (and definitely not 20%
> slower). I assume it's regular luatex?

Sorry, this was my fault. I thought I was running luatex and it was
luajittex.

MkIV times with luatex are 51.x seconds, which is a tiny bit faster than
LMTX (52.x seconds). But this is perfectly normal.

>> I’m afraid I can’t be sure that output is the same, since different
>> spacing gives different page numbers.
>
> Not sure where that comes from. There are no fundamental changes wrr
> spacing.

Font expansion (as reported in
https://mailman.ntg.nl/pipermail/ntg-context/2019/095175.html).

>> I wonder whether this might be an issue.
> Hard to say without a MWE that exposes the same

Sorry for the noise,

Pablo
--
http://www.ousia.tk
___
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] XML in latest betas (MkIV & LMTX)

2019-06-02 Thread Hans Hagen

On 6/2/2019 1:17 PM, Pablo Rodriguez wrote:

Dear list,

I have just installed latest betas for both MkIV and LMTX.

Compiling exactly the same XML sources (a book on ConTeXt in Spanish),
MkIV needs 40s and LMTX more than 52s.


Hm. Is that the first time you compare a MKIV runs with an LMTX run for 
that document? I assume that you time multiple runs.



This is the first time I get such a difference in compilation times.


On the average LMTX should be faster than MKIV (and definitely not 20% 
slower). I assume it's regular luatex?



I’m afraid I can’t be sure that output is the same, since different
spacing gives different page numbers.


Not sure where that comes from. There are no fundamental changes wrr 
spacing.



I wonder whether this might be an issue.

Hard to say without a MWE that exposes the same

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


[NTG-context] XML in latest betas (MkIV & LMTX)

2019-06-02 Thread Pablo Rodriguez
Dear list,

I have just installed latest betas for both MkIV and LMTX.

Compiling exactly the same XML sources (a book on ConTeXt in Spanish),
MkIV needs 40s and LMTX more than 52s.

This is the first time I get such a difference in compilation times.

I’m afraid I can’t be sure that output is the same, since different
spacing gives different page numbers.

I wonder whether this might be an issue.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
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
___


  1   2   3   4   5   6   >