Re: [NTG-context] Convertnumber with \ref[number] fails in MkIV, works in LMTX

2021-10-27 Thread Rik Kabel via ntg-context
Following up on my own note, I see that this fails under LMTX if 
compiled in a clean directory, but succeeds if first compiled with the 
troublesome line removed, and then, restoring the line, compiled a 
second time. It also works by placing a .tuc file from an older version 
of the document into the directory before compiling. Very strange 
indeed. The expected output, from one of those successful compilations:


So. I am clearly doing something wrong, but sometimes LMTX is letting me 
get away with it.


--
Rik

On 10/27/2021 21:47, Rik Kabel via ntg-context wrote:


Hello list,

The following fails with ConTeXt  ver: 2021.10.24 21:45 MKIV but works 
with the companion LMTX. The error message is:tex error   > tex 
error on line 6 in file G:/TestConTeXt/convert.tex: ! Incompatible 
glue units , pointing to the second \convertnumber line.


\definelabel[XX]%[text=,before=,after=,alternative=inright]
\startTEXpage[offset=2em]
 abc\XX[xx]\par
 \ref[number][xx] ·
 \convertnumber{r}{1} ·
 \convertnumber{R}{\ref[number][xx]}
\stopTEXpage

In this case I am trying to display with roman numerals the number 
generated in the label created through \definelabel.


Suggestions welcomed.

--
Rik


___
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] Convertnumber with \ref[number] fails in MkIV, works in LMTX

2021-10-27 Thread Rik Kabel via ntg-context

Hello list,

The following fails with ConTeXt  ver: 2021.10.24 21:45 MKIV but works 
with the companion LMTX. The error message is:tex error   > tex 
error on line 6 in file G:/TestConTeXt/convert.tex: ! Incompatible glue 
units , pointing to the second \convertnumber line.


   \definelabel[XX]%[text=,before=,after=,alternative=inright]
   \startTEXpage[offset=2em]
 abc\XX[xx]\par
 \ref[number][xx] ·
 \convertnumber{r}{1} ·
 \convertnumber{R}{\ref[number][xx]}
   \stopTEXpage

In this case I am trying to display with roman numerals the number 
generated in the label created through \definelabel.


Suggestions welcomed.

--
Rik
___
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] getting number from context.figurewidth

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

On 10/27/2021 9:20 PM, Pablo Rodriguez via ntg-context wrote:

On 10/26/21 6:31 PM, Pablo Rodriguez via ntg-context wrote:

[...]
Is there a way that I can get a number from context.figureheight, such
as I get it from tex.dimen.paperheight?


Sorry for insisting, I need it for a Lua script that in the relevant
line reads:

   loader_times:write('.box placeholder width=' .. context.figurewidth
  .. ' height=' .. context.figureheight)

I cannot concatenate string and function (and I need the number, not the
unit).

Is there no way of doing it?

i'm pretty sure this has been asked before

\ctxlua{local f = figures.getinfo("cow.pdf") print(f and f.used and 
f.used.width)}


so .. time to wikify 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] getting number from context.figurewidth

2021-10-27 Thread Jairo A. del Rio via ntg-context
Hi, Pablo. I have no idea of what you need to do, but in grph-inc.lua you
find the following (line 709):

implement { name = "figurestatus",   actions = { get, context }, arguments
= { "'status'",  "string", "string" } }

So that \figureheight calls this function via \clf_figurestatus and, in
turn, it calls figures.get. If I'm right,

figures.get('status','height','0') -- or '"status"' ?

would have to return the value you're asking for (at the TeX end, "sp"
units are added). A MWE wouldn't hurt. I hope this helps or, at least, it
leads you through the right direction.

Cordially,

Jairo

El mié, 27 de oct. de 2021 a la(s) 14:20, Pablo Rodriguez via ntg-context (
ntg-context@ntg.nl) escribió:

> On 10/26/21 6:31 PM, Pablo Rodriguez via ntg-context wrote:
> > [...]
> > Is there a way that I can get a number from context.figureheight, such
> > as I get it from tex.dimen.paperheight?
>
> Sorry for insisting, I need it for a Lua script that in the relevant
> line reads:
>
>   loader_times:write('.box placeholder width=' .. context.figurewidth
>  .. ' height=' .. context.figureheight)
>
> I cannot concatenate string and function (and I need the number, not the
> unit).
>
> Is there no way of doing it?
>
> 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
>
> ___
>
___
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] getting number from context.figurewidth

2021-10-27 Thread Pablo Rodriguez via ntg-context
On 10/26/21 6:31 PM, Pablo Rodriguez via ntg-context wrote:
> [...]
> Is there a way that I can get a number from context.figureheight, such
> as I get it from tex.dimen.paperheight?

Sorry for insisting, I need it for a Lua script that in the relevant
line reads:

  loader_times:write('.box placeholder width=' .. context.figurewidth
 .. ' height=' .. context.figureheight)

I cannot concatenate string and function (and I need the number, not the
unit).

Is there no way of doing it?

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
___


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
___