cldf-ini.mkiv / last modification: 2020-01-30 14:16
%D \module
%D   [       file=cldf-ini,
%D        version=2010.10.19,,
%D          title=\CONTEXT\ \LUA\ Document Functions,
%D       subtitle=Initialization,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Lua Documents / Initialization}

\newcount\trialtypesettingstate % gets aliased at the Lua end


%D With each new update of \MKIV\ we can join Within Temptation in
%D singing:
%D \startbuffer
%D \startluacode
%D     context("I go faster%s",string.rep(" and faster",6))
%D \stopluacode
%D \cldcontext{"I go faster\letterpercent s",
%D     string.rep(" and faster",6)}
%D \stopbuffer
%D \typebuffer \getbuffer
%D Anyway \unknown\ the following are {\em not} user commands:

% \zerocount removes as it's the default

% \def\cldf#1{\directlua{_cldf_(#1)}} % global (functions)
% \def\cldn#1{\directlua{_cldn_(#1)}} % global (nodes)
% \ifx\luafunction\undefined
%     \def\luafunction#1{\directlua{_cldl_(#1)}}
% \fi


% \catcode`=\activecatcode \let\luafunction % saves 10% on the call

% \catcodetable\ctxcatcodes \catcode`^=\superscriptcatcode\catcode1=\activecatcode \glet^^A=\cldf
% \catcodetable\ctxcatcodes \catcode`^=\superscriptcatcode\catcode2=\activecatcode \glet^^B=\cldn

                \def\cldloadfile   #1{\directlua{context.loadfile("#1")}}
                \def\cldcontext    #1{\directlua{context(#1)}}
                \def\cldcommand    #1{\directlua{context.#1}}
              % \def\cldverbatim   #1{\directlua{context.verbatim.#1}} % maybe make verbatim global