ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: starttexdefinition error in standalone, works in TL2013
Date: Sat, 1 Mar 2014 13:32:17 +0100	[thread overview]
Message-ID: <4FDA647E-AA4E-4619-88EE-65DE254BA093@gmail.com> (raw)
In-Reply-To: <530EBA58.3020703@rik.users.panix.com>


Am 27.02.2014 um 05:08 schrieb Rik Kabel <context@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
___________________________________________________________________________________


  parent reply	other threads:[~2014-03-01 12:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27  4:08 Rik Kabel
2014-02-27 15:13 ` Rik Kabel
2014-03-01 12:32 ` Wolfgang Schuster [this message]
2014-03-01 17:01   ` Rik Kabel
2014-03-12 19:49   ` Movable code, was " Rik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FDA647E-AA4E-4619-88EE-65DE254BA093@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).