summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-it.mkii1
-rw-r--r--tex/context/base/mkiv/buff-ver.mkxl6
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl16
-rw-r--r--tex/context/base/mkiv/core-con.mkxl2
-rw-r--r--tex/context/base/mkiv/lang-lab.mkxl60
-rw-r--r--tex/context/base/mkiv/publ-ini.mkxl95
-rw-r--r--tex/context/base/mkiv/spac-ver.mkxl2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin29775 -> 29864 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin256459 -> 256460 bytes
-rw-r--r--tex/context/base/mkiv/typo-cln.mkxl32
-rw-r--r--tex/context/base/mkiv/typo-del.mkxl927
-rw-r--r--tex/context/base/mkiv/typo-inj.mkiv30
-rw-r--r--tex/context/base/mkiv/typo-inj.mkxl31
-rw-r--r--tex/context/base/mkiv/typo-itc.mklx60
-rw-r--r--tex/context/base/mkiv/typo-krn.mkxl143
-rw-r--r--tex/context/base/mkiv/typo-lan.mkxl64
-rw-r--r--tex/context/base/mkiv/typo-lin.lmt475
-rw-r--r--tex/context/base/mkiv/typo-lin.lua92
-rw-r--r--tex/context/base/mkiv/typo-lin.mkxl25
-rw-r--r--tex/context/base/mkiv/typo-pnc.mkxl55
-rw-r--r--tex/context/interface/mkii/keys-it.xml1
-rw-r--r--tex/context/modules/mkiv/s-system-macros.mkxl5
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
27 files changed, 1950 insertions, 182 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 8e57e6627..e05ed3bf3 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2020.11.16 19:37}
+\newcontextversion{2020.11.17 12:39}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index d22d7b6e7..c93f19509 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.11.16 19:37}
+\edef\contextversion{2020.11.17 12:39}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii
index ed08237ae..19262c103 100644
--- a/tex/context/base/mkii/mult-it.mkii
+++ b/tex/context/base/mkii/mult-it.mkii
@@ -1368,7 +1368,6 @@
\setinterfaceelement{type}{type}
% definitions for interface commands for language it
%
-\setinterfacecommand{CAPPED}{CAP}
\setinterfacecommand{Character}{Lettera}
\setinterfacecommand{Characters}{Lettere}
\setinterfacecommand{MONTH}{MESE}
diff --git a/tex/context/base/mkiv/buff-ver.mkxl b/tex/context/base/mkiv/buff-ver.mkxl
index ab6cdd764..6e3b0ffe3 100644
--- a/tex/context/base/mkiv/buff-ver.mkxl
+++ b/tex/context/base/mkiv/buff-ver.mkxl
@@ -68,11 +68,11 @@
{}
\protected\def\buff_verbatim_obey_breakpoints
- {\language\minusone % tricky as this affects the pagebuilder
+ {\nohyphens
\veryraggedright}
\protected\def\buff_verbatim_ignore_hyphens
- {\language\minusone} % tricky as this affects the pagebuilder
+ {\nohyphens}
\def\buff_verbatim_initialize_type_one
{\enforced\let\obeylines\ignorelines
@@ -390,7 +390,7 @@
\veryraggedright}
\permanent\protected\def\ignorehyphens
- {\language\minusone % extra bonus, the \null should do the job too
+ {\nohyphens
\enforced\let\obeyedspace \specialobeyedspace
\enforced\let\controlspace\specialcontrolspace
\spaceskip.5\emwidth\relax}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 1389645e0..74eb639aa 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2020.11.16 19:37}
+\newcontextversion{2020.11.17 12:39}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 97762871c..de68f0d2f 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.11.16 19:37}
+\edef\contextversion{2020.11.17 12:39}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index ea5d97d8f..07dd01ae5 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.11.16 19:37}
+\edef\contextversion{2020.11.17 12:39}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -193,7 +193,7 @@
\loadmkxlfile{anch-pos}
\loadmkxlfile{typo-ini}
-\loadmarkfile{typo-lin}
+\loadmkxlfile{typo-lin}
\loadmarkfile{typo-bld} % par builders
\loadmkxlfile{typo-inj}
@@ -405,7 +405,7 @@
\loadmklxfile{tabl-xtb}
\loadmarkfile{tabl-mis}
-\loadmarkfile{typo-lan}
+\loadmkxlfile{typo-lan}
\loadmarkfile{lxml-css}
@@ -416,11 +416,11 @@
\loadmkxlfile{trac-vis}
\loadmarkfile{trac-jus}
-\loadmarkfile{typo-cln}
+\loadmkxlfile{typo-cln}
\loadmarkfile{typo-wrp}
\loadmarkfile{typo-spa}
-\loadmarkfile{typo-krn}
-\loadmkvifile{typo-itc}
+\loadmkxlfile{typo-krn}
+\loadmklxfile{typo-itc}
\loadmkxlfile{typo-dir}
\loadmkxlfile{typo-brk}
\loadmkxlfile{typo-cap}
@@ -434,7 +434,7 @@
\loadmarkfile{typo-chr}
\loadmarkfile{typo-rub}
\loadmkivfile{typo-fkr}
-\loadmkivfile{typo-pnc}
+\loadmkxlfile{typo-pnc}
\loadmklxfile{type-ini}
\loadmarkfile{type-set}
@@ -511,7 +511,7 @@
\loadmkivfile{strc-usr}
\loadmkxlfile{pack-com}
-\loadmarkfile{typo-del}
+\loadmkxlfile{typo-del}
\loadmkxlfile{grph-trf}
\loadmkxlfile{grph-inc}
diff --git a/tex/context/base/mkiv/core-con.mkxl b/tex/context/base/mkiv/core-con.mkxl
index 0f836f0cc..088a118f2 100644
--- a/tex/context/base/mkiv/core-con.mkxl
+++ b/tex/context/base/mkiv/core-con.mkxl
@@ -449,7 +449,7 @@
\normalyear\normalmonth\normalday
\endgroup}
-\permanent\tolerant\protected\def\date[#1][#2]% sets the date !
+\permanent\tolerant\protected\def\date[#1]#*[#2]% sets the date !
{\dontleavehmode
\ifparameter#1\or
\begingroup
diff --git a/tex/context/base/mkiv/lang-lab.mkxl b/tex/context/base/mkiv/lang-lab.mkxl
index 881ad3861..8968631a0 100644
--- a/tex/context/base/mkiv/lang-lab.mkxl
+++ b/tex/context/base/mkiv/lang-lab.mkxl
@@ -67,28 +67,28 @@
{\lang_labels_define_class_indeed
{#1}%
{\ifchknum#2\or#2\else\zerocount\fi}%
- \expandafter\noexpand\csname dogetupsome#1text\endcsname
- \expandafter\noexpand\csname #1language\endcsname
- \expandafter\noexpand\csname dodogetupsome#1text\endcsname
- \expandafter\noexpand\csname left#1text\endcsname
- \expandafter\noexpand\csname right#1text\endcsname
- \expandafter\noexpand\csname #1texts\endcsname
- \expandafter\noexpand\csname #1text\endcsname}}
+ \expandafter\noexpand\csname lang_labels_#1_text_1\endcsname
+ \expandafter\noexpand\csname #1language\endcsname
+ \expandafter\noexpand\csname lang_labels_#1_text_2\endcsname
+ \expandafter\noexpand\csname left#1text\endcsname
+ \expandafter\noexpand\csname right#1text\endcsname
+ \expandafter\noexpand\csname #1texts\endcsname
+ \expandafter\noexpand\csname #1text\endcsname}}
% hm, not interfaced
\let\thetextprefix\empty
\protected\def\lang_labels_define_class_indeed#1#2#3#4#5#6#7#8#9%
- {\setuvalue {setup#1text}{\protecttextprefixes#2\def\currenttextprefixclass{#1}\lang_labels_text_prefix_setup}%
- \setuvalue{preset#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_setup}%
- \setuvalue {copy#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_copy }%
- \setuvalue {start#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_start[#1]}%
- \letvalue{stop#1text}\relax
- \def#4{\reallanguagetag{\defaultlanguage\currentmainlanguage}}%
+ {\permanent\instance\setuvalue {setup#1text}{\protecttextprefixes#2\def\currenttextprefixclass{#1}\lang_labels_text_prefix_setup}%
+ \permanent\instance\setuvalue{preset#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_setup}%
+ \permanent\instance\setuvalue {copy#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_copy }%
+ \permanent\instance\setuvalue {start#1text}{\protecttextprefixes 1\def\currenttextprefixclass{#1}\lang_labels_text_prefix_start[#1]}%
+ \permanent\instance\letvalue {stop#1text}\relax
+ \permanent\instance\def#4{\reallanguagetag{\defaultlanguage\currentmainlanguage}}%
\ifnum#2=\plustwo % used for math and tags
- \def#3{#5#4}%
- \def#5##1##2% ##1=language
+ \instance\def#3{#5#4}%
+ \instance\def#5##1##2% ##1=language
{\ifcsname\??label\currentlabelcategory#1:##1:##2\endcsname
\lastnamedcs
\orelse\ifcsname\??label#1:##1:##2\endcsname
@@ -106,13 +106,13 @@
\else
##2%
\fi}%
- \let#6\gobbleoneargument
- \let#7\gobbleoneargument
- \let#8\gobbletwoarguments
- \let#9#3%
+ \permanent\instance\let#6\gobbleoneargument
+ \permanent\instance\let#7\gobbleoneargument
+ \permanent\instance\let#8\gobbletwoarguments
+ \permanent\instance\let#9#3%
\else
- \protected\def#3{#5#4}%
- \protected\def#5##1##2%
+ \instance\protected\def#3{#5#4}%
+ \instance\protected\def#5##1##2%
{\ifcsname\??label#1:##1:##2\endcsname
\enforced\expandafter\let\expandafter\thetextprefix\lastnamedcs
\orelse\ifcsname\??language#4\s!default\endcsname
@@ -124,16 +124,16 @@
\else
\enforced\let\thetextprefix\dummytextprefix
\fi}%
- \protected\def#6##1{#3{##1}\expandafter\flushleftlabelclass \thetextprefix}%
- \protected\def#7##1{#3{##1}\expandafter\flushrightlabelclass\thetextprefix}%
- \protected\def#8##1{#3{##1}\expandafter\flushbothlabelclass \thetextprefix}% #2
- \protected\def#9##1{#3{##1}\expandafter\flushleftlabelclass \thetextprefix}%
+ \permanent\instance\protected\def#6##1{#3{##1}\expandafter\flushleftlabelclass \thetextprefix}%
+ \permanent\instance\protected\def#7##1{#3{##1}\expandafter\flushrightlabelclass\thetextprefix}%
+ \permanent\instance\protected\def#8##1{#3{##1}\expandafter\flushbothlabelclass \thetextprefix}% #2
+ \permanent\instance\protected\def#9##1{#3{##1}\expandafter\flushleftlabelclass \thetextprefix}%
\fi
\appendtoks
- \let#6\firstofoneargument % to be checked
- \let#7\firstofoneargument % to be checked
- \let#8\firstofoneargument % to be checked
- \let#9\firstofoneargument % to be checked
+ \enforced\permanent\instance\let#6\firstofoneargument % to be checked
+ \enforced\permanent\instance\let#7\firstofoneargument % to be checked
+ \enforced\permanent\instance\let#8\firstofoneargument % to be checked
+ \enforced\permanent\instance\let#9\firstofoneargument % to be checked
\to \everysimplifycommands}
% why not lang_* ?
@@ -159,7 +159,7 @@
%D These macros enable us to automatically define head and label texts without
%D replacing predefined ones. They are internal macros.
-\appendtoks \let\labellanguage\currentlanguage \to \everycurrentdate
+\appendtoks \enforced\let\labellanguage\currentlanguage \to \everycurrentdate
\newconstant\protecttextprefixes
diff --git a/tex/context/base/mkiv/publ-ini.mkxl b/tex/context/base/mkiv/publ-ini.mkxl
index 47d82afaf..7c1671528 100644
--- a/tex/context/base/mkiv/publ-ini.mkxl
+++ b/tex/context/base/mkiv/publ-ini.mkxl
@@ -111,8 +111,8 @@
%D to split between cite and list here as it only complicates matters (timing) and is
%D not clear either.
-\let\currentbtxspecification \empty
-\let\currentbtxspecificationfallback\empty
+\mutable\let\currentbtxspecification \empty
+\mutable\let\currentbtxspecificationfallback\empty
\installmacrostack\currentbtxspecification
\installmacrostack\currentbtxspecificationfallback
@@ -432,30 +432,30 @@
%D Variables:
-\let\currentbtxbacklink \empty \permanent\protected\def\btxsetbacklink {\def\currentbtxbacklink}
-\let\currentbtxcategory \empty \permanent\protected\def\btxsetcategory {\def\currentbtxcategory}
-\let\currentbtxcombis \empty \permanent\protected\def\btxsetcombis {\def\currentbtxcombis}
-\let\currentbtxdataset \empty \permanent\protected\def\btxsetdataset {\def\currentbtxdataset}
-\let\currentbtxfirst \empty \permanent\protected\def\btxsetfirst {\def\currentbtxfirst}
-\let\currentbtxsecond \empty \permanent\protected\def\btxsetsecond {\def\currentbtxsecond}
-\let\currentbtxsuffix \empty \permanent\protected\def\btxsetsuffix {\def\currentbtxsuffix}
-\let\currentbtxinternal \empty \permanent\protected\def\btxsetinternal {\def\currentbtxinternal}
-\let\currentbtxlefttext \empty \permanent\protected\def\btxsetlefttext {\def\currentbtxlefttext}
-\let\currentbtxrighttext \empty \permanent\protected\def\btxsetrighttext {\def\currentbtxrighttext}
-\let\currentbtxbefore \empty \permanent\protected\def\btxsetbefore {\def\currentbtxbefore}
-\let\currentbtxafter \empty \permanent\protected\def\btxsetafter {\def\currentbtxafter}
-\let\currentbtxlanguage \empty \permanent\protected\def\btxsetlanguage {\def\currentbtxlanguage}
-\let\currentbtxtag \empty \permanent\protected\def\btxsettag {\def\currentbtxtag}
-\let\currentbtxnumber \empty \permanent\protected\def\btxsetnumber {\def\currentbtxnumber}
-\let\currentbtxfirstinternal\empty \permanent\protected\def\btxsetfirstinternal{\def\currentbtxfirstinternal}
-\let\currentbtxlastinternal \empty \permanent\protected\def\btxsetlastinternal {\def\currentbtxlastinternal}
-
-\let\currentbtxauthorvariant\v!normal \permanent\protected\def\btxsetauthorvariant{\def\currentbtxauthorvariant}
-\let\currentbtxfirstnames \empty \permanent\protected\def\btxsetfirstnames {\let\currentbtxfirstnames\currentbtxfirstnames_indeed}
-\let\currentbtxinitials \empty \permanent\protected\def\btxsetinitials {\let\currentbtxinitials \currentbtxinitials_indeed }
-\let\currentbtxjuniors \empty \permanent\protected\def\btxsetjuniors {\let\currentbtxjuniors \currentbtxjuniors_indeed }
-\let\currentbtxsurnames \empty \permanent\protected\def\btxsetsurnames {\let\currentbtxsurnames \currentbtxsurnames_indeed }
-\let\currentbtxvons \empty \permanent\protected\def\btxsetvons {\let\currentbtxvons \currentbtxvons_indeed }
+\mutable\let\currentbtxbacklink \empty \permanent\protected\def\btxsetbacklink {\def\currentbtxbacklink}
+\mutable\let\currentbtxcategory \empty \permanent\protected\def\btxsetcategory {\def\currentbtxcategory}
+\mutable\let\currentbtxcombis \empty \permanent\protected\def\btxsetcombis {\def\currentbtxcombis}
+\mutable\let\currentbtxdataset \empty \permanent\protected\def\btxsetdataset {\def\currentbtxdataset}
+\mutable\let\currentbtxfirst \empty \permanent\protected\def\btxsetfirst {\def\currentbtxfirst}
+\mutable\let\currentbtxsecond \empty \permanent\protected\def\btxsetsecond {\def\currentbtxsecond}
+\mutable\let\currentbtxsuffix \empty \permanent\protected\def\btxsetsuffix {\def\currentbtxsuffix}
+\mutable\let\currentbtxinternal \empty \permanent\protected\def\btxsetinternal {\def\currentbtxinternal}
+\mutable\let\currentbtxlefttext \empty \permanent\protected\def\btxsetlefttext {\def\currentbtxlefttext}
+\mutable\let\currentbtxrighttext \empty \permanent\protected\def\btxsetrighttext {\def\currentbtxrighttext}
+\mutable\let\currentbtxbefore \empty \permanent\protected\def\btxsetbefore {\def\currentbtxbefore}
+\mutable\let\currentbtxafter \empty \permanent\protected\def\btxsetafter {\def\currentbtxafter}
+\mutable\let\currentbtxlanguage \empty \permanent\protected\def\btxsetlanguage {\def\currentbtxlanguage}
+\mutable\let\currentbtxtag \empty \permanent\protected\def\btxsettag {\def\currentbtxtag}
+\mutable\let\currentbtxnumber \empty \permanent\protected\def\btxsetnumber {\def\currentbtxnumber}
+\mutable\let\currentbtxfirstinternal\empty \permanent\protected\def\btxsetfirstinternal{\def\currentbtxfirstinternal}
+\mutable\let\currentbtxlastinternal \empty \permanent\protected\def\btxsetlastinternal {\def\currentbtxlastinternal}
+
+\mutable\let\currentbtxauthorvariant\v!normal \permanent\protected\def\btxsetauthorvariant{\def\currentbtxauthorvariant}
+\mutable\let\currentbtxfirstnames \empty \permanent\protected\def\btxsetfirstnames {\let\currentbtxfirstnames\currentbtxfirstnames_indeed}
+\mutable\let\currentbtxinitials \empty \permanent\protected\def\btxsetinitials {\let\currentbtxinitials \currentbtxinitials_indeed }
+\mutable\let\currentbtxjuniors \empty \permanent\protected\def\btxsetjuniors {\let\currentbtxjuniors \currentbtxjuniors_indeed }
+\mutable\let\currentbtxsurnames \empty \permanent\protected\def\btxsetsurnames {\let\currentbtxsurnames \currentbtxsurnames_indeed }
+\mutable\let\currentbtxvons \empty \permanent\protected\def\btxsetvons {\let\currentbtxvons \currentbtxvons_indeed }
\newconstant\currentbtxoverflow \permanent\protected\def\btxsetoverflow #1{\currentbtxoverflow #1\relax}
\newconstant\currentbtxconcat \permanent\protected\def\btxsetconcat #1{\currentbtxconcat #1\relax}
@@ -470,10 +470,23 @@
\protected\def\currentbtxsurnames_indeed {\clf_btxcurrentsurnames \numexpr\currentbtxauthorindex\relax}
\protected\def\currentbtxvons_indeed {\clf_btxcurrentvons \numexpr\currentbtxauthorindex\relax}
-\let\currentbtxfirstpage \empty \permanent\protected\def\btxsetfirstpage#1{\def\currentbtxfirstpage{\btx_page_number{#1}}}
-\let\currentbtxlastpage \empty \permanent\protected\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}}
+\mutable\let\currentbtxfirstpage \empty \permanent\protected\def\btxsetfirstpage#1{\def\currentbtxfirstpage{\btx_page_number{#1}}}
+\mutable\let\currentbtxlastpage \empty \permanent\protected\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}}
-\def\currentbtxauthorvariant{normal}
+\mutable\let\currentbtxfield \empty
+\mutable\let\currentbtxfielddoi \empty
+\mutable\let\currentbtxfieldmonth \empty
+\mutable\let\currentbtxfieldyear \empty
+\mutable\let\currentbtxfieldurl \empty
+\mutable\let\currentbtxcriterium \empty
+\mutable\let\currentbtxlist \empty
+\mutable\let\currentbtxlistentry \empty
+\mutable\let\currentbtxlistindex \empty
+\mutable\let\currentbtxreference \empty
+\mutable\let\currentbtxrenderingtitle \empty
+\mutable\let\currentbtxcitetag \empty
+
+\mutable\def\currentbtxauthorvariant{normal}
\protected\def\btx_reset_list % not needed as we're grouped
{\let\currentbtxcombis \empty
@@ -531,7 +544,7 @@
%D Language:
-\def\mainbtxlanguage{\currentmainlanguage}
+\mutable\def\mainbtxlanguage{\currentmainlanguage}
\protected\def\btx_check_language
{\let\mainbtxlanguage\currentlanguage
@@ -560,8 +573,7 @@
%D Rendering lists and citations.
-\protected\def\btxtodo#1%
- {[#1]}
+\permanent\protected\def\btxtodo#1{[#1]}
%D Lists:
@@ -987,7 +999,7 @@
%D So far.
-\def\currentbtxblock{\number\btxblock}
+\permanent\def\currentbtxblock{\number\btxblock}
% called at the lua end, for determining the width
@@ -1110,7 +1122,7 @@
\newconditional\c_btx_cite_reference_injected
-\protected\def\btx_cite_reference_inject
+\permanent\protected\def\btx_cite_reference_inject
{\ifconditional\c_btx_cite_reference_injected \else
\dontleavehmode
\iftrialtypesetting \else
@@ -1145,8 +1157,8 @@
\aliased\let\btxcitereference\btx_cite_reference_inject
-\let\currentbtxnumbering \empty
-\let\currentbtxcitealternative \empty
+\mutable\let\currentbtxnumbering \empty
+\mutable\let\currentbtxcitealternative \empty
\appendtoks
\edef\currentbtxnumbering{\btxrenderingparameter\c!numbering}%
@@ -1215,7 +1227,7 @@
\permanent\protected\def\btxflushauthorinverted {\btx_flush_author{inverted}} % #1
\permanent\protected\def\btxflushauthorinvertedshort{\btx_flush_author{invertedshort}} % #1
-\let\currentbtxauthorfield\s!author
+\mutable\let\currentbtxauthorfield\s!author
\permanent\protected\def\btxsetauthorfield#1{\edef\currentbtxauthorfield{#1}}
@@ -1278,7 +1290,7 @@
\newconditional\btxinteractivetext
\newconditional\btxinteractivepage
-\let\currentbtxinteraction\empty
+\mutable\let\currentbtxinteraction\empty
\installcorenamespace{btxinteraction}
@@ -1356,8 +1368,8 @@
\let\p_publ_cite_lefttext \empty
\let\p_publ_cite_righttext\empty
-\let\currentbtxciteuservariables\empty
-\let\currentbtxcitealternative \empty
+\mutable\let\currentbtxciteuservariables\empty
+\mutable\let\currentbtxcitealternative \empty
\permanent\protected\def\btxhybridcite % so one can alias the old
{\dontleavehmode
@@ -1432,8 +1444,7 @@
\newconditional\btxcitecompress
-\let\currentbtxreference \empty
-\let\currentbtxcitemethod\v!hidden
+\mutable\let\currentbtxcitemethod\v!hidden
\def\publ_cite_variant
{\begingroup
diff --git a/tex/context/base/mkiv/spac-ver.mkxl b/tex/context/base/mkiv/spac-ver.mkxl
index 786dd6044..3cc8dbcad 100644
--- a/tex/context/base/mkiv/spac-ver.mkxl
+++ b/tex/context/base/mkiv/spac-ver.mkxl
@@ -2171,7 +2171,7 @@
%D These depend on bigskipamount cum suis so we'd better sync them:
-\let\currentvspacing\s!default % hm, default, standard ...
+\mutable\let\currentvspacing\s!default % hm, default, standard ...
\permanent\tolerant\protected\def\setupvspacing[#1]%
{\ifarguments\else
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 59506d8ca..564a75c84 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 46ad6854d..a65fd3799 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/typo-cln.mkxl b/tex/context/base/mkiv/typo-cln.mkxl
new file mode 100644
index 000000000..84fc1d235
--- /dev/null
+++ b/tex/context/base/mkiv/typo-cln.mkxl
@@ -0,0 +1,32 @@
+%D \module
+%D [ file=typo-cln,
+%D version=2011.02.11,
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Cleaning,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%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 Typesetting Macros / Cleaning}
+
+\unprotect
+
+\registerctxluafile{typo-cln}{}
+
+\definesystemattribute[cleaner][public]
+
+%D Currently there is no interface.
+%D
+%D 1: Autocap first character of a line
+
+\permanent\protected\def\setcharactercleaning[#1]{\clf_setcharactercleaning{#1}} % also accepts reset, todo: public implementor
+
+% \appendtoks
+% \c_attr_cleaner\attributeunsetvalue
+% \to \everyforgetall
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/typo-del.mkxl b/tex/context/base/mkiv/typo-del.mkxl
new file mode 100644
index 000000000..3550626aa
--- /dev/null
+++ b/tex/context/base/mkiv/typo-del.mkxl
@@ -0,0 +1,927 @@
+%D \module
+%D [ file=typo-del, % moved from core-mis,
+%D version=20110112,
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Delimited Content,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% todo: textstyle|color for inline \quotation etc
+
+\writestatus{loading}{ConTeXt Typesetting Macros / Delimited Content}
+
+\unprotect
+
+\ifdefined\dotagsetdelimitedsymbol \else \let\dotagsetdelimitedsymbol \gobbleoneargument \fi
+\ifdefined\dotagsetsubsentencesymbol \else \let\dotagsetsubsentencesymbol\gobbleoneargument \fi
+
+% THIS IS OBSOLETE:
+
+\installcorenamespace{hyphenmarksign} % let's not waste a setuphandler (yet)
+
+\permanent\permanent\protected\def\setuphyphenmark[#1]% sign=normal|wide
+ {\getdummyparameters[#1]%
+ \expandnamespaceparameter\??hyphenmarksign\dummyparameter\c!sign\v!normal}
+
+\setvalue{\??hyphenmarksign\v!normal}%
+ {\let\textmodehyphen\normalhyphen
+ \let\textmodehyphendiscretionary\normalhyphendiscretionary}
+
+\setvalue{\??hyphenmarksign\v!wide}%
+ {\let\textmodehyphen\composedhyphen
+ \let\textmodehyphendiscretionary\composedhyphendiscretionary}
+
+\setuphyphenmark[\c!sign=\v!wide]
+
+\definesymbol[\c!lefthyphen] [\languageparameter\c!lefthyphen]
+\definesymbol[\c!righthyphen] [\languageparameter\c!righthyphen]
+\definesymbol[\c!hyphen] [\languageparameter\c!hyphen]
+
+\permanent\protected\def\normalhyphen
+ {\hbox{\directsymbol\empty\c!hyphen}}
+
+\permanent\protected\def\composedhyphen
+ {\hbox{\directsymbol\empty\c!compoundhyphen}}
+
+\permanent\protected\def\normalhyphendiscretionary
+ {\discretionary
+ {\hbox{\directsymbol\empty\c!righthyphen}}
+ {\hbox{\directsymbol\empty\c!lefthyphen}}
+ {\hbox{\directsymbol\empty\c!hyphen}}}
+
+\permanent\protected\def\composedhyphendiscretionary
+ {\discretionary
+ {\hbox{\directsymbol\empty\c!rightcompoundhyphen}}
+ {\hbox{\directsymbol\empty\c!leftcompoundhyphen}}
+ {\hbox{\directsymbol\empty\c!compoundhyphen}}}
+
+\let\textmodehyphen \composedhyphen
+\let\textmodehyphendiscretionary\composedhyphendiscretionary
+
+\definesymbol[\c!leftcompoundhyphen] [\languageparameter\c!leftcompoundhyphen]
+\definesymbol[\c!rightcompoundhyphen] [\languageparameter\c!rightcompoundhyphen]
+\definesymbol[\c!compoundhyphen] [\languageparameter\c!compoundhyphen]
+
+% TILL HERE
+
+\setnewconstant\boundarycharactermode\plusone
+
+% old: skip symbol skip
+% new: bound skip symbol skip bound
+
+\permanent\protected\def\midboundarycharacter#1#2%
+ {\ifcase\boundarycharactermode
+ \or
+ \removeunwantedspaces
+ \wordboundary
+ \hskip\hspaceamount\currentusedlanguage{#2}%
+ \usedlanguageparameter#1%
+ \hskip\hspaceamount\currentusedlanguage{#2}%
+ \wordboundary
+ \ignorespaces
+ \or
+ \usedlanguageparameter#1%
+ \fi
+ \boundarycharactermode\plusone}
+
+% old: symbol nobreak skip
+% new: symbol nobreak skip wordboundary
+
+\permanent\protected\def\leftboundarycharacter#1#2%
+ {\ifcase\boundarycharactermode
+ \or
+ \usedlanguageparameter#1%
+ \nobreak
+ \hskip\hspaceamount\currentusedlanguage{#2}% why not a kern
+ \wordboundary
+ \or
+ \usedlanguageparameter#1%
+ \fi
+ \boundarycharactermode\plusone}
+
+% old: preword skip symbol
+% new: bound nobreak skip symbol
+
+\permanent\protected\def\rightboundarycharacter#1#2%
+ {\ifcase\boundarycharactermode
+ \or
+ \wordboundary
+ \nobreak
+ \hskip\hspaceamount\currentusedlanguage{#2}% why not a kern
+ \usedlanguageparameter#1%
+ \or
+ \usedlanguageparameter#1%
+ \fi
+ \boundarycharactermode\plusone}
+
+\definehspace [sentence] [\zeropoint]
+\definehspace [intersentence] [.250\emwidth]
+
+\definesymbol
+ [\c!midsentence]
+ [\midboundarycharacter\c!midsentence{sentence}]
+
+\definesymbol
+ [\c!leftsentence]
+ [\leftboundarycharacter\c!leftsentence{sentence}]
+
+\definesymbol
+ [\c!rightsentence]
+ [\rightboundarycharacter\c!rightsentence{sentence}]
+
+\definesymbol
+ [\c!leftsubsentence]
+ [\leftboundarycharacter\c!leftsubsentence{sentence}]
+
+\definesymbol
+ [\c!rightsubsentence]
+ [\rightboundarycharacter\c!rightsubsentence{sentence}]
+
+\newsignal\d_typo_subsentence_signal
+\newcount \c_typo_subsentence_nesting
+
+\let\beforesubsentence\donothing
+\let\aftersubsentence \donothing
+
+% todo: make this language option
+%
+% \def\beforesubsentence{\removeunwantedspaces}
+% \def\aftersubsentence {\ignorespaces}
+
+\newconditional\c_typo_subsentence_cleanup \settrue\c_typo_subsentence_cleanup
+
+\def\typo_subsentence_cleanup_start
+ {\ifconditional\c_typo_subsentence_cleanup
+ \expandafter\ignorespaces
+ \fi}
+
+\def\typo_subsentence_cleanup_stop
+ {\ifconditional\c_typo_subsentence_cleanup
+ \removeunwantedspaces
+ \fi}
+
+\permanent\protected\def\midsentence
+ {\dostarttagged\t!subsentencesymbol\empty
+ \dotagsetsubsentencesymbol\s!middle
+ \symbol[\c!midsentence]%
+ \dostoptagged}
+
+\permanent\protected\def\beginofsubsentence
+ {\beforesubsentence
+ \ifdim\lastkern=\d_typo_subsentence_signal
+ \unskip
+ \kern\hspaceamount\currentusedlanguage{intersentence}%
+ \fi
+ \global\advance\c_typo_subsentence_nesting\plusone
+ \ifnum\c_typo_subsentence_nesting=\plusone
+ \dontleavehmode
+ \fi
+ \dostarttagged\t!subsentence\empty % no chain
+ \dostarttagged\t!subsentencesymbol\empty
+ \dotagsetsubsentencesymbol\s!left
+ \symbol[\ifodd\c_typo_subsentence_nesting\c!leftsentence\else\c!leftsubsentence\fi]%
+ \dostoptagged
+ \dostarttagged\t!subsentencecontent\empty
+ \typo_subsentence_cleanup_start}
+
+\permanent\protected\def\endofsubsentence % relax prevents space gobbling
+ {\typo_subsentence_cleanup_stop
+ \dostoptagged
+ \dostarttagged\t!subsentencesymbol\empty
+ \dotagsetsubsentencesymbol\s!right
+ \symbol[\ifodd\c_typo_subsentence_nesting\c!rightsentence\else\c!rightsubsentence\fi]%
+ \dostoptagged
+ \dostoptagged
+ \global\advance\c_typo_subsentence_nesting\minusone
+ \unskip
+ \kern\d_typo_subsentence_signal\relax
+ \aftersubsentence}
+
+\permanent\protected\def\beginofsubsentencespacing % relax prevents space gobbling
+ {\kern\d_typo_subsentence_signal\relax}% \ignorespaces}
+
+\permanent\protected\def\endofsubsentencespacing
+ {\ifdim\lastkern=\d_typo_subsentence_signal
+ \unskip
+ \hskip\hspaceamount\currentusedlanguage{intersentence}%
+ % no good, actually language dependent:
+ % \ignorespaces
+ \else
+ \unskip
+ \fi}
+
+%D \startbuffer
+%D test |<|test |<|test|>| test|>| test \par
+%D test|<|test|<|test|>|test|>|test \par
+%D test |<||<|test|>||>| test \par
+%D test \directdiscretionary{<}test\directdiscretionary{>} test \par
+%D \stopbuffer
+%D
+%D \typebuffer
+%D \getbuffer
+
+%unexpanded\def\startsubsentence{\beginofsubsentence\prewordbreak\beginofsubsentencespacing\typo_subsentence_cleanup_start}
+%unexpanded\def\stopsubsentence {\typo_subsentence_cleanup_stop\endofsubsentencespacing\prewordbreak\endofsubsentence}
+%unexpanded\def\subsentence {\groupedcommandcs\startsubsentence\stopsubsentence}
+%unexpanded\def\midsubsentence {\typo_subsentence_cleanup_start\prewordbreak\midsentence\prewordbreak\typo_subsentence_cleanup_stop}
+
+\permanent\protected\def\startsubsentence{\beginofsubsentence\wordboundary\beginofsubsentencespacing\wordboundary\typo_subsentence_cleanup_start}
+\permanent\protected\def\stopsubsentence {\typo_subsentence_cleanup_stop\wordboundary\endofsubsentencespacing\wordboundary\endofsubsentence}
+\permanent\protected\def\subsentence {\groupedcommandcs\startsubsentence\stopsubsentence}
+\permanent\protected\def\midsubsentence {\typo_subsentence_cleanup_start\wordboundary\midsentence\wordboundary\typo_subsentence_cleanup_stop}
+
+\definehspace [quotation] [\zeropoint]
+\definehspace [interquotation] [.125em]
+
+%definehspace [quote] [\zeropoint]
+%definehspace [speech] [\zeropoint]
+
+\definehspace [quote] [\hspaceamount\currentusedlanguage{quotation}]
+\definehspace [speech] [\hspaceamount\currentusedlanguage{quotation}]
+
+\definesymbol
+ [\c!leftquotation]
+ [\leftboundarycharacter\c!leftquotation{quotation}]
+
+\definesymbol
+ [\c!rightquotation]
+ [\rightboundarycharacter\c!rightquotation{quotation}]
+
+\definesymbol
+ [\c!nextleftquotation]
+ [\rightboundarycharacter\c!leftquotation{quotation}]
+
+\definesymbol
+ [\c!nextrightquotation]
+ [\leftboundarycharacter\c!rightquotation{quotation}]
+
+\definesymbol
+ [\c!leftquote]
+ [\leftboundarycharacter\c!leftquote{quote}]
+
+\definesymbol
+ [\c!rightquote]
+ [\rightboundarycharacter\c!rightquote{quote}]
+
+\definesymbol
+ [\c!leftspeech]
+ [\leftboundarycharacter\c!leftspeech{speech}]
+
+\definesymbol
+ [\c!rightspeech]
+ [\rightboundarycharacter\c!rightspeech{speech}]
+
+\definesymbol
+ [\c!middlespeech]
+ [\leftboundarycharacter\c!middlespeech{speech}]
+
+\appendtoks
+ \enforced\permanent\def\quotation#1{"#1"}%
+ \enforced\permanent\def\quote #1{'#1'}%
+\to \everysimplifycommands
+
+%D The next features was so desperately needed by Giuseppe Bilotta that he made a
+%D module for it. Since this is a typical example of core functionality, I decided
+%D to extend the low level quotation macros in such a way that a speech feature
+%D could be build on top of it. The speech opening and closing symbols are defined
+%D per language. Italian is an example of a language that has them set.
+
+\newsignal\d_typo_delimited_signal
+
+\let\currentdelimitedtext\s!unknown
+
+\installglobalmacrostack\currentdelimitedtext
+
+\let\delimitedtextlevel\!!zerocount
+
+\def\c_typo_delimited_nesting{\csname\??delimitedtextlevel\currentparentdelimitedtext\endcsname}
+
+% the \setlanguageparameter macro sets but we are ungrouped .. only used here
+%
+% \currentusedlanguage
+% \usedlanguageparameter
+
+%D The optional argument can be a language, a narrower spec, or a outer:inner language
+%D specification.
+%D
+%D \starttabulate
+%D \NC [en] \NC {\tttf en} \quotation[en] {{\tttf <en=\currentlanguage>} something french} \NC \NR
+%D \NC [fr] \NC {\tttf en} \quotation[fr] {{\tttf <fr=\currentlanguage>} something french} \NC \NR
+%D \NC [fr:] \NC {\tttf fr} \quotation[fr:] {{\tttf <en=\currentlanguage>} something french} \NC \NR
+%D \NC [:fr] \NC {\tttf en} \quotation[:fr] {{\tttf <fr=\currentlanguage>} something french} \NC \NR
+%D \NC [fr:fr] \NC {\tttf fr} \quotation[fr:fr]{{\tttf <fr=\currentlanguage>} something french} \NC \NR
+%D \NC [en:fr] \NC {\tttf en} \quotation[en:fr]{{\tttf <fr=\currentlanguage>} something french} \NC \NR
+%D \NC [fr:en] \NC {\tttf fr} \quotation[fr:en]{{\tttf <en=\currentlanguage>} something french} \NC \NR
+%D \stoptabulate
+
+\let\currentdelimitedlanguage\empty
+
+\installglobalmacrostack\currentdelimitedlanguage
+
+\def\typo_delimited_set_language_nop
+ {\setusedlanguage{\delimitedtextparameter\c!language}}
+
+\def\typo_delimited_set_language_yes
+ {\doiflanguageelse\m_delimited_argument
+ \typo_delimited_set_language_yes_a
+ {\doifelseinstring:\m_delimited_argument
+ \typo_delimited_set_language_yes_b
+ \typo_delimited_set_language_nop}}
+
+\def\typo_delimited_set_language_yes_b
+ {\splitatcolon\m_delimited_argument\outerdelimitedlanguage\innerdelimitedlanguage
+ \ifempty\outerdelimitedlanguage
+ \typo_delimited_set_language_nop
+ \else
+ \doiflanguageelse\outerdelimitedlanguage
+ {\setusedlanguage\outerdelimitedlanguage}%
+ \typo_delimited_set_language_nop
+ \fi
+ \ifempty\innerdelimitedlanguage\else
+ \doiflanguageelse\innerdelimitedlanguage
+ {\let\currentdelimitedlanguage\innerdelimitedlanguage}%
+ \donothing
+ \fi
+ \let\m_delimited_argument\empty}
+
+\def\typo_delimited_set_language_yes_a
+ {\let\currentdelimitedlanguage\m_delimited_argument
+ \let\m_delimited_argument\empty}
+
+\def\typo_delimited_push#1#2%
+ {\push_macro_currentdelimitedtext % can we combine these two
+ \push_macro_currentdelimitedlanguage % the language used for hyphenation
+ \edef\currentdelimitedtext{#1}%
+ \edef\m_delimited_argument{#2}%
+ \ifempty\m_delimited_argument
+ \typo_delimited_set_language_nop
+ \else
+ \typo_delimited_set_language_yes
+ \fi
+ \let\currentparentdelimitedtext\currentdelimitedtext
+ \global\advance\c_typo_delimited_nesting\plusone
+ \edef\delimitedtextlevel{\number\c_typo_delimited_nesting}%
+ \normalexpanded{\chaintocurrentdelimitedtext{\currentparentdelimitedtext:\delimitedtextlevel}}%
+ \edef\currentdelimitedtext{\currentparentdelimitedtext:\delimitedtextlevel}}
+
+\def\typo_delimited_pop
+ {\global\advance\c_typo_delimited_nesting\minusone
+ \pop_macro_currentdelimitedlanguage
+ \pop_macro_currentdelimitedtext}
+
+\installcorenamespace{delimitedtext}
+\installcorenamespace{delimitedtextlevel}
+
+\installcommandhandler \??delimitedtext {delimitedtext} \??delimitedtext
+
+\appendtoks
+ \expandafter\newcount\csname\??delimitedtextlevel\currentdelimitedtext\endcsname
+ \setuevalue{\currentdelimitedtext }{\delimitedtext[\currentdelimitedtext]}%
+ \setuevalue{\e!start\currentdelimitedtext}{\startdelimitedtext[\currentdelimitedtext]}%
+ \setuevalue{\e!stop \currentdelimitedtext}{\stopdelimitedtext}%
+\to \everydefinedelimitedtext
+
+\setupdelimitedtext
+ [\c!location=\v!margin, % \v!text \v!paragraph
+ \c!spacebefore=,
+ \c!spaceafter=\delimitedtextparameter\c!spacebefore,
+ \c!style=,
+ \c!color=,
+ \c!leftmargin=\zeropoint,
+ \c!rightmargin=\delimitedtextparameter\c!leftmargin,
+ \c!indentnext=\v!yes,
+ \c!before=,
+ \c!after=,
+ \c!left=,
+ \c!right=,
+ %\c!level=0,
+ \c!method=,
+ %\c!language=\v!local,
+ \c!repeat=\v!no]
+
+\def\typo_delimited_repeat_indeed
+ {\relax\ifcase\delimitedtextlevel\else
+ \typo_delimited_handle_middle\c!middle
+ \fi}
+
+\let\typo_delimited_repeat\relax
+
+\permanent\tolerant\protected\def\startdelimitedtext[#1]#*[#2]%
+ {\begingroup
+ \typo_delimited_push{#1}{#2}%
+ \dostarttaggedchained\t!delimitedblock\currentdelimitedtext\??delimitedtext
+ \edef\p_delimited_method{\delimitedtextparameter\c!method}%
+ \ifx\p_delimited_method\v!font
+ \expandafter\typo_delimited_start_font
+ \else
+ \expandafter\typo_delimited_start_other
+ \fi}
+
+\let\typo_delimited_stop\relax % hooks into \everypar
+
+\def\typo_delimited_start_font
+ {\let\typo_delimited_stop\typo_delimitedtexts_finish_font
+ \dostarttagged\t!delimitedsymbol\empty
+ \dotagsetdelimitedsymbol\s!left
+ \delimitedtextparameter\c!left
+ \dostoptagged
+ \ignorespaces}
+
+\newconditional\c_typo_delimited_repeating
+
+\def\typo_delimited_start_other
+ {\edef\p_delimited_repeat{\delimitedtextparameter\c!repeat}%
+ \ifx\p_delimited_repeat\v!yes
+ \let\typo_delimited_repeat\typo_delimited_repeat_indeed
+ \else
+ \let\typo_delimited_repeat\relax
+ \fi
+ \setfalse\c_typo_delimited_repeating
+ \edef\p_delimited_location{\delimitedtextparameter\c!location}%
+ \ifx\p_delimited_location\v!paragraph
+ \expandafter\typo_delimited_start_par
+ \orelse\ifx\p_delimited_location\v!margin
+ \expandafter\typo_delimited_start_par
+ \else
+ \expandafter\typo_delimited_start_txt
+ \fi}
+
+\def\typo_delimitedtexts_finish_font
+ {\removeunwantedspaces % again ?
+ \dostarttagged\t!delimitedsymbol\empty
+ \dotagsetdelimitedsymbol\s!right
+ \delimitedtextparameter\c!right
+ \dostoptagged}
+
+\def\typo_delimited_show_language_indeed#1#2%
+ {\begingroup
+ \infofont
+ \setbox\scratchbox\hpack{\lower\strutht\hbox to \zeropoint{\darkred#1\currentlanguage:\currentdelimitedlanguage#2}}%
+ \vsmashbox\scratchbox
+ \box\scratchbox
+ \endgroup}
+
+\let\typo_delimited_show_language\gobbletwoarguments
+
+\installtextracker{delimited.language}
+ {\let\typo_delimited_show_language\typo_delimited_show_language_indeed}
+ {\let\typo_delimited_show_language\gobbletwoarguments}
+
+\def\typo_delimited_start_content
+ {\dostarttagged\t!delimitedcontent\empty
+ \begingroup
+ \douselanguageparameter\currentdelimitedlanguage
+ \typo_delimited_show_language<\hss
+ \ignorespaces}
+
+\def\typo_delimited_stop_content
+ {\removeunwantedspaces
+ \removelastskip % redundant
+ \typo_delimited_show_language\hss<%
+ \endgroup
+ \dostoptagged}
+
+\tolerant\def\typo_delimited_start_par[#1]%
+ {\let\typo_delimited_stop\typo_delimited_stop_par
+ \edef\p_delimited_spacebefore{\delimitedtextparameter\c!spacebefore}%
+ \ifempty\p_delimited_spacebefore \else
+ \blank[\p_delimited_spacebefore]%
+ \fi
+ \delimitedtextparameter\c!before
+ \edef\m_delimited_argument{#1}%
+ \ifempty\m_delimited_argument
+ \let\m_delimited_argument\m_delimited_argument
+ \fi
+ \ifempty\m_delimited_argument
+ \endgraf
+ \doadaptleftskip {\delimitedtextparameter\c!leftmargin}%
+ \doadaptrightskip{\delimitedtextparameter\c!rightmargin}%
+ \let\typo_delimited_stop_par_indeed\endgraf
+ \else % backward compatible direct directive
+ \startnarrower[\m_delimited_argument]%
+ \let\typo_delimited_stop_par_indeed\stopnarrower
+ \fi
+ % so far
+ \push_macro_checkindentation
+ \useindentingparameter\delimitedtextparameter
+ %
+ \begingroup
+ \usedelimitedtextstyleandcolor\c!style\c!color
+ %
+ \begingroup
+ \edef\p_delimited_left {\delimitedtextparameter{\c!left}}%
+ \edef\p_delimited_right {\delimitedtextparameter{\c!right}}%
+ \edef\p_delimited_nextleft {\delimitedtextparameter{\c!nextleft}}%
+ \edef\p_delimited_nextright{\delimitedtextparameter{\c!nextright}}%
+ %
+ \leftdelimitedtextmark
+ %
+ \setnextleftdelimitedtextmark
+ \setnextrightdelimitedtextmark
+ %
+ \typo_delimited_start_content}
+
+\let\typo_delimited_stop_par_indeed\endgraf
+
+\def\typo_delimited_stop_par
+ {\typo_delimited_stop_content
+ \rightdelimitedtextmark
+ \rightdelimitedtextmark
+ \carryoverpar\endgroup
+ \endgraf
+ \endgroup
+ \pop_macro_checkindentation
+ \typo_delimited_stop_par_indeed
+ \delimitedtextparameter\c!after
+ \edef\p_delimited_spaceafter{\delimitedtextparameter\c!spaceafter}%
+ \ifempty\p_delimited_spaceafter \else
+ \blank[\p_delimited_spaceafter]%
+ \fi
+ \useindentnextparameter\delimitedtextparameter
+ \aftergroup\dorechecknextindentation}% AM: This was missing!
+
+\def\typo_delimited_start_txt
+ {\let\typo_delimited_stop\typo_delimited_stop_txt
+ \begingroup
+ \usedelimitedtextstyleandcolor\c!style\c!color
+ \typo_delimited_handle_left\c!left
+ \typo_delimited_start_content}
+
+\def\typo_delimited_stop_txt
+ {\typo_delimited_stop_content
+ \typo_delimited_handle_right\c!right
+ \endgroup}
+
+\permanent\protected\def\stopdelimitedtext
+ {\typo_delimited_stop
+ \dostoptagged
+ \typo_delimited_pop
+ \endgroup}
+
+\permanent\tolerant\protected\def\delimitedtext[#1]#*[#2]%
+ {\dontleavehmode % following ones can be omited
+ \typo_delimited_push{#1}{#2}%
+ \edef\p_delimited_method{\delimitedtextparameter\c!method}%
+ \ifx\p_delimited_method\v!font
+ \expandafter\typo_delimited_fontdriven
+ \else
+ \expandafter\typo_delimited_other
+ \fi}
+
+\def\typo_delimited_other
+ {\edef\p_delimited_location{\delimitedtextparameter\c!location}%
+ \ifx\p_delimited_location\v!paragraph
+ \expandafter\typo_delimited_par
+ \orelse\ifx\p_delimited_location\v!margin
+ \expandafter\typo_delimited_par
+ \else
+ \expandafter\typo_delimited_txt
+ \fi}
+
+% shortcuts
+
+\permanent\protected\def\startdelimited{\startdelimitedtext}
+\permanent\protected\def\stopdelimited {\stopdelimitedtext} % no let, dynamically assigned
+\permanent \def\delimited {\delimitedtext}
+
+% todo: \dostarttagged\t!nothing\empty % for left/right boxes
+
+%D We have 4 different location and symbol handlers (two pairs):
+%D
+%D \starttyping
+%D \input tufte \startquotation \input tufte \stopquotation
+%D
+%D \setupdelimitedtext
+%D [quotation]
+%D [nextleft=right,
+%D nextright=left]
+%D
+%D \input tufte \startquotation \input tufte \stopquotation
+%D
+%D \setupdelimitedtext
+%D [quotation]
+%D [nextleft={\symbol[nextleftquotation]},
+%D nextright={\symbol[nextrightquotation]}]
+%D
+%D \input tufte \startquotation \input tufte \stopquotation
+%D \stoptyping
+
+\permanent\protected\def\setnextleftdelimitedtextmark
+ {\ifempty\p_delimited_nextleft
+ % nothing
+ \orelse\ifx\p_delimited_nextleft\v!left
+ \typo_delimited_nextleft_symbol\p_delimited_left
+ \orelse\ifx\p_delimited_nextleft\v!right
+ \typo_delimited_nextleft_symbol\p_delimited_right
+ \else
+ \typo_delimited_nextleft_symbol\p_delimited_nextleft
+ \fi}
+
+\permanent\protected\def\setnextrightdelimitedtextmark
+ {\ifempty\p_delimited_nextright
+ % nothing
+ \orelse\ifx\p_delimited_nextright\v!right
+ \typo_delimited_nextright_symbol\p_delimited_right
+ \orelse\ifx\p_delimited_nextright\v!left
+ \typo_delimited_nextright_symbol\p_delimited_left
+ \else
+ \typo_delimited_nextright_symbol\p_delimited_nextright
+ \fi}
+
+\permanent\protected\def\leftdelimitedtextmark
+ {\ifempty\p_delimited_left
+ % nothing
+ \else
+ \typo_delimited_left_symbol\p_delimited_left
+ \fi}
+
+\permanent\protected\def\rightdelimitedtextmark
+ {\ifempty\p_delimited_right
+ % nothing
+ \else
+ \typo_delimited_right_symbol\p_delimited_right
+ \fi}
+
+\def\typo_delimited_left_symbol#1%
+ {\dostarttagged\t!delimitedsymbol\empty
+ \dotagsetdelimitedsymbol\s!left
+ \setbox\scratchbox\hbox{\usedelimitedtextstyleandcolor\c!symstyle\c!symcolor#1}%
+ \dontleavehmode
+ \edef\p_delimited_margin{\delimitedtextparameter\c!location}%
+ \ifx\p_delimited_margin\v!margin
+ \hskip-\wd\scratchbox
+ \fi
+ \box\scratchbox
+ \dostoptagged}
+
+\def\typo_delimited_right_symbol#1%
+ {\dostarttagged\t!delimitedsymbol\empty
+ \dotagsetdelimitedsymbol\s!right
+ \hsmash{\usedelimitedtextstyleandcolor\c!symstyle\c!symcolor#1}%
+ \dostoptagged}
+
+\def\typo_delimited_nextleft_symbol#1%
+ {\let\typo_delimited_reset_next_symbol\typo_delimited_reset_next_symbol_indeed
+ \localleftbox\bgroup
+ \enforced\swapmacros\leftboundarycharacter\rightboundarycharacter
+ \boundarycharactermode\plusone
+ \typo_delimited_left_symbol#1%
+ \egroup}
+
+\def\typo_delimited_nextright_symbol#1%
+ {\let\typo_delimited_reset_next_symbol\typo_delimited_reset_next_symbol_indeed
+ \localrightbox\bgroup
+ \enforced\swapmacros\leftboundarycharacter\rightboundarycharacter
+ \boundarycharactermode\plusone
+ \typo_delimited_right_symbol#1%
+ \egroup}
+
+\protected\def\typo_delimited_reset_next_symbol_indeed
+ {\localleftbox {}%
+ \localrightbox{}}%
+
+\let\typo_delimited_reset_next_symbol\relax
+
+\appendtoks
+ \typo_delimited_reset_next_symbol
+\to \everyforgetall
+
+% \starttext
+% \hyphenatedword{groepsvrijstellingsverordeningen}\par
+% \hyphenatedword{\quote{groepsvrijstellingsverordeningen}}\par
+% \dorecurse{100}{\hskip300pt\hskip\recurselevel pt test \quote{xxx xxxx}.\par}
+% \page \setuppapersize[A5][A4]
+% \quotation {overly beautiful pusillanimous sesquipedalian
+% longwinded} test test test test test test test test test test test
+% test test test test test test test test test test test test test
+% test test test test test test test test test test test test test
+% test test test test test test test test test test test test test
+% test test test
+% \stoptext
+
+% We have no real test case for this and it's broken already for a while,
+% even in \MKII. Maybe we should to this in \LUA. Only Italian has the
+% middlespeech parameter set.
+
+\def\typo_delimited_handle_middle#1% special case
+ {\ifconditional\c_typo_delimited_repeating
+ \begingroup
+ \usedelimitedtextstyleandcolor\c!symstyle\c!symcolor
+ \setbox\scratchbox\hbox{\delimitedtextparameter#1}%
+ \ifdim\wd\scratchbox>\zeropoint
+ \ifdim\lastkern=\d_typo_delimited_signal
+ \unkern
+ \hskip\hspaceamount\currentusedlanguage{interquotation}%
+ \else % maybe an option:
+ %\edef\p_delimited_margin{\delimitedtextparameter\c!location}%
+ %\ifx\p_delimited_margin\v!margin
+ % \hskip-\wd\scratchbox
+ %\fi
+ \fi
+ \strut % new, needed below
+ \dostarttagged\t!delimitedsymbol\empty
+ \dotagsetdelimitedsymbol\s!middle
+ \delimitedtextparameter#1% unhbox\scratchbox
+ \dostoptagged
+ % \penalty\plustenthousand % else overfull boxes, but that's better than dangling periods
+ \kern\d_typo_delimited_signal % +- \prewordbreak
+ \fi
+ \endgroup
+ \else
+ \settrue\c_typo_delimited_repeating
+ \fi}
+
+\def\typo_delimited_handle_left#1%
+ {\begingroup
+ \usedelimitedtextstyleandcolor\c!symstyle\c!symcolor
+ \setbox\scratchbox\hbox{\delimitedtextparameter#1}%
+ \ifdim\wd\scratchbox>\zeropoint
+ \ifdim\lastkern=\d_typo_delimited_signal
+ \unkern
+ \hskip\hspaceamount\currentusedlanguage{interquotation}%
+ \orelse\ifdim\lastskip=\d_typo_delimited_signal
+ \unskip
+ \hskip\hspaceamount\currentusedlanguage{interquotation}%
+ \fi
+ % \strut % new, needed below
+ % \ifhmode % else funny pagebeaks
+ % \penalty\plustenthousand
+ % \hskip\zeropoint % == \prewordbreak
+ % \fi
+ \strut % new, needed below
+ \dostarttagged\t!delimitedsymbol\empty
+ \dotagsetdelimitedsymbol\s!left
+ \delimitedtextparameter#1% unhbox\scratchbox
+ \dostoptagged
+ \penalty\plustenthousand % new per 2013-03-09 WS mailing list
+ \hskip\d_typo_delimited_signal % +- \prewordbreak
+ \fi
+ \endgroup}
+
+\def\typo_delimited_handle_right#1%
+ {\begingroup
+ \usedelimitedtextstyleandcolor\c!symstyle\c!symcolor
+ \setbox\scratchbox\hbox{\delimitedtextparameter#1}%
+ \ifdim\wd\scratchbox>\zeropoint
+ \ifdim\lastkern=\d_typo_delimited_signal
+ \unkern
+ \penalty\plustenthousand
+ \hskip\hspaceamount\currentusedlanguage{interquotation}%
+ \orelse\ifdim\lastskip=\d_typo_delimited_signal
+ \unskip
+ \penalty\plustenthousand
+ \hskip\hspaceamount\currentusedlanguage{interquotation}%
+ \fi
+ \ifhmode % else funny pagebeaks
+ \penalty\plustenthousand
+ \hskip\zeropoint % == \prewordbreak
+ \fi
+ \strut % new, needed below
+ \dostarttagged\t!delimitedsymbol\empty
+ \dotagsetdelimitedsymbol\s!right
+ \delimitedtextparameter#1% unhbox\scratchbox
+ \dostoptagged
+ \kern\d_typo_delimited_signal % +- \prewordbreak
+ \fi
+ \endgroup}
+
+\protected\def\typo_delimited_par
+ {\groupedcommand
+ {\dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext % block?
+ \usedelimitedtextstyleandcolor\c!style\c!color
+ \typo_delimited_handle_left\c!left
+ \typo_delimited_start_content}
+ {\typo_delimited_stop_content
+ \typo_delimited_handle_right\c!right
+ \removelastskip % hm
+ \dostoptagged
+ \typo_delimited_pop}}
+
+\protected\def\typo_delimited_txt
+ {\edef\p_left_right{\delimitedtextparameter\c!left\delimitedtextparameter\c!right}%
+ \ifempty\p_left_right
+ \expandafter\typo_delimited_attributed
+ \else
+ \expandafter\typo_delimited_quoted
+ \fi}
+
+\def\typo_delimited_quoted
+ {\dontleavehmode
+ \begingroup
+ \dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext
+ \typo_delimited_handle_left\c!left
+ \usedelimitedtextstyleandcolor\c!style\c!color
+ \typo_delimited_start_content
+ \bgroup
+ \aftergroup\typo_delimited_quoted_e
+ \let\next=}
+
+\def\typo_delimited_quoted_e
+ {\typo_delimited_stop_content
+ \typo_delimited_handle_right\c!right
+ \removelastskip % ?
+ \dostoptagged
+ \typo_delimited_pop
+ \endgroup}
+
+\def\typo_delimited_attributed
+ {\dontleavehmode
+ \begingroup
+ \dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext
+ \usedelimitedtextstyleandcolor\c!style\c!color
+ \typo_delimited_start_content
+ \bgroup
+ \aftergroup\typo_delimited_attributed_e
+ \let\next=}
+
+\def\typo_delimited_attributed_e
+ {\typo_delimited_stop_content
+ \dostoptagged
+ \typo_delimited_pop
+ \endgroup}
+
+\def\typo_delimited_fontdriven
+ {\dontleavehmode
+ \begingroup
+ \dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext
+ \usedlanguageparameter{\c!left\currentparentdelimitedtext}% was: \currentdelimitedtext
+ \usedelimitedtextstyleandcolor\c!style\c!color
+ \typo_delimited_start_content
+ \bgroup
+ \aftergroup\typo_delimited_fontdriven_e
+ \let\next=}
+
+\def\typo_delimited_fontdriven_e
+ {\typo_delimited_stop_content
+ \usedlanguageparameter{\c!right\currentparentdelimitedtext}% was: \currentdelimitedtext
+ \dostoptagged
+ \typo_delimited_pop
+ \endgroup}
+
+% testcase for nesting:
+%
+% \quotation{... \quotation{...} ...}
+% \startquotation ... \startquotation... \quotation{...} \stopquotation\space ...\stopquotation
+% \setupdelimitedtext[quotation][1][left=(,right=)]
+% \setupdelimitedtext[quotation][2][left={[},right={]}]
+% \setupdelimitedtext[quotation][3][left=\{,right=\}]
+% \quotation{... \quotation{...} ...}
+% \startquotation ... \startquotation... \quotation{...} \stopquotation\space ...\stopquotation
+
+\definedelimitedtext
+ [\v!quotation]
+ [\c!left={\symbol[\c!leftquotation]},
+ \c!right={\symbol[\c!rightquotation]},
+ \c!leftmargin=\v!standard]
+
+\definedelimitedtext
+ [\v!quote][\v!quotation]
+
+\setupdelimitedtext
+ [\v!quote]
+ [\c!location=\v!text,
+ \c!left={\symbol[\c!leftquote]},
+ \c!right={\symbol[\c!rightquote]}]
+
+\definedelimitedtext
+ [\v!blockquote][\v!quotation]
+
+\setupdelimitedtext
+ [\v!blockquote]
+ [\c!left=,
+ \c!right=]
+
+\definedelimitedtext
+ [\v!speech][\v!quotation]
+
+\setupdelimitedtext
+ [\v!speech]
+ [\c!repeat=\v!yes,
+ \c!left={\symbol[\c!leftspeech]},
+ \c!middle={\symbol[\c!middlespeech]},
+ \c!right={\symbol[\c!rightspeech]}]
+
+\definedelimitedtext
+ [\v!aside]
+ [\c!left={\symbol[\c!leftsentence]},
+ \c!right={\symbol[\c!rightsentence]}]
+
+% how do we call an tight quote
+%
+% \definedelimitedtext
+% [\v!quotation][\v!quotation]
+%
+% \setupdelimitedtext
+% [\v!quotation]
+% [\c!indentnext=\v!no,
+% \c!spacebefore=\v!nowhite]
+
+\permanent\protected\def\setupquotation{\setupdelimitedtext[\v!quotation]}
+\permanent\protected\def\setupquote {\setupdelimitedtext[\v!quote]}
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/typo-inj.mkiv b/tex/context/base/mkiv/typo-inj.mkiv
index db5bb2d5b..633d430e4 100644
--- a/tex/context/base/mkiv/typo-inj.mkiv
+++ b/tex/context/base/mkiv/typo-inj.mkiv
@@ -44,31 +44,35 @@
%D \startsection[title=Delta] fourth \index{fourth} \stopsection
%D \stoptext
-\permanent \protected\def\resetinjector [#1]{\clf_resetinjector{#1}}
-\permanent \protected\def\markinjector [#1]{\dontleavehmode\clf_markinjector{#1}}
-\permanent\tolerant\protected\def\checkinjector [#1]#*[#2]{\clf_checkinjector{#1}{#2}}
-\permanent \protected\def\checknextinjector [#1]{\clf_checkinjector{#1}{\v!next}}
-\permanent \protected\def\checkpreviousinjector [#1]{\clf_checkinjector{#1}{\v!previous}}
-%permanent \protected\def\checknextinjector [#1]{\clf_checknextinjector{#1}}
-%permanent \protected\def\checkpreviousinjector [#1]{\clf_checkpreviousinjector{#1}}
-\permanent\tolerant\protected\def\setinjector [#1]#*[#2]#*[#3]{\clf_setinjector{#1}{#2}{#3}}
-\permanent\tolerant\protected\def\showinjector [#1]{\clf_showinjector{#1}}
+\unexpanded\def\resetinjector [#1]{\clf_resetinjector{#1}}
+\unexpanded\def\markinjector [#1]{\dontleavehmode\clf_markinjector{#1}}
+\unexpanded\def\docheckinjector [#1][#2]{\clf_checkinjector{#1}{#2}}
+\unexpanded\def\checknextinjector [#1]{\clf_checkinjector{#1}{\v!next}}
+\unexpanded\def\checkpreviousinjector [#1]{\clf_checkinjector{#1}{\v!previous}}
+%unexpanded\def\checknextinjector [#1]{\clf_checknextinjector{#1}}
+%unexpanded\def\checkpreviousinjector [#1]{\clf_checkpreviousinjector{#1}}
+\unexpanded\def\dosetinjector [#1][#2][#3]{\clf_setinjector{#1}{#2}{#3}}
+\unexpanded\def\doshowinjector [#1]{\clf_showinjector{#1}}
-\permanent\protected\def\domarkinjector#1#2% called at the lua end
+\unexpanded\def\checkinjector{\dodoubleempty \docheckinjector}
+\unexpanded\def\setinjector {\dotripleargument\dosetinjector}
+\unexpanded\def\showinjector {\dosingleempty \doshowinjector}
+
+\unexpanded\def\domarkinjector#1#2% called at the lua end
{\dontleavehmode\llap{\infofont\ifcase#1\else\red\fi<#2>\quad}}
% low level definers .. we could have \injectors_mark and \injectors_check and then
% use \v!list instead of \s!list
-\permanent\protected\def\doinstallinjector#1%
+\unexpanded\def\doinstallinjector#1%
{\letvalue{typo_injectors_mark_#1}\donothing
\letvalue{typo_injectors_check_#1}\donothing}
-\permanent\protected\def\doactivateinjector#1% used at lua end
+\unexpanded\def\doactivateinjector#1% used at lua end
{\setuxvalue{typo_injectors_mark_#1}{\dontleavehmode\noexpand\clf_markinjector{#1}}%
\setuxvalue{typo_injectors_check_#1}{\noexpand\clf_checkinjector{#1}}}
-\permanent\protected\def\dotestinjector#1% only for testing outside unprotect
+\unexpanded\def\dotestinjector#1% only for testing outside unprotect
{\begincsname typo_injectors_check_#1\endcsname
\begincsname typo_injectors_mark_#1\endcsname}
diff --git a/tex/context/base/mkiv/typo-inj.mkxl b/tex/context/base/mkiv/typo-inj.mkxl
index 633d430e4..7bd01aac0 100644
--- a/tex/context/base/mkiv/typo-inj.mkxl
+++ b/tex/context/base/mkiv/typo-inj.mkxl
@@ -44,37 +44,32 @@
%D \startsection[title=Delta] fourth \index{fourth} \stopsection
%D \stoptext
-\unexpanded\def\resetinjector [#1]{\clf_resetinjector{#1}}
-\unexpanded\def\markinjector [#1]{\dontleavehmode\clf_markinjector{#1}}
-\unexpanded\def\docheckinjector [#1][#2]{\clf_checkinjector{#1}{#2}}
-\unexpanded\def\checknextinjector [#1]{\clf_checkinjector{#1}{\v!next}}
-\unexpanded\def\checkpreviousinjector [#1]{\clf_checkinjector{#1}{\v!previous}}
-%unexpanded\def\checknextinjector [#1]{\clf_checknextinjector{#1}}
-%unexpanded\def\checkpreviousinjector [#1]{\clf_checkpreviousinjector{#1}}
-\unexpanded\def\dosetinjector [#1][#2][#3]{\clf_setinjector{#1}{#2}{#3}}
-\unexpanded\def\doshowinjector [#1]{\clf_showinjector{#1}}
+\permanent \protected\def\resetinjector [#1]{\clf_resetinjector{#1}}
+\permanent \protected\def\markinjector [#1]{\dontleavehmode\clf_markinjector{#1}}
+\permanent\tolerant\protected\def\checkinjector [#1]#*[#2]{\clf_checkinjector{#1}{#2}}
+\permanent \protected\def\checknextinjector [#1]{\clf_checkinjector{#1}{\v!next}}
+\permanent \protected\def\checkpreviousinjector [#1]{\clf_checkinjector{#1}{\v!previous}}
+%permanent \protected\def\checknextinjector [#1]{\clf_checknextinjector{#1}}
+%permanent \protected\def\checkpreviousinjector [#1]{\clf_checkpreviousinjector{#1}}
+\permanent\tolerant\protected\def\setinjector [#1]#*[#2]#*[#3]{\clf_setinjector{#1}{#2}{#3}}
+\permanent\tolerant\protected\def\showinjector [#1]{\clf_showinjector{#1}}
-\unexpanded\def\checkinjector{\dodoubleempty \docheckinjector}
-\unexpanded\def\setinjector {\dotripleargument\dosetinjector}
-\unexpanded\def\showinjector {\dosingleempty \doshowinjector}
-
-\unexpanded\def\domarkinjector#1#2% called at the lua end
+\permanent\protected\def\domarkinjector#1#2% called at the lua end
{\dontleavehmode\llap{\infofont\ifcase#1\else\red\fi<#2>\quad}}
% low level definers .. we could have \injectors_mark and \injectors_check and then
% use \v!list instead of \s!list
-\unexpanded\def\doinstallinjector#1%
+\permanent\protected\def\doinstallinjector#1%
{\letvalue{typo_injectors_mark_#1}\donothing
\letvalue{typo_injectors_check_#1}\donothing}
-\unexpanded\def\doactivateinjector#1% used at lua end
+\permanent\protected\def\doactivateinjector#1% used at lua end
{\setuxvalue{typo_injectors_mark_#1}{\dontleavehmode\noexpand\clf_markinjector{#1}}%
\setuxvalue{typo_injectors_check_#1}{\noexpand\clf_checkinjector{#1}}}
-\unexpanded\def\dotestinjector#1% only for testing outside unprotect
+\permanent\protected\def\dotestinjector#1% only for testing outside unprotect
{\begincsname typo_injectors_check_#1\endcsname
\begincsname typo_injectors_mark_#1\endcsname}
\protect \endinput
-
diff --git a/tex/context/base/mkiv/typo-itc.mklx b/tex/context/base/mkiv/typo-itc.mklx
new file mode 100644
index 000000000..f979261c8
--- /dev/null
+++ b/tex/context/base/mkiv/typo-itc.mklx
@@ -0,0 +1,60 @@
+%D \module
+%D [ file=typo-itc,
+%D version=2011.10.08,
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Italic Correction,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%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 Typesetting Macros / Italics Corrections}
+
+\unprotect
+
+%D The brave might try:
+%D
+%D \starttyping
+%D \definefontfeature[default][default][itlc=yes,textitalics=yes]
+%D \setupitaliccorrection[global,always]
+%D \stoptyping
+
+\registerctxluafile{typo-itc}{}
+
+\definesystemattribute[italics] [public]
+\definesystemattribute[mathitalics][public]
+
+% \let\/=/
+% \let\emphasiscorrection\donothing
+
+\ifdefined \normalitaliccorrection \else
+ \aliased\let\normalitaliccorrection\italiccorrection
+\fi
+
+\permanent\protected\def\italiccorrection
+ {\ifnum\c_attr_italics<\plusone\normalitaliccorrection\fi}
+
+\pushoverloadmode
+ \aliased\let\/\italiccorrection
+\popoverloadmode
+
+% 1 = end of word
+% 2 = end of word and end of a list
+
+\permanent\protected\def\setitaliccorrection [#code]{\clf_setitaliccorrection#code\relax} % todo: public implementor
+\permanent\protected\def\resetitaliccorrection {\clf_resetitaliccorrection} % todo: public implementor
+\permanent\protected\def\setupitaliccorrection[#settings]{\clf_setupitaliccorrection{#settings}} % todo: public implementor
+
+% global : no attributes, just always (faster and less memory)
+% text : only text
+% always : text and boxes
+% none : -
+
+\appendtoks
+ \c_attr_italics\attributeunsetvalue
+\to \everymathematics
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/typo-krn.mkxl b/tex/context/base/mkiv/typo-krn.mkxl
new file mode 100644
index 000000000..5573fc529
--- /dev/null
+++ b/tex/context/base/mkiv/typo-krn.mkxl
@@ -0,0 +1,143 @@
+%D \module
+%D [ file=typo-krn,
+%D version=2009.03.27, % code moved from core-spa.mkiv
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Spacing,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%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 Typesetting Macros / Kerning}
+
+\unprotect
+
+\registerctxluafile{typo-krn}{}
+
+\definesystemattribute[kern][public]
+
+% more
+%
+% {\setcharacterkerning[extrakerning]\input davis\relax}
+
+\installcorenamespace{characterkerning}
+
+\installcommandhandler \??characterkerning {characterkerning} \??characterkerning
+
+\permanent\protected\def\setcharacterkerning[#1]%
+ {\edef\currentcharacterkerning{#1}%
+ \ifx\currentcharacterkerning\s!reset
+ \resetcharacterkerning
+ \else
+ \typo_kerning_set
+ \fi}
+
+\def\typo_kerning_set
+ {\usecharacterkerningstyleandcolor\c!style\c!color % goodie, maybe also strut
+ \useaddfontfeatureparameter\characterkerningparameter
+ \clf_setcharacterkerning{\characterkerningparameter\c!factor}}
+
+\permanent\protected\def\resetcharacterkerning % fast one
+ {\c_attr_kern\attributeunsetvalue}
+
+\appendtoks
+ \resetcharacterkerning
+\to \everyresettypesetting
+
+\definecharacterkerning [extrakerning] [\c!factor=.125] % used in manuals
+
+%D Added after discussion on list (posted by WS, adapted abit by HH) \unknown\ this
+%D needs to be interfaced (\type {\v!kerncharacters}).
+%D
+%D \starttyping
+%D \setuphead[section][style=\sca,textstyle={\kerncharacters[.5]}] \section{Section}
+%D \stoptyping
+%D
+%D We could combine this with the previous definition command but then we always
+%D would get a command defined which is not beforehand a good idea.
+%D
+%D Here we need to keep the groupedcommand solution as it is used as modifier.
+
+\appendtoks
+ \frozen\instance\setuevalue{\currentcharacterkerning}%
+ {\doifelsenextoptional
+ {\typo_kerning_apply_yes{\currentcharacterkerning}}%
+ {\typo_kerning_apply_nop{\currentcharacterkerning}}}%
+\to \everydefinecharacterkerning
+
+\protected\def\typo_kerning_apply_yes#1[#2]%
+ {\groupedcommand{\typo_kerning_apply_yes_indeed{#1}{#2}}\donothing}
+
+\protected\def\typo_kerning_apply_nop#1%
+ {\groupedcommand{\typo_kerning_apply_nop_indeed{#1}}\donothing}
+
+\def\typo_kerning_apply_yes_indeed#1#2%
+ {\edef\currentcharacterkerning{#1}%
+ \setupcurrentcharacterkerning[\c!factor=#2]%
+ \typo_kerning_set}
+
+\def\typo_kerning_apply_nop_indeed#1%
+ {\edef\currentcharacterkerning{#1}%
+ \typo_kerning_set}
+
+\definecharacterkerning [\v!kerncharacters] [\c!factor=.125]
+\definecharacterkerning [\v!letterspacing ] [\v!kerncharacters] [\c!features=letterspacing]
+
+%D \macros
+%D {stretched}
+%D
+%D Stretching characters in a word is a sort of typographical murder. Nevertheless
+%D we support this manipulation for use in for instance titles.
+%D
+%D \starttyping
+%D \hbox to 5cm{\stretched{to the limit}}
+%D \stretched{to the limit}
+%D \stretched[width=10cm]{to the limit}
+%D \stoptyping
+%D
+%D \typebuffer
+%D
+%D or
+%D
+%D \startexample
+%D \getbuffer
+%D \stopexample
+%D
+%D \showsetup{stretched}
+%D
+%D This command replaces the old \MKII\ variant.
+
+\definecharacterkerning
+ [\v!stretched]
+ [\c!factor=\v!max,
+ \c!width=\availablehsize]
+
+\permanent\protected\def\setupstretched
+ {\setupcharacterkerning[\v!stretched]}
+
+\pushoverloadmode
+
+\enforced\permanent\tolerant\protected\def\stretched[#1]#:#2%
+ {\begingroup
+ \let\currentcharacterkerning\v!stretched
+ \ifparameter#1\or
+ \setupcurrentcharacterkerning[#1]%
+ \fi
+ \edef\p_width{\characterkerningparameter\c!width}%
+ \ifx\p_width\empty \else
+ \hbox to \p_width
+ \fi
+ \bgroup
+ \usecharacterkerningstyleandcolor\c!style\c!color
+ \useaddfontfeatureparameter\characterkerningparameter
+ \typo_kerning_set
+ #2%
+ \egroup
+ \endgroup}
+
+\popoverloadmode
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/typo-lan.mkxl b/tex/context/base/mkiv/typo-lan.mkxl
new file mode 100644
index 000000000..9d137f5a5
--- /dev/null
+++ b/tex/context/base/mkiv/typo-lan.mkxl
@@ -0,0 +1,64 @@
+%D \module
+%D [ file=typo-lan,
+%D version=2013.03.22,
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Language Goodies,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%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 Typography Macros / Languages}
+
+\unprotect
+
+\registerctxluafile{typo-lan}{}
+
+%D \macros
+%D {averagecharwidth, charwidthlanguage}
+%D
+%D This is a more \MKIV-ish variant of lang-frq.mkiv. The methods are gone as one
+%D doesn't need the tables for them. The main macro is \type {\averagecharwidth}
+%D which behaves like a dimension register.
+%D
+%D I finally decided to reimplement this as I needed it for a manual (which is often
+%D a reason for such a rewrite). With some inspiring Porcupine Tree in the
+%D background it's not the worst thing to do.
+
+\mutable\def\charwidthlanguage{\currentmainlanguage}
+
+\permanent\def\averagecharwidth {\dimexpr\clf_averagecharwidth{\charwidthlanguage}\scaledpoint\relax}
+\permanent\def\languagecharwidth#1{\dimexpr\clf_averagecharwidth{#1}\scaledpoint\relax}
+
+\protect
+
+\continueifinputfile{typo-lan.mkiv}
+
+\setuplayout[backspace=4cm]
+
+\showframe
+
+\starttext
+
+\startbuffer
+
+\mainlanguage[en] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par
+\mainlanguage[de] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par
+\mainlanguage[nl] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par
+
+\stopbuffer
+
+\getbuffer \blank
+
+\switchtobodyfont[pagella]
+
+\getbuffer \blank
+
+\switchtobodyfont[tt,8pt]
+
+\getbuffer
+
+\stoptext
diff --git a/tex/context/base/mkiv/typo-lin.lmt b/tex/context/base/mkiv/typo-lin.lmt
new file mode 100644
index 000000000..e49f13b60
--- /dev/null
+++ b/tex/context/base/mkiv/typo-lin.lmt
@@ -0,0 +1,475 @@
+if not modules then modules = { } end modules ['typo-lin'] = {
+ version = 1.001,
+ comment = "companion to typo-lin.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This is experimental code. The idea is to create an anchor point in a line but there are
+-- some considerations:
+--
+-- * if we normalize in order to have more easy access later on, we need to normalize all
+-- lines and we cannot catch all without losing efficiency
+--
+-- * if we normalize too soon, we might have issues with changed properties later on
+--
+-- * if we normalize too late, we have no knowledge of the current hsize
+--
+-- * if we always create an anchor we also create unwanted overhead if it is not used later
+-- on (more nodes)
+--
+-- The question is: do we mind of at the first access an anchor is created? As we cannot know
+-- that now, I choose some middle ground but this might change. if we don't assume direct
+-- access but only helpers, we can decide later.
+--
+-- Because of right2left mess it makes sense to use helpers so that we only need to deal with
+-- this mess once, in helpers. The more abstraction there the better. And so, after a week of
+-- experimenting, yet another abstraction was introduced.
+--
+-- The danger of adding the anchor later is that we adapt the head and so the caller needs to
+-- check that ... real messy. On the other hand, we soldom traverse the line. And other
+-- mechanisms can push stuff in front too. Actually that alone can mess up analysis when we
+-- delay too much. So in the end we need to accept the slow down.
+--
+-- We only need to normalize the left side because when we mess around we keep the page stream
+-- order (and adding content to the right of the line is a no-go for tagged etc. For the same
+-- reason we don't use two left anchors (each side fo leftskip) because there can be stretch.
+-- But, maybe there are good reasons for having just that anchor (mostly for educational purposes
+-- I guess.)
+--
+-- At this stage the par node is no longer of any use so we remove it (each line has the
+-- direction attached). We might at some point also strip the disc nodes as they no longer serve
+-- a purpose but that can better be a helper. Anchoring left has advantage of keeping page
+-- stream.
+--
+-- This looks a bit messy but we want to keep the box as it is so \showboxes still visualizes as
+-- expected. Normally left and rightskips end up in the line while hangindents become shifts and
+-- hsize corrections. We could normalize this to a line with
+
+-- indent : hlist type 3
+-- hangindent : shift and width
+
+local type = type
+
+local trace_anchors = false trackers.register("paragraphs.anchors", function(v) trace_anchors = v end)
+
+local report = logs.reporter("anchors")
+
+local nuts = nodes.nuts
+local nodecodes = nodes.nodecodes
+local gluecodes = nodes.gluecodes
+local listcodes = nodes.listcodes
+
+local hlist_code = nodecodes.hlist
+local glue_code = nodecodes.glue
+local kern_code = nodecodes.kern
+local linelist_code = listcodes.line
+----- par_code = nodecodes.par
+local leftskip_code = gluecodes.leftskip
+local rightskip_code = gluecodes.rightskip
+local parfillskip_code = gluecodes.parfillskip
+
+local tonut = nodes.tonut
+local tonode = nodes.tonode
+
+local nexthlist = nuts.traversers.hlist
+local insert_before = nuts.insert_before
+local insert_after = nuts.insert_after
+local find_tail = nuts.tail
+local rehpack = nuts.rehpack
+----- remove_node = nuts.remove
+
+local getsubtype = nuts.getsubtype
+local getlist = nuts.getlist
+local setlist = nuts.setlist
+local getid = nuts.getid
+local getnext = nuts.getnext
+local getprev = nuts.getprev
+local getboth = nuts.getboth
+local setlink = nuts.setlink
+local setkern = nuts.setkern
+local getkern = nuts.getkern
+local getdirection = nuts.getdirection
+local getshift = nuts.getshift
+local setshift = nuts.setshift
+local getwidth = nuts.getwidth
+local setwidth = nuts.setwidth
+
+local setprop = nuts.setprop
+local getprop = nuts.rawprop -- getprop
+
+local effectiveglue = nuts.effective_glue
+
+local nodepool = nuts.pool
+local new_kern = nodepool.kern
+local new_leftskip = nodepool.leftskip
+local new_rightskip = nodepool.rightskip
+local new_hlist = nodepool.hlist
+local new_rule = nodepool.rule
+local new_glue = nodepool.glue
+
+local righttoleft_code = nodes.dirvalues.righttoleft
+
+local texgetcount = tex.getcount
+local texgetglue = tex.getglue
+local setmetatableindex = table.setmetatableindex
+local formatters = string.formatters
+
+local jobpositions = job.positions
+local getposition = jobpositions.get
+local getreserved = jobpositions.getreserved
+
+local paragraphs = { }
+typesetters.paragraphs = paragraphs
+
+local addskips = false -- todo: use engine normalizer
+local noflines = 0
+
+-- This is the third version, a mix between immediate (prestine lines) and delayed
+-- as we don't want anchors that are not used.
+
+-- I will make a better variant once lmtx is stable i.e. less clutter.
+
+local function finalize(prop,key) -- delayed calculations
+ local line = prop.line
+ local hsize = prop.hsize
+ local width = prop.width
+ local shift = getshift(line) -- dangerous as it can be vertical as well
+ local reverse = getdirection(line) == righttoleft_code or false
+ local pack = new_hlist()
+ local head = getlist(line)
+ local delta = 0
+ if reverse then
+ delta = - shift + (hsize - width)
+ else
+ delta = shift
+ end
+ local kern1 = new_kern(delta)
+ local kern2 = new_kern(-delta)
+ head = insert_before(head,head,kern1)
+ head = insert_before(head,head,pack)
+ head = insert_before(head,head,kern2)
+ setlist(line,head)
+ local where = {
+ pack = pack,
+ head = nil,
+ tail = nil,
+ }
+ prop.where = where
+ prop.reverse = reverse
+ prop.shift = shift
+ setmetatableindex(prop,nil)
+ return prop[key]
+end
+
+local function normalize(line,islocal) -- assumes prestine lines, nothing pre/appended
+ local oldhead = getlist(line)
+ local head = oldhead
+ local leftskip = nil
+ local rightskip = nil
+ local width = getwidth(line)
+ local hsize = islocal and width or tex.hsize
+ local lskip = 0
+ local rskip = 0
+ local pskip = 0
+ local current = head
+ local id = getid(current)
+ if id == glue_code then
+ local subtype = getsubtype(head)
+ if subtype == leftskip_code then
+ leftskip = head
+ lskip = getwidth(head) or 0
+ end
+ current = getnext(head)
+ id = getid(current)
+ end
+ -- no:
+ -- if id == par_code then
+ -- head = remove_node(head,head,true)
+ -- end
+ local tail = find_tail(head)
+ local current = tail
+ local id = getid(current)
+ if id == glue_code then
+ if getsubtype(current) == rightskip_code then
+ rightskip = tail
+ rskip = getwidth(current) or 0
+ current = getprev(tail)
+ id = getid(current)
+ end
+ if id == glue_code then
+ if getsubtype(current) == parfillskip_code then
+ pskip = effectiveglue(current,line)
+ end
+ end
+ end
+ if addskips then
+ if rightskip and not leftskip then
+ leftskip = new_leftskip(lskip)
+ head = insert_before(head,head,leftskip)
+ end
+ if leftskip and not rightskip then
+ rightskip = new_rightskip(0)
+ head, tail = insert_after(head,tail,rightskip)
+ end
+ end
+ if head ~= oldhead then
+ setlist(line,head)
+ end
+ noflines = noflines + 1
+ local prop = {
+ width = width,
+ hsize = hsize,
+ leftskip = lskip,
+ rightskip = rskip,
+ parfillskip = pskip,
+ line = line,
+ number = noflines,
+ }
+ setprop(line,"line",prop)
+ setmetatableindex(prop,finalize)
+ return prop
+end
+
+function paragraphs.checkline(n)
+ return getprop(n,"line") or normalize(n,true)
+end
+
+-- do we still need this:
+
+function paragraphs.normalize(head,islocal)
+ if texgetcount("pagebodymode") > 0 then
+ -- can be an option, maybe we need a proper state in lua itself ... is this check still needed?
+ return head, false
+ end
+ -- normalizer : todo, get the data, no need to normalize
+ for line, subtype in nexthlist, head do
+ if subtype == linelist_code and not getprop(line,"line") then
+ normalize(line)
+ end
+ end
+ return head, true -- true is obsolete
+end
+
+-- print(nodes.idstostring(head))
+
+-- We do only basic positioning and leave compensation for directions and distances
+-- to the caller as that one knows the circumstances better.
+
+-- todo: only in mvl or explicitly, e.g. framed or so, not in all lines
+
+local function addtoline(n,list,option)
+ local line = getprop(n,"line")
+ if not line then
+ line = normalize(n,true)
+ end
+ if line then
+ if trace_anchors and not line.traced then
+ line.traced = true
+ local rule = new_rule(2*65536,2*65536,1*65536)
+ local list = insert_before(rule,rule,new_kern(-1*65536))
+ addtoline(n,list)
+ local rule = new_rule(2*65536,6*65536,-3*65536)
+ local list = insert_before(rule,rule,new_kern(-1*65536))
+ addtoline(n,list,"internal")
+ else
+ line.traced = true
+ end
+ local list = tonut(list)
+ local where = line.where
+ local head = where.head
+ local tail = where.tail
+ local blob = new_hlist(list)
+ local delta = 0
+ if option == "internal" then
+ if line.reverse then
+ delta = line.shift - line.leftskip - (line.hsize - line.width)
+ else
+ delta = line.shift + line.leftskip
+ end
+ end
+ -- always kerns, also when 0 so that we can adapt but we can optimize if needed
+ -- by keeping a hash as long as we use the shiftinline helper .. no need to
+ -- optimize now .. we can also decide to put each blob in a hlist
+ local kern = new_kern(delta)
+ if tail then
+ head, tail = insert_after(head,tail,kern)
+ else
+ head, tail = kern, kern
+ setlist(where.pack,head)
+ end
+ head, tail = insert_after(head,tail,blob)
+ local kern = new_kern(-delta)
+ head, tail = insert_after(head,tail,kern)
+ --
+ where.head = head
+ where.tail = tail
+ return line, blob
+ else
+ -- report("unknown anchor")
+ end
+end
+
+local function addanchortoline(n,anchor)
+ local line = type(n) ~= "table" and getprop(n,"line") or n
+ if not line then
+ line = normalize(n,true)
+ end
+ if line then
+ local anchor = tonut(anchor)
+ local where = line.where
+ if trace_anchors then
+ anchor = new_hlist(setlink(
+ anchor,
+ new_kern(-65536/4),
+ new_rule(65536/2,4*65536,4*65536),
+ new_kern(-65536/4-4*65536),
+ new_rule(8*65536,65536/4,65536/4)
+ ))
+ setwidth(anchor,0)
+ end
+ if where.tail then
+ local head = where.head
+ insert_before(head,head,anchor)
+ else
+ where.tail = anchor
+ end
+ setlist(where.pack,anchor)
+ where.head = anchor
+ return line
+ end
+end
+
+paragraphs.addtoline = addtoline
+paragraphs.addanchortoline = addanchortoline
+
+function paragraphs.moveinline(n,blob,dx,dy)
+ if not blob then
+ return
+ end
+ if not dx then
+ dx = 0
+ end
+ if not dy then
+ dy = 0
+ end
+ if dx ~= 0 or dy ~= 0 then
+ local line = type(n) ~= "table" and getprop(n,"line") or n
+ if line then
+ if dx ~= 0 then
+ local prev, next = getboth(blob)
+ if prev and getid(prev) == kern_code then
+ setkern(prev,getkern(prev) + dx)
+ end
+ if next and getid(next) == kern_code then
+ setkern(next,getkern(next) - dx)
+ end
+ end
+ if dy ~= 0 then
+ if getid(blob) == hlist_code then
+ setshift(blob,getshift(blob) + dy)
+ end
+ end
+ else
+-- report("no line")
+ end
+ end
+end
+
+local latelua = nodepool.latelua
+local setposition = jobpositions.setspec
+
+local function setanchor(h_anchor)
+ return latelua {
+ action = setposition,
+ name = "md:h",
+ index = h_anchor,
+ value = { x = true, c = true },
+ }
+end
+
+function paragraphs.calculatedelta(n,width,delta,atleft,islocal,followshape,area)
+ local line = type(n) ~= "table" and getprop(n,"line") or n
+ if not line then
+ line = normalize(n,true)
+ end
+ local hmove = 0
+ if line then
+ local reverse = line.reverse
+ -- basic hsize based anchoring
+ if atleft then
+ if reverse then
+ -- delta = delta
+ else
+ delta = - delta - width
+ end
+ else
+ if reverse then
+ delta = - delta - width - line.hsize
+ else
+ delta = delta + line.hsize
+ end
+ end
+ if islocal then
+ -- relative to hsize with leftskip / rightskip compensation
+ if atleft then
+ if reverse then
+ delta = delta - line.leftskip
+ else
+ delta = delta + line.leftskip
+ end
+ else
+ if reverse then
+ delta = delta + line.rightskip
+ else
+ delta = delta - line.rightskip
+ end
+ end
+ if followshape then
+ -- shape compensation
+ if atleft then
+ if reverse then
+ delta = delta + line.shift - line.hsize + line.width
+ else
+ delta = delta + line.shift
+ end
+ else
+ if reverse then
+ delta = delta + line.shift + line.parfillskip
+ else
+ delta = delta + line.shift - line.hsize + line.width - line.parfillskip
+ end
+ end
+ end
+ end
+ if area then
+ local number = line.number
+ if not line.hanchor then
+ addanchortoline(line,setanchor(number))
+ line.hanchor = true
+ end
+ local blob = getposition(s_anchor,number)
+ if blob then
+ local reference = getreserved(area,blob.c)
+ if reference then
+ hmove = (reference.x or 0) - (blob.x or 0)
+ if atleft then
+ if reverse then
+ hmove = hmove + (reference.w or 0)
+ else
+ -- hmove = hmove
+ end
+ else
+ if reverse then
+ hmove = hmove + line.hsize
+ else
+ hmove = hmove + (reference.w or 0) - line.hsize
+ end
+ end
+ end
+ end
+ end
+ end
+ return delta, hmove
+end
diff --git a/tex/context/base/mkiv/typo-lin.lua b/tex/context/base/mkiv/typo-lin.lua
index 4496bd44b..55fd08c5a 100644
--- a/tex/context/base/mkiv/typo-lin.lua
+++ b/tex/context/base/mkiv/typo-lin.lua
@@ -238,73 +238,53 @@ end
-- do we still need this:
-if CONTEXTLMTXMODE > 0 then
-
- function paragraphs.normalize(head,islocal)
- if texgetcount("pagebodymode") > 0 then
- -- can be an option, maybe we need a proper state in lua itself ... is this check still needed?
- return head, false
- end
- -- normalizer : todo, get the data, no need to normalize
- for line, subtype in nexthlist, head do
- if subtype == linelist_code and not getprop(line,"line") then
- normalize(line)
- end
- end
- return head, true -- true is obsolete
+function paragraphs.normalize(head,islocal)
+ if texgetcount("pagebodymode") > 0 then
+ -- can be an option, maybe we need a proper state in lua itself ... is this check still needed?
+ return head, false
end
-
-else
-
- function paragraphs.normalize(head,islocal)
- if texgetcount("pagebodymode") > 0 then
- -- can be an option, maybe we need a proper state in lua itself ... is this check still needed?
- return head, false
- end
- -- this can become a separate handler but it makes sense to integrate it here
- local mode = texgetcount("parfillleftmode")
- if mode > 0 then
- local l_width, l_stretch, l_shrink = texgetglue("parfillleftskip")
- if l_width ~= 0 or l_stretch ~= 0 or l_shrink ~= 0 then
- local last = nil -- a nut
- local done = mode == 2 -- false
- for line, subtype in nexthlist, head do
- if subtype == linelist_code and not getprop(line,"line") then
- if done then
- last = line
- else
- done = true
- end
+ -- this can become a separate handler but it makes sense to integrate it here
+ local mode = texgetcount("parfillleftmode")
+ if mode > 0 then
+ local l_width, l_stretch, l_shrink = texgetglue("parfillleftskip")
+ if l_width ~= 0 or l_stretch ~= 0 or l_shrink ~= 0 then
+ local last = nil -- a nut
+ local done = mode == 2 -- false
+ for line, subtype in nexthlist, head do
+ if subtype == linelist_code and not getprop(line,"line") then
+ if done then
+ last = line
+ else
+ done = true
end
end
- if last then -- only if we have more than one line
- local head = getlist(last)
- local current = head
+ end
+ if last then -- only if we have more than one line
+ local head = getlist(last)
+ local current = head
+ if current then
+ if getid(current) == glue_code and getsubtype(current,leftskip_code) then
+ current = getnext(current)
+ end
if current then
- if getid(current) == glue_code and getsubtype(current,leftskip_code) then
- current = getnext(current)
- end
- if current then
- head, current = insert_before(head,current,new_glue(l_width,l_stretch,l_shrink))
- if head == current then
- setlist(last,head)
- end
- -- can be a 'rehpack(h )'
- rehpack(last)
+ head, current = insert_before(head,current,new_glue(l_width,l_stretch,l_shrink))
+ if head == current then
+ setlist(last,head)
end
+ -- can be a 'rehpack(h )'
+ rehpack(last)
end
end
end
end
- -- normalizer
- for line, subtype in nexthlist, head do
- if subtype == linelist_code and not getprop(line,"line") then
- normalize(line)
- end
+ end
+ -- normalizer
+ for line, subtype in nexthlist, head do
+ if subtype == linelist_code and not getprop(line,"line") then
+ normalize(line)
end
- return head, true -- true is obsolete
end
-
+ return head, true -- true is obsolete
end
-- print(nodes.idstostring(head))
diff --git a/tex/context/base/mkiv/typo-lin.mkxl b/tex/context/base/mkiv/typo-lin.mkxl
new file mode 100644
index 000000000..6b142b32d
--- /dev/null
+++ b/tex/context/base/mkiv/typo-lin.mkxl
@@ -0,0 +1,25 @@
+%D \module
+%D [ file=typo-lin,
+%D version=2015.08.01,
+%D title=\CONTEXT\ Typographic Macros,
+%D subtitle=Line Normalization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%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 Typographic Macros / Normalization}
+
+%D Beware: the mvl callback is also called when a line is added to a vbox.
+
+\registerctxluafile{typo-lin}{autosuffix}
+
+\unprotect
+
+% nothing yet / experimental
+
+\protect \endinput
+
diff --git a/tex/context/base/mkiv/typo-pnc.mkxl b/tex/context/base/mkiv/typo-pnc.mkxl
new file mode 100644
index 000000000..b5b1a17d6
--- /dev/null
+++ b/tex/context/base/mkiv/typo-pnc.mkxl
@@ -0,0 +1,55 @@
+%D \module
+%D [ file=typo-pnc,
+%D version=2017.06.23, % experiment in project
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Punctuation,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%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 Typesetting Macros / Punctuation}
+
+\unprotect
+
+% In manuals we often have "foo e.g. bar" where we then have to compensate spaces
+% with "foo e.g.\ bar" so let's see if we can automate that and at the same time
+% inject spaces between the snippets. It gets boring writing this kind of code.
+
+\registerctxluafile{typo-pnc}{}
+
+\definesystemattribute[periodkern][public,global]
+
+\installcorenamespace{periodkerning}
+
+\installcommandhandler \??periodkerning {periodkerning} \??periodkerning
+
+\permanent\protected\def\setperiodkerning[#1]%
+ {\edef\currentperiodkerning{#1}%
+ \ifx\currentperiodkerning\s!reset
+ \resetperiodkerning
+ \else
+ \typo_periodkerning_set
+ \fi}
+
+\def\typo_periodkerning_set
+ {\clf_setperiodkerning{\periodkerningparameter\c!factor}}
+
+\permanent\protected\def\resetperiodkerning % fast one
+ {\c_attr_periodkern\attributeunsetvalue}
+
+\appendtoks
+ \resetperiodkerning
+\to \everyresettypesetting
+
+\defineperiodkerning [zerospaceperiods] [\c!factor=0]
+\defineperiodkerning [smallspaceperiods] [\c!factor=.25]
+\defineperiodkerning [halfspaceperiods] [\c!factor=.5]
+
+% If we ever need a command, see typo-krn.mkiv but it doesn't make much sense
+% to have it.
+
+\protect
diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml
index f568fead2..42340184b 100644
--- a/tex/context/interface/mkii/keys-it.xml
+++ b/tex/context/interface/mkii/keys-it.xml
@@ -1380,7 +1380,6 @@
<!-- definitions for interface commands for language it -->
<cd:commands>
- <cd:command name='CAPPED' value='CAP'/>
<cd:command name='Character' value='Lettera'/>
<cd:command name='Characters' value='Lettere'/>
<cd:command name='MONTH' value='MESE'/>
diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl
index 9ba57882d..a28a27775 100644
--- a/tex/context/modules/mkiv/s-system-macros.mkxl
+++ b/tex/context/modules/mkiv/s-system-macros.mkxl
@@ -92,7 +92,7 @@
local function show(visible, check)
-- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" }
- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|" }
+ context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" }
for i=1,#list do
local k = list[i]
if check(k) then
@@ -102,7 +102,6 @@
local immutable = v.immutable and "immutable"
local primitive = v.primitive and "primitive"
local mutable = v.mutable and "mutable"
- -- local tolerant = v.tolerant and "tolerant"
local noaligned = v.noaligned and "noaligned"
local instance = v.instance and "instance"
local parameters = v.parameters
@@ -115,12 +114,12 @@
ctx_NC() if primitive then ctx_bold(csname) else context(csname) end
ctx_NC() if parameters then context(parameters > 0 and parameters or "-") end
ctx_NC() context(cscommand)
- -- ctx_NC() if tolerant then context(tolerant) end
ctx_NC() if primitive then context(primitive) end
ctx_NC() if permanent then context(permanent) end
ctx_NC() if frozen then context(frozen) end
ctx_NC() if immutable then context(immutable) end
ctx_NC() if mutable then context(mutable) end
+ ctx_NC() if instance then context(instance) end
ctx_NC() if noaligned then context(noaligned) end
ctx_NC() if filename then context(hashnames[filename]) end
ctx_NC() ctx_NR()
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 55d0f22d6..a7b27b278 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2020-11-16 19:37
+-- merge date : 2020-11-17 12:39
do -- begin closure to overcome local limits and interference