[NTG-context] Dig out contents of the TeX macro using Lua

2015-07-14 Thread Jaroslav Hajtmar

Hello ConTeXist.
I hope that my crazy questions not much bother.
This time I needed to get to the fair value of the parameter, delivering 
to lua function over the content macros.
Obviously it's my misunderstanding of the functioning of expansion in 
case maker with optional parameters, or you really can not explain the 
functioning of the transmission values. It seems that is passed to a 
sort of reference as to the actual contents of the macro perhaps can not 
even get through Lua. Or did they?

The following minimal example, perhaps explain what going on.

The question ultimately: Is there any alternative how using Lua somehow 
easily evaluate the macro content? For example to determine whether two 
different macros have the same content?


Jaroslav Hajtmar

here is minimal example:

\starttext

This works as expected:

\def\makrowithcontent{}

\edef\testparameter#1{%
\startluacode
local parameter='#1'
if parameter=='' then context('TRUE. ') else context('FALSE. ') end
context('Parameter '..parameter..' has length '..string.len(parameter))
\stopluacode
}%

\type{\makrowithcontent} -- \makrowithcontent

Test is \testparameter{}

Test is \testparameter{} % OK

Test is \testparameter{\makrowithcontent} % OK

But what about with this: ???


% initialize values
\startluacode
A={}
for i=1,50 do A[i]='Record '..tostring(i) end
A[25]=''
\stopluacode


\def\makrowithcontent{}

\def\lastname{\dosingleempty\dolastname}%
\def\dolastname[#1]{\doifsomethingelse{#1}{\ctxlua{context(A[#1])}}{\makrowithcontent}}%


\type{\lastname} - \lastname

\type{\lastname[2]} - \lastname[2]

\type{\lastname[5]} - \lastname[5]

\type{\lastname[25]} - \lastname[25]





\edef\readandprocessparameters#1#2{%
\startluacode
local parameter1='#1'
if parameter1=='' then context('Test '..parameter1..' =  is 
TRUE. ') else context('Test '..parameter1..' =  is FALSE. ') end
context('Parameter 1 = '..parameter1..' has length 
'..string.len(parameter1))

context('\\crlf')
local parameter2='#2'
if parameter2=='' then context('Test '..parameter2..' =  is 
TRUE. ') else context('Test '..parameter2..' =  is FALSE. ') end
context('Parameter 2 = '..parameter2..' has length 
'..string.len(parameter2))

context('\\crlf')
\stopluacode
}%


\readandprocessparameters{}{}

%Test is \readandprocessparameters{\lastname[25]}{\lastname} % Crashed

\readandprocessparameters{\\lastname[25]}{\\lastname}

\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] em-/en-dashes and newotf

2015-07-14 Thread Hans Hagen

On 7/14/2015 3:42 PM, Pablo Rodriguez wrote:

On 07/14/2015 12:54 PM, Rik Kabel wrote:

On 2015-07-12 12:52, Hans Hagen wrote:

[...]
i just checked the distribution on a vm and it works ok so best first
figure out why the tex ligs don't show up (when that relevant file is
not loaded well other overloads might also fail so that can be the
reason then for other issues)

Hans


Thank you, Hans, for the fixes to feature handling in 2015-07-15 10:37.
Now both the dashes and ligatures in this thread and the failed build
with script=hebr (whatever the relationship to the particular script)
work as expected.


Hans,

checking beta from 2015.07.12 23:30 in Win7 64bit works fine (ligatures,
no ligatures and dashes) with newotf.

But I’m afraid that beta from 2015.07.14 10:37 doesn’t work disabling
ligatures and enabling dashes in Linux 32bit.

I’ll try to check the Linux 32bit ConTeXt with another computer.


there is no dependency on the platform

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] em-/en-dashes and newotf

2015-07-14 Thread Pablo Rodriguez
On 07/14/2015 12:54 PM, Rik Kabel wrote:
> On 2015-07-12 12:52, Hans Hagen wrote:
>> [...]
>> i just checked the distribution on a vm and it works ok so best first 
>> figure out why the tex ligs don't show up (when that relevant file is 
>> not loaded well other overloads might also fail so that can be the 
>> reason then for other issues)
>>
>> Hans
> 
> Thank you, Hans, for the fixes to feature handling in 2015-07-15 10:37. 
> Now both the dashes and ligatures in this thread and the failed build 
> with script=hebr (whatever the relationship to the particular script) 
> work as expected.

Hans,

checking beta from 2015.07.12 23:30 in Win7 64bit works fine (ligatures,
no ligatures and dashes) with newotf.

But I’m afraid that beta from 2015.07.14 10:37 doesn’t work disabling
ligatures and enabling dashes in Linux 32bit.

I’ll try to check the Linux 32bit ConTeXt with another computer.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] em-/en-dashes and newotf

2015-07-14 Thread Rik Kabel

On 2015-07-12 12:52, Hans Hagen wrote:

On 7/12/2015 6:42 PM, Rik Kabel wrote:

On 2015-07-12 10:38, Pablo Rodriguez wrote:

On 07/12/2015 04:12 PM, Hans Hagen wrote:

[...]
maybe some file is not loaded ... i uploaded a variant that might work
better

Many thanks for the new beta.

I’m afraid that this sample doesn’t work with latest beta either:

 \usemodule[newotf]

 \definefontfeature[noliga][liga=no]

 \starttext
 \startTEXpage[offset=1em]
 fiflff no--liga:
 \addfeature[noliga]fiflff

 --- em--dash
 \stopTEXpage
 \stoptext

I may be wrong, but I think that the non-deactivated OpenType 
feature is

related to the non-activated em- and en-dashes.

To the list members: could you test the sample above and tell em- and
en-dashes work and if no-liga disables ligatures? Adding architecture
may help.

I’m on Linux 32bits.

Many thanks for your help,


Pablo

Same result as Pablo: the ligatures remain even with liga=no, and the
hyphens are not replaced by appropriate dashes. Win64 8.1 with ConTeXt
2015.07.12 15:40 build and LuaTeX 0.80.1 rev 5274. My texmf-local
contains only a locally-updated version of t-smartref.mkvi.

I also have other problems with newotf and definefontfeature that I will
put in a separate message.


i just checked the distribution on a vm and it works ok so best first 
figure out why the tex ligs don't show up (when that relevant file is 
not loaded well other overloads might also fail so that can be the 
reason then for other issues)


Hans


Thank you, Hans, for the fixes to feature handling in 2015-07-15 10:37. 
Now both the dashes and ligatures in this thread and the failed build 
with script=hebr (whatever the relationship to the particular script) 
work as expected.


--
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___