Re: [NTG-context] synonyms with MKIV

2007-12-06 Thread Wolfgang Schuster
2007/12/5, Hans Hagen [EMAIL PROTECTED]:
 Peter Münster wrote:
  On Wed, Dec 05, 2007 at 09:29:08AM +0100, Wolfgang Schuster wrote:
  this line should be
 
  \def\mksavesortedlistentry#1#2#3#4% class key entry meaning

  {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#1',\!!bs#2\!!es,\!!bs#3\!!es})}}
  Both versions give wrong output with optional arguments. But the following
  version works for me:
  I forgot to mention you have to regenrate the format with my solution, your
  seems to work but I found a way to stop processing because you the optinal
  argument can also be used to write a mcro in the first pair of braces and 
  this
  can produce problems.
 
  I've also regenrated the format. But now I understand better: it works well
  with your patch for core-syn.lua and Hans' patch for core-syn.mkiv:

  {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#2',\!!bs#3\!!es,\!!bs#4\!!es})}}

 can you summarize what i need to change?

Hi Hans,

the first part was your change in core-syn.mkiv to wrote all elements to the
tua file.

The scond correction is on line 108 in core-syn.lua

The order of key and entry is, the same as in the mkii macro

{ { v[2], v[3] } }, -- key, entry

but you wrote

{ { v[3], v[2] } }, -- entry, key

and can give the wrong entry in the synonymlist, e.g.

\definsynonyms[test][tests]
\test[A]{\TeX}{Description Text}

give

A  Description Text

and not

TeX  Description Text


I tested already in my own installation and this did work.

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


Re: [NTG-context] synonyms with MKIV

2007-12-06 Thread Hans Hagen
Wolfgang Schuster wrote:

 The order of key and entry is, the same as in the mkii macro
 
 { { v[2], v[3] } }, -- key, entry
 
 but you wrote
 
 { { v[3], v[2] } }, -- entry, key

ok, fixed

just wondering ... now we move to a mix of tex and lua code, how complex 
is it to piece together what's happening now inside context

Hans

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] synonyms with MKIV

2007-12-06 Thread Aditya Mahajan
On Thu, 6 Dec 2007, Hans Hagen wrote:

 Wolfgang Schuster wrote:

 The order of key and entry is, the same as in the mkii macro

 { { v[2], v[3] } }, -- key, entry

 but you wrote

 { { v[3], v[2] } }, -- entry, key

 ok, fixed

 just wondering ... now we move to a mix of tex and lua code, how complex
 is it to piece together what's happening now inside context

I think that it is going to be easier (once you get the hang of it). When 
I started reading mkii code, I understood the steps that were being 
followed, but the fine details were pretty hard to understand. With 
luatex, the broad steps are still in tex, so that part is the same, but 
the fine implementation (that needed a real programming language) are in 
lua. This makes it much easier to understand. I could read the new mkiv 
pretty printing code and see what it was doing. With the mkii pretty 
printing  code, I spent about a week and was still clueless (rather, I 
understood bits and pieces, but there was no way I could extend it to 
another language).

I think that this is enough to overcome to compensate for the overhead 
between going back and forth between lua and tex code.

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


Re: [NTG-context] synonyms with MKIV

2007-12-05 Thread Wolfgang Schuster
2007/12/4, Peter Münster [EMAIL PROTECTED]:
 On Tue, Dec 04, 2007 at 04:57:51PM +0100, Wolfgang Schuster wrote:

this is a bug in the mkiv sorting macros, I posted a similiar message
a few days ago but got no answer.

 Hello Wolfgang,

 Indeed, now I remember...
 (But one long week was time enough for me to forget it.)

   \def\mksavesortedlistentry#1#2#3#4% class key entry meaning
  
   {\immediatewriteutilitytua{ti(js['#1'],{'e','#2',\!!bs#3\!!es,\!!bs#4\!!es})}}
  
   seems to work
 
  this line should be
 
  \def\mksavesortedlistentry#1#2#3#4% class key entry meaning

  {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#1',\!!bs#2\!!es,\!!bs#3\!!es})}}

 Both versions give wrong output with optional arguments. But the following
 version works for me:

I forgot to mention you have to regenrate the format with my solution, your
seems to work but I found a way to stop processing because you the optinal
argument can also be used to write a mcro in the first pair of braces and this
can produce problems.

You can try to add the following synonym and TeX give you a error message.

\test[zB]{z.\thinspace B.}{zum Beispiel}

 % engine=luatex
 \unprotect
 \def\mksavesortedlistentry#1#2#3#4% class key entry meaning
   
 {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#3',\!!bs#3\!!es,\!!bs#4\!!es})}}
 \protect
 \definesynonyms[test][tests]
 \test[bbb]{short text}{long description}
 \test[aaa]{a short text}{a long description}
 \starttext
 \bbb~\aaa
 \placelistoftests
 \stoptext

 Cheers, Peter

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


Re: [NTG-context] synonyms with MKIV

2007-12-05 Thread Peter Münster
On Wed, Dec 05, 2007 at 09:29:08AM +0100, Wolfgang Schuster wrote:
  
   this line should be
  
   \def\mksavesortedlistentry#1#2#3#4% class key entry meaning
 
   {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#1',\!!bs#2\!!es,\!!bs#3\!!es})}}
 
  Both versions give wrong output with optional arguments. But the following
  version works for me:
 
 I forgot to mention you have to regenrate the format with my solution, your
 seems to work but I found a way to stop processing because you the optinal
 argument can also be used to write a mcro in the first pair of braces and this
 can produce problems.

I've also regenrated the format. But now I understand better: it works well
with your patch for core-syn.lua and Hans' patch for core-syn.mkiv:
  
{\immediatewriteutilitytua{table.insert(js['#1'],{'e','#2',\!!bs#3\!!es,\!!bs#4\!!es})}}

Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] synonyms with MKIV

2007-12-05 Thread Hans Hagen
Peter Münster wrote:
 On Wed, Dec 05, 2007 at 09:29:08AM +0100, Wolfgang Schuster wrote:
 this line should be

 \def\mksavesortedlistentry#1#2#3#4% class key entry meaning
   
 {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#1',\!!bs#2\!!es,\!!bs#3\!!es})}}
 Both versions give wrong output with optional arguments. But the following
 version works for me:
 I forgot to mention you have to regenrate the format with my solution, your
 seems to work but I found a way to stop processing because you the optinal
 argument can also be used to write a mcro in the first pair of braces and 
 this
 can produce problems.
 
 I've also regenrated the format. But now I understand better: it works well
 with your patch for core-syn.lua and Hans' patch for core-syn.mkiv:
   
 {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#2',\!!bs#3\!!es,\!!bs#4\!!es})}}

can you summarize what i need to change?


-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] synonyms with MKIV

2007-12-04 Thread Wolfgang Schuster
2007/12/3, Hans Hagen [EMAIL PROTECTED]:
 Wolfgang Schuster wrote:
  2007/12/3, Peter Münster [EMAIL PROTECTED]:
  Hello,
 
  I get unexpected output with this test-file:
 
  % engine=luatex
  \definesynonyms[test][tests]
  \test{testOne}{first test}
  \test{testTwo}{second test}
  \starttext
  \testOne
  \placelistoftests
  \stoptext
 
  I would expect:
 
  testOne
  testOne first test
 
  but I get:
 
  testOne
  testtestOne
 
  (Perhaps a problem with parameter numbers #1, #2 etc. ?)
 
  Cheers, Peter
 
  Hi Peter,
 
  this is a bug in the mkiv sorting macros, I posted a similiar message
  a few days ago but got no answer.

 \def\mksavesortedlistentry#1#2#3#4% class key entry meaning

 {\immediatewriteutilitytua{ti(js['#1'],{'e','#2',\!!bs#3\!!es,\!!bs#4\!!es})}}

 seems to work

this line should be

\def\mksavesortedlistentry#1#2#3#4% class key entry meaning
  
{\immediatewriteutilitytua{table.insert(js['#1'],{'e','#1',\!!bs#2\!!es,\!!bs#3\!!es})}}

but there is also a big in core-syn.lua

the following works for me, the order is key, value and not value, key.

I patched this at the moment in my format files and the output of
the synonym table is now correct :-)

function job.loadsortedlist(class)
if job.sortedlists[class] then
if not sorters.list.data[class] then
sorters.list.data[class] = {
language = 'en',
entries  = { },
flush= function(s) tex.sprint(tex.ctxcatcodes,s) end,
sorted   = false,
class= class
}
local entries = sorters.list.data[class].entries
for k,v in ipairs(job.sortedlists[class]) do
if v[1] == 'l' then -- language
sorters.list.data[class].language = v[2]
else
entries[#entries+1] = {
v[1],   -- kind (e)
{ { v[2], v[3] } }, -- key, entry
v[4]-- optional meaning
}
end
end
end
sorters.list.process(sorters.list.data[class])
end
end

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


Re: [NTG-context] synonyms with MKIV

2007-12-04 Thread Peter Münster
On Tue, Dec 04, 2007 at 04:57:51PM +0100, Wolfgang Schuster wrote:

   this is a bug in the mkiv sorting macros, I posted a similiar message
   a few days ago but got no answer.

Hello Wolfgang,

Indeed, now I remember...
(But one long week was time enough for me to forget it.)

  \def\mksavesortedlistentry#1#2#3#4% class key entry meaning
 
  {\immediatewriteutilitytua{ti(js['#1'],{'e','#2',\!!bs#3\!!es,\!!bs#4\!!es})}}
 
  seems to work
 
 this line should be
 
 \def\mksavesortedlistentry#1#2#3#4% class key entry meaning
   
 {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#1',\!!bs#2\!!es,\!!bs#3\!!es})}}

Both versions give wrong output with optional arguments. But the following
version works for me:

% engine=luatex
\unprotect
\def\mksavesortedlistentry#1#2#3#4% class key entry meaning
  
{\immediatewriteutilitytua{table.insert(js['#1'],{'e','#3',\!!bs#3\!!es,\!!bs#4\!!es})}}
\protect
\definesynonyms[test][tests]
\test[bbb]{short text}{long description}
\test[aaa]{a short text}{a long description}
\starttext
\bbb~\aaa
\placelistoftests
\stoptext

Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] synonyms with MKIV

2007-12-03 Thread Peter Münster
Hello,

I get unexpected output with this test-file:

% engine=luatex
\definesynonyms[test][tests]
\test{testOne}{first test}
\test{testTwo}{second test}
\starttext
\testOne
\placelistoftests
\stoptext

I would expect:

testOne
testOne first test

but I get:

testOne
testtestOne

(Perhaps a problem with parameter numbers #1, #2 etc. ?)

Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] synonyms with MKIV

2007-12-03 Thread Wolfgang Schuster
2007/12/3, Peter Münster [EMAIL PROTECTED]:
 Hello,

 I get unexpected output with this test-file:

 % engine=luatex
 \definesynonyms[test][tests]
 \test{testOne}{first test}
 \test{testTwo}{second test}
 \starttext
 \testOne
 \placelistoftests
 \stoptext

 I would expect:

 testOne
 testOne first test

 but I get:

 testOne
 testtestOne

 (Perhaps a problem with parameter numbers #1, #2 etc. ?)

 Cheers, Peter

Hi Peter,

this is a bug in the mkiv sorting macros, I posted a similiar message
a few days ago but got no answer.

http://archive.contextgarden.net/message/20071125.084213.6c34633f.en.html

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


Re: [NTG-context] synonyms with MKIV

2007-12-03 Thread Hans Hagen
Wolfgang Schuster wrote:

 this is a bug in the mkiv sorting macros, I posted a similiar message
 a few days ago but got no answer.
 
 http://archive.contextgarden.net/message/20071125.084213.6c34633f.en.html

no time yet -)

Hans

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] synonyms with MKIV

2007-12-03 Thread Hans Hagen
Wolfgang Schuster wrote:
 2007/12/3, Peter Münster [EMAIL PROTECTED]:
 Hello,

 I get unexpected output with this test-file:

 % engine=luatex
 \definesynonyms[test][tests]
 \test{testOne}{first test}
 \test{testTwo}{second test}
 \starttext
 \testOne
 \placelistoftests
 \stoptext

 I would expect:

 testOne
 testOne first test

 but I get:

 testOne
 testtestOne

 (Perhaps a problem with parameter numbers #1, #2 etc. ?)

 Cheers, Peter
 
 Hi Peter,
 
 this is a bug in the mkiv sorting macros, I posted a similiar message
 a few days ago but got no answer.

\def\mksavesortedlistentry#1#2#3#4% class key entry meaning
 
{\immediatewriteutilitytua{ti(js['#1'],{'e','#2',\!!bs#3\!!es,\!!bs#4\!!es})}}

seems to work

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___