[NTG-context] Movable code, was Re: starttexdefinition error in standalone, works in TL2013

2014-03-12 Thread Rik

On 2014-03-01 07:32, Wolfgang Schuster wrote:


\unexpanded\def\startTranslation
   {\begingroup
\dosingleempty\dostartTranslation}

\def\dostartTranslation[#1]%
   {\iffirstargument
  \getrawparameters[Translation][setups=,language=en,#1]%
\fi
\grabbufferdata[Translation][startTranslation][stopTranslation]}

\def\stopTranslation
   {\language[\Translationlanguage]%
\Translationsetups
(\,\getbufferdata[Translation]\removeunwantedspaces\,)%
\endgroup}

\starttext

\startTranslation[language=nl]
It betrays a slow-witted mentality to pursue the streams, but not to see the 
sources of things.
\stopTranslation

\stoptext

Wolfgang



Wolfgang (and list),

The above code works fine with simple texts, but is not movable. Adding 
a footnote, as in the following, to the text section shows that:


   \starttext
   \startTranslation[language=en]
  It betrays a slow-witted mentality to pursue the streams, but not to
  see the sources of things.%
  \footnote{%
\startTranslation[language=la]
  Tardi ingeni est rivulos consectari, fontes rerum non videre.
\stopTranslation%
  }
   \stopTranslation
   \stoptext


or even by:

   \starttext
  It betrays a slow-witted mentality to pursue the streams, but not to
  see the sources of things.%
  \footnote{%
\startTranslation[language=la]
  Tardi ingeni est rivulos consectari, fontes rerum non videre.
\stopTranslation%
  }
   \stoptext


In LaTeX, this might be dealt with by a combination robust command 
definitions and \protected. When I wrote an endnotes routine in LaTeX, I 
used those and wrote the notes to a file which was then read back in at 
the appropriate time, but that does not help with pagenotes.


I imagine that at the time the footnote is processed the 
Translationsetups and Translationlanguage macros are no longer defined, 
and I have no idea how one would reference the buffer contents, although 
it does look like they have stable names in the log file.


Can this be made movable?

Also, am I correct that the \iffirstargument test in the definition of 
dostarttranslation is redundant? My understanding is that \dosingleempty 
assures the presence of [#1].


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

Re: [NTG-context] starttexdefinition error in standalone, works in TL2013

2014-03-01 Thread Wolfgang Schuster

Am 27.02.2014 um 05:08 schrieb Rik Kabel cont...@rik.users.panix.com:

 The following code processes cleanly under TL2013 and fails with ConTeXt  
 ver: 2014.02.14 17:07 MKIV beta  fmt: 2014.2.16  int: english/english. I 
 suspect a regression, but I am also open to being told that I am doing things 
 incorrectly.

The \starttexdefinition was extended after the texlive release to support 
keywords like global or expanded and has therefore changed since then. The 
reason why it fails is that context passes the argument to Lua where they are 
parsed and at this point macros like your \EndTranslation are expanded. Even 
though this can be fixed I think it’s better to use the normal \def command 
when you want to create delimited commands.

 I also notice that it fails (even under TL2013) if a space is inserted after 
 [#SETUP] in the doTrans intro. I thought that spaces should be allowed in 
 \starttexdefinition -- is this only in the body and not the parameter 
 description?

No, spaces between arguments aren’t ignored but no spaces are added at the end 
of each line in the replacement text.

\starttexdefinition Test #1 #2
  “#2” “#1”
\stoptexdefinition

\starttext

\Test ab cd

\stoptext

BTW: It’s better to follow contexts rules and use start/stop for environments, 
this way you can make use of the buffer mechanism to store text.

\unexpanded\def\startTranslation
  {\begingroup
   \dosingleempty\dostartTranslation}

\def\dostartTranslation[#1]%
  {\iffirstargument
 \getrawparameters[Translation][setups=,language=en,#1]%
   \fi
   \grabbufferdata[Translation][startTranslation][stopTranslation]}

\def\stopTranslation
  {\language[\Translationlanguage]%
   \Translationsetups
   (\,\getbufferdata[Translation]\removeunwantedspaces\,)%
   \endgroup}

\starttext

\startTranslation[language=nl]
It betrays a slow-witted mentality to pursue the streams, but not to see the 
sources of things.
\stopTranslation

\stoptext

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


Re: [NTG-context] starttexdefinition error in standalone, works in TL2013

2014-03-01 Thread Rik Kabel

On 2014-03-01 07:32, Wolfgang Schuster wrote:

Am 27.02.2014 um 05:08 schrieb Rik Kabel cont...@rik.users.panix.com:


{useful information on TL2013 and starttexdefinition skipped}


BTW: It’s better to follow contexts rules and use start/stop for environments, 
this way you can make use of the buffer mechanism to store text.

\unexpanded\def\startTranslation
   {\begingroup
\dosingleempty\dostartTranslation}

\def\dostartTranslation[#1]%
   {\iffirstargument
  \getrawparameters[Translation][setups=,language=en,#1]%
\fi
\grabbufferdata[Translation][startTranslation][stopTranslation]}

\def\stopTranslation
   {\language[\Translationlanguage]%
\Translationsetups
(\,\getbufferdata[Translation]\removeunwantedspaces\,)%
\endgroup}

\starttext

\startTranslation[language=nl]
It betrays a slow-witted mentality to pursue the streams, but not to see the 
sources of things.
\stopTranslation

\stoptext



Thank you for the excellent example. The only problem I see is that it 
fails if no optional argument is present (in which case the keyval 
settings \TranslationXXX never get defined). This is easily remedied by 
removing the \iffirstargument and \fi wrapping the \getrawparameters.


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


Re: [NTG-context] starttexdefinition error in standalone, works in TL2013

2014-02-27 Thread Rik Kabel

On 2014-02-26 23:08, Rik Kabel wrote:
The following code processes cleanly under TL2013 and fails with 
ConTeXt  ver: 2014.02.14 17:07 MKIV beta  fmt: 2014.2.16  int: 
english/english. I suspect a regression, but I am also open to being 
told that I am doing things incorrectly.


--
Rik Kabel

Sorry for the not-so-minimal example with the obvious errors around the 
setup. Here is a stripped version that shows the problem:


   % macros=mkvi

   \let\EndTranslation\relax

   % The following should work, but fails with current beta
   \starttexdefinition Trans #TRANSLATION\EndTranslation
  #TRANSLATION
   \stoptexdefinition

   % This version works with both TexLive and current standalone beta
   \def\Translation#TRANSLATION\EndTranslation%
   {#TRANSLATION%
   }

   \starttext

   Translation using \tex{def}{\tex{doTranslation}} works both with
   TL2013 and current beta.

   \Translation
  It betrays a slow-witted mentality to pursue the streams, but not
   to see the sources of things.
   \EndTranslation

   \blank

   Translation using \tex{starttexdef doTrans} fails with current beta.

   \Trans
  It betrays a slow-witted mentality to pursue the streams, but not
   to see the sources of things.
   \EndTranslation

   \stoptext

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

[NTG-context] starttexdefinition error in standalone, works in TL2013

2014-02-26 Thread Rik Kabel
The following code processes cleanly under TL2013 and fails with 
ConTeXt  ver: 2014.02.14 17:07 MKIV beta  fmt: 2014.2.16  int: 
english/english. I suspect a regression, but I am also open to being 
told that I am doing things incorrectly.


I also notice that it fails (even under TL2013) if a space is inserted 
after [#SETUP] in the doTrans intro. I thought that spaces should be 
allowed in \starttexdefinition -- is this only in the body and not the 
parameter description?


   % macros=mkvi

   \showframe


   \let\EndTranslation\relax

   \starttexdefinition Trans
  \dosingleempty\doTrans
   \stoptexdefinition

   % The following should work, but fails with current beta
   \starttexdefinition doTrans [#SETUP]#TRANSLATION\EndTranslation
  \language[en]
   \doifsomething{#1}{\getparameters[TR][setup=,#SETUP]\TRsetup}
  \noindentation\blank[halfline]
  (\,\ignorespaces#TRANSLATION\removeunwantedspaces\,)
   \stoptexdefinition

   \starttexdefinition Translation
  \dosingleempty\doTranslation
   \stoptexdefinition

   % This version works with both Texlive and current standalone beta
   \def\doTranslation[#SETUP]#TRANSLATION\EndTranslation%
   {\language[en]%
 \doifsomething{#SETUP}%
   {\getparameters[TR][setup=,#SETUP]\TRsetup}%
 \noindentation\blank[halfline]%
 (\,\ignorespaces#TRANSLATION\removeunwantedspaces\,)%
   }

   \starttext

   Translation using \tex{def}{\tex{doTranslation}} works both with
   TL2013 and current beta.

   \Translation[language=en]
  It betrays a slow-witted mentality to pursue the streams, but not
   to see the sources of things.
   \EndTranslation

   \blank

   Translation using \tex{starttexdef doTrans} fails with current beta.

   \Trans[language=en]
  It betrays a slow-witted mentality to pursue the streams, but not
   to see the sources of things.
   \EndTranslation

   \stoptext

--
Rik Kabel



___
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] Lua conditionals fail inside \starttexdefinition

2012-09-05 Thread Hans Hagen

On 4-9-2012 20:44, Marco Patzer wrote:

On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:


Why does adding semicolon not work?


Do you have a example?



\starttext
\startluacode
   if true then;
 context(true)
   else;
 context(false)
   end
\stopluacode
\stoptext


\ctxlua{context(tostring(some condition)}

given that the condition returns true/false

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


[NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
Hi,

I discovered strange behaviour concerning Lua conditionals within
texdefinitions.

ConTeXt complains: 'then' expected near 'thenelseend'.

I guess it has something to do with how the content of a
texdefinitions is grabbed. Seems like a bug or is this by design?


% This works fine
\def\mycmd{%
  \startluacode
if true then
else
end
  \stopluacode}

% This one fails
% \starttexdefinition mycmd
%   \startluacode
% if true then
% else
% end
%   \stopluacode
% \stoptexdefinition

\startluacode
  userdata = userdata or { }
  function userdata.myfun()
if true then
else
end
  end
\stopluacode

% This also works fine
\starttexdefinition mycmd
  \luacode{userdata.myfun()}
\stoptexdefinition

\mycmd


Marco

___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Wolfgang Schuster

Am 04.09.2012 um 14:21 schrieb Marco Patzer home...@lavabit.com:

 Hi,
 
 I discovered strange behaviour concerning Lua conditionals within
 texdefinitions.
 
 ConTeXt complains: 'then' expected near 'thenelseend'.
 
 I guess it has something to do with how the content of a
 texdefinitions is grabbed. Seems like a bug or is this by design?

When you use the texdefinition environment to create a command
the end of line character which results normally in a space is ignored
sees “thenelseend” as a single string, in such a case you can add
a space and put a comment sign at the end of the line.

 % This one fails
 % \starttexdefinition mycmd
 %   \startluacode
 % if true then
 % else
 % end
 %   \stopluacode
 % \stoptexdefinition

\starttexdefintion mycmd
  \startluacode
if true then %
else %
end
  \stopluacode
\stoptexdefinition

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


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Aditya Mahajan

On Tue, 4 Sep 2012, Wolfgang Schuster wrote:



Am 04.09.2012 um 14:21 schrieb Marco Patzer home...@lavabit.com:


Hi,

I discovered strange behaviour concerning Lua conditionals within
texdefinitions.

ConTeXt complains: 'then' expected near 'thenelseend'.

I guess it has something to do with how the content of a
texdefinitions is grabbed. Seems like a bug or is this by design?


When you use the texdefinition environment to create a command
the end of line character which results normally in a space is ignored
sees “thenelseend” as a single string, in such a case you can add
a space and put a comment sign at the end of the line.


% This one fails
% \starttexdefinition mycmd
%   \startluacode
% if true then
% else
% end
%   \stopluacode
% \stoptexdefinition


\starttexdefintion mycmd
 \startluacode
   if true then %
   else %
   end
 \stopluacode
\stoptexdefinition


Why does adding semicolon not work?

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

Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Wolfgang Schuster

Am 04.09.2012 um 20:24 schrieb Aditya Mahajan adit...@umich.edu:

 Why does adding semicolon not work?

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


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:

  Why does adding semicolon not work?
 
 Do you have a example?


\starttext
\startluacode
  if true then;
context(true)
  else;
context(false)
  end
\stopluacode
\stoptext


Marco

___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Herbert Voss

Am 04.09.2012 20:44, schrieb Marco Patzer:

On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:


Why does adding semicolon not work?


Do you have a example?



\starttext
\startluacode
   if true then;
 context(true)
   else;
 context(false)
   end
\stopluacode
\stoptext


that is no Lua syntax

Herbert

___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

Hi Herbert,

  \starttext
  \startluacode
 if true then;
   context(true)
 else;
   context(false)
 end
  \stopluacode
  \stoptext
 
 that is no Lua syntax

if true then;
  print(true)
else;
  print(false)
end

This snippet fed into a standalone Lua interpreter prints “true” on
the terminal.

I admit, I did not look up the syntax in the manual, but I have in
mind that semicolons can be used to separate statements that are on
one line.


Marco

___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Aditya Mahajan

On Tue, 4 Sep 2012, Herbert Voss wrote:


Am 04.09.2012 20:44, schrieb Marco Patzer:

On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:


Why does adding semicolon not work?


Do you have a example?



\starttext
\startluacode
   if true then;
 context(true)
   else;
 context(false)
   end
\stopluacode
\stoptext


that is no Lua syntax


I thought that semicolons were optional in lua are equal to end of lines.

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


Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread luigi scarso
On Tue, Sep 4, 2012 at 9:05 PM, Marco Patzer home...@lavabit.com wrote:

 On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

 Hi Herbert,

   \starttext
   \startluacode
  if true then;
context(true)
  else;
context(false)
  end
   \stopluacode
   \stoptext
 
  that is no Lua syntax

 if true then;
   print(true)
 else;
   print(false)
 end

 This snippet fed into a standalone Lua interpreter prints “true” on
 the terminal.

 Not in my lua interpreter: saving the snippet into test.lua
$lua test.lua
gives
lua: test.lua:1: unexpected symbol near ';'


-- 
luigi
___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Herbert Voss

Am 04.09.2012 21:05, schrieb Marco Patzer:


if true then;
   print(true)
else;
   print(false)
end

This snippet fed into a standalone Lua interpreter prints “true” on
the terminal.

I admit, I did not look up the syntax in the manual, but I have in
mind that semicolons can be used to separate statements that are on
one line.


voss@shania:~/ConTeXt lua zzz.lua
lua: zzz.lua:1: unexpected symbol near ';'

voss@shania:~/ConTeXt lua -v
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

Herbert
___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread luigi scarso
On Tue, Sep 4, 2012 at 9:05 PM, Aditya Mahajan adit...@umich.edu wrote:

 On Tue, 4 Sep 2012, Herbert Voss wrote:

  Am 04.09.2012 20:44, schrieb Marco Patzer:

 On 2012-09-04 Wolfgang Schuster wolfgang.schus...@gmail.com wrote:

  Why does adding semicolon not work?


 Do you have a example?



 \starttext
 \startluacode
if true then;
  context(true)
else;
  context(false)
end
 \stopluacode
 \stoptext


 that is no Lua syntax


 I thought that semicolons were optional in lua are equal to end of lines.

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



http://www.lua.org/manual/5.1/manual.html#2.4.4

The unit of execution of Lua is called a chunk. A chunk is simply a
sequence of statements, which are executed sequentially. Each statement can
be optionally followed by a semicolon:
:
:
2.4.4 - Control Structures

The control structures if, while, and repeat have the usual meaning and
familiar syntax:

stat ::= while exp do block end
stat ::= repeat block until exp
stat ::= if exp then block {elseif exp then block} [else block] end

(as conseguence
if exp then; block else; block end
is not valid
)

-- 
luigi
___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Herbert Voss

Am 04.09.2012 21:22, schrieb luigi scarso:


http://www.lua.org/manual/5.1/manual.html#2.4.4

The unit of execution of Lua is called a chunk. A chunk is simply a
sequence of statements, which are executed sequentially. Each statement
can be optionally followed by a semicolon:
:
:
2.4.4 - Control Structures

The control structures if, while, and repeat have the usual meaning and
familiar syntax:

stat ::= while exp do block end
stat ::= repeat block until exp
stat ::= if exp then block {elseif exp then block} [else block] end

(as conseguence
if exp then; block else; block end
is not valid
)


yes, see also: http://www.lua.org/manual/5.1/manual.html#8

Herbert

___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

 voss@shania:~/ConTeXt lua zzz.lua
 lua: zzz.lua:1: unexpected symbol near ';'

marco@homerow:/tmp$ lua t.lua
true

 voss@shania:~/ConTeXt lua -v
 Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

marco@homerow:/tmp$ lua -v
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio


Marco

___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Herbert Voss

Am 04.09.2012 21:35, schrieb Marco Patzer:

On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:


voss@shania:~/ConTeXt lua zzz.lua
lua: zzz.lua:1: unexpected symbol near ';'


marco@homerow:/tmp$ lua t.lua
true


voss@shania:~/ConTeXt lua -v
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio


marco@homerow:/tmp$ lua -v
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio


the syntax changes, see http://www.lua.org/manual/5.2/manual.html#9

Herbert
___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread luigi scarso
On Tue, Sep 4, 2012 at 9:35 PM, Marco Patzer home...@lavabit.com wrote:

 On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

  voss@shania:~/ConTeXt lua zzz.lua
  lua: zzz.lua:1: unexpected symbol near ';'

 marco@homerow:/tmp$ lua t.lua
 true

  voss@shania:~/ConTeXt lua -v
  Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

 marco@homerow:/tmp$ lua -v
 Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio


Because in Lua 5.2 there is the empty statements
http://www.lua.org/manual/5.2/manual.html#3

3.3.1 – Blocks

A block is a list of statements, which are executed sequentially:

block ::= {stat}
Lua has empty statements that allow you to separate statements with
semicolons, start a block with a semicolon or write two semicolons in
sequence:

stat ::= ‘;’

So
stat ::= if exp then block {elseif exp then block} [else block] end

means that
if exp then
;
else
;
end
is valid.

Luatex still uses lua 5.1.4


-- 
luigi
___
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] Lua conditionals fail inside \starttexdefinition

2012-09-04 Thread Marco Patzer
On 2012-09-04 Herbert Voss herbert.v...@fu-berlin.de wrote:

  voss@shania:~/ConTeXt lua -v
  Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
 
  marco@homerow:/tmp$ lua -v
  Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 
 the syntax changes, see http://www.lua.org/manual/5.2/manual.html#9

You're totally right. LuaTeX uses does not use lua 5.2 and therefore
the semicolon syntax is wrong. I also get an “unexpected symbol”
with lua5.1

Thanks for the clarification


Marco

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

[NTG-context] \starttexdefinition and @ in macroname in mkvi

2011-12-30 Thread Aditya Mahajan

Hi,

@, !, _ etc.\ are not recognized as part of the macro name when using MkVI named
arguments with \starttexdefinition. For example, consider the following example:

\unprotect
\starttexdefinition test@again #name
  Name is #name
\stoptexdefinition
\protect

Processing this file using

mtxrun --script interface --preprocess test.mkvi --force

shows that #name is not recognized as a parameter. The preprocessing works if I
remove the @ from the macro name.

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


Re: [NTG-context] \starttexdefinition and @ in macroname in mkvi

2011-12-30 Thread Hans Hagen

On 30-12-2011 10:43, Aditya Mahajan wrote:

Hi,

@, !, _ etc.\ are not recognized as part of the macro name when using
MkVI named
arguments with \starttexdefinition. For example, consider the following
example:

\unprotect
\starttexdefinition test@again #name
Name is #name
\stoptexdefinition
\protect

Processing this file using

mtxrun --script interface --preprocess test.mkvi --force

shows that #name is not recognized as a parameter. The preprocessing
works if I
remove the @ from the macro name.


ok, supported now, but of course it will only work out in unprotected mode

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