diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/scrp-ini.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/scrp-ini.mkiv | 79 |
1 files changed, 26 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/context/base/scrp-ini.mkiv b/Master/texmf-dist/tex/context/base/scrp-ini.mkiv index 6e6b1061032..0e50452ff3b 100644 --- a/Master/texmf-dist/tex/context/base/scrp-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/scrp-ini.mkiv @@ -15,9 +15,10 @@ \registerctxluafile{scrp-ini}{1.001} \registerctxluafile{scrp-cjk}{1.001} +\registerctxluafile{scrp-eth}{1.001} -\definesystemattribute[preproc] \chardef\preprocattribute \dogetattributeid{preproc} -\definesystemattribute[prestat] \chardef\prestatattribute \dogetattributeid{prestat} +\definesystemattribute[preproc][public] +\definesystemattribute[prestat][public] %D Since scripts need specific \LUA\ code we use hard coded attribute %D values, but we might have more tricks at some time, so we use a @@ -25,67 +26,39 @@ \unprotect -\def\s!attribute{attribute} +\installcommandhandler\??ls{script}\??ls -\def\namedscriptparameter#1#2% - {\csname\doscriptparameter{\??ls#1}#2\endcsname} +% presets are global and are currently defined in lua -\def\scriptparameter#1% - {\csname\doscriptparameter{\??ls\currentscript}#1\endcsname} +\appendtoks + \setuevalue\currentscript{\setscript[\currentscript]}% +\to \everydefinescript -\def\doscriptparameter#1#2% - {\ifcsname#1#2\endcsname#1#2\else\expandafter\doscriptparentparameter\csname#1\s!parent\endcsname#2\fi} +\unexpanded\def\dosetscript + {\ctxlua{scripts.set("\currentscript","\scriptparameter\c!method","\scriptparameter\c!preset")}} -\def\doscriptparentparameter#1#2% - {\ifx#1\relax\s!empty\else\doscriptparameter#1#2\fi} +\unexpanded\def\setscript[#1]% + {\edef\currentscript{#1}% + \dosetscript} -% \def\scriptparameterhash#1% -% {\doscriptparameterhash{\??ls\currentscript}#1} -% -% \def\doscriptparameterhash#1#2% -% {\ifcsname#1#2\endcsname#1\else\expandafter\doscriptparentparameterhash\csname#1\s!parent\endcsname#2\fi} -% -% \def\doscriptparentparameterhash#1#2% -% {\ifx#1\relax\else\doscriptparameterhash#1#2\fi} +\unexpanded\def\resetscript + {\ctxlua{scripts.reset()}} -% when #2 == string, then only synonym, no settings +\unexpanded\def\startscript[#1]% + {\begingroup + \edef\currentscript{#1}% + \dosetscript} -\unexpanded\def\definescript - {\dodoubleargument\dodefinescript} +\unexpanded\def\stopscript + {\endgroup} -\def\dodefinescript[#1][#2]% - {\doifassignmentelse{#2} - {\getparameters[\??ls#1][\c!method=,\s!parent=,#2]% - \doifelsenothing{\namedscriptparameter{#1}\c!method} - {\letvalue {\??ls#1\s!attribute}\attributeunsetvalue}% - {\setevalue{\??ls#1\s!attribute}{\ctxlua{scripts.define("\namedscriptparameter{#1}\c!method")}}}}% - {\getparameters[\??ls#1][\s!parent=#2]}% - \setvalue{#1}{\dosetscript{#1}}} - -\unexpanded\def\setupscript - {\dodoubleargument\dosetupscript} - -\def\dosetupscript[#1][#2]% - {\getparameters[\??ls#1][#2]} - -\def\dosetscript#1% - {\def\currentscript{#1}% - \edef\currentscriptattribute{\scriptparameter\s!attribute}% - \ifx\currentscriptattribute\empty - \let\currentscript\empty - \attribute\preprocattribute\attributeunsetvalue - \else - \attribute\preprocattribute\currentscriptattribute\relax % we can speed this up by storing the attribute in ??ls:a:#1 - \fi} +% \setscript[hangul] \hangul \startscript[hangul] -\def\setscript [#1]{\dosetscript{#1}} -\unexpanded\def\startscript[#1]{\begingroup\dosetscript{#1}} -\unexpanded\def\stopscript {\endgroup} +\definescript[hangul] [\c!method=hangul] +\definescript[hanzi] [\c!method=hanzi] -% \setscript[hangul] \hangul \startscript[hangul] +\definescript[ethiopic] [\c!method=ethiopic] -\definescript[latin] [\c!method=] % resets the attribute -\definescript[hangul][\c!method=hangul] -\definescript[hanzi] [\c!method=hanzi] +\definescript[latin] [\c!method=] % resets the attribute (also currentscript) \protect \endinput |