[NTG-context] Where to put a module?

Wolfgang Schuster schuster.wolfgang at googlemail.com
Sun Mar 7 18:12:00 CET 2010


Am 07.03.10 17:59, schrieb Philipp Gesang:
> * It is common in ConTeXt to also provide a \starttransliteration
>> ... \stoptransliteration pair (but there is no requirement).
>>
> I noticed that and of course I would like to provide an environment but
> until now I had no luck implementing it; I'm stuck at the following:
>
> \def\starttransliterate {%
>    \bgroup\dostarttransliterate%
> }
>
> \def\stoptransliterate {%
>    \egroup
>    \transliterate{%
>      \getbuffer[trl]%
>    }%
> }
>
> \def\dostarttransliterate{%
>    \dostartbuffer[trl][starttransliterate][stoptransliterate]%
> }
>
> and the buffer content isn't expanded before it is passed to lua; adding
> \@EA at various places has no effect either.

\def\starttransliterate
   {\bgroup
    \dosingleempty\dostarttransliterate}

\long\def\dostarttransliterate[#1]#2\stoptransliterate
   {\iffirstargument
      \setuptransliterate[#1]%
    \fi
    \translate[\TRLhyphenate]%
    \ctxlua{translit.transliterate("\TRLmode","\luaescapestring{#2}")}%
    \egroup}

Wolfgang



More information about the ntg-context mailing list