cldf-ini.mkiv /size: 1980 b    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=cldf-ini,
3
%D version=2010.10.19,,
4
%D title=\CONTEXT\ \LUA\ Document Functions,
5
%D subtitle=Initialization,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
\writestatus
{
loading
}{
ConTeXt
Lua
Documents
/
Initialization
}
15 16
\newcount
\trialtypesettingstate
% gets aliased at the Lua end
17 18
\registerctxluafile
{
cldf
-
ini
}{}
19 20
%D With each new update of \MKIV\ we can join Within Temptation in singing:
21
%D
22
%D \startbuffer
23
%D \startluacode
24
%D context("I go faster%s",string.rep(" and faster",6))
25
%D \stopluacode
26
%D
27
%D \cldcontext{"I go faster\letterpercent s",
28
%D string.rep(" and faster",6)}
29
%D \stopbuffer
30
%D
31
%D \typebuffer \getbuffer
32
%D
33
%D Anyway \unknown\ the following are {\em not} user commands:
34 35
% \zerocount removes as it's the default
36 37
% \def\cldf#1{\directlua{_cldf_(#1)}} % global (functions)
38
% \def\cldn#1{\directlua{_cldn_(#1)}} % global (nodes)
39
%
40
% \ifx\luafunction\undefined
41
% \def\luafunction#1{\directlua{_cldl_(#1)}}
42
% \fi
43 44
\let
\cldl
\luafunction
45
\let
\cldd
\lateluafunction
46 47
% \catcode`=\activecatcode \let\luafunction % saves 10% on the call
48 49
% \catcodetable\ctxcatcodes \catcode`^=\superscriptcatcode\catcode1=\activecatcode \glet^^A=\cldf
50
% \catcodetable\ctxcatcodes \catcode`^=\superscriptcatcode\catcode2=\activecatcode \glet^^B=\cldn
51 52
\normalprotected\def
\cldprocessfile
#
1
{
\directlua{
context
.
runfile
(
"
#1
"
)
}
}
53
\def
\cldloadfile
#
1
{
\directlua{
context
.
loadfile
(
"
#1
"
)
}
}
54
\def
\cldloadviafile
#
1
{
\directlua{
context
.
loadviafile
(
"
#1
"
)
}
}
55
\def
\cldcontext
#
1
{
\directlua{
context
(
#
1
)
}
}
56
\def
\cldcommand
#
1
{
\directlua{
context
.
#
1
}
}
57
% \def\cldverbatim #1{\directlua{context.verbatim.#1}} % maybe make verbatim global
58 59
\endinput
60