summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-02-11 19:40:11 +0200
committerMarius <mariausol@gmail.com>2011-02-11 19:40:11 +0200
commitab20b3338556714d8be0ae8fbf8d79a7cfe70e21 (patch)
tree32d581f954b6ec471c1dcc5b9d65f21365ae9cff /tex
parent6763e3954714b12c9e3cc95b557ec0cf48183fdd (diff)
downloadcontext-ab20b3338556714d8be0ae8fbf8d79a7cfe70e21.tar.gz
beta 2011.02.11 18:18
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua42
-rw-r--r--tex/context/base/meta-tex.lua46
-rw-r--r--tex/context/base/meta-tex.mkiv159
-rw-r--r--tex/context/base/mlib-pps.lua6
-rw-r--r--tex/context/base/status-files.pdfbin23209 -> 23209 bytes
-rw-r--r--tex/context/base/strc-ref.mkiv278
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua2
11 files changed, 276 insertions, 265 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 73c197eb3..c0a3c31a9 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.02.11 12:50}
+\newcontextversion{2011.02.11 18:18}
%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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 06ab14dd7..e6fa95485 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.02.11 12:50}
+\newcontextversion{2011.02.11 18:18}
%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/context.mkii b/tex/context/base/context.mkii
index 6e814f1a2..15327a382 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.02.11 12:50}
+\edef\contextversion{2011.02.11 18:18}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 925f05c3a..a6c526ad2 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.02.11 12:50}
+\edef\contextversion{2011.02.11 18:18}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index c5d58484c..5b8417d00 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -701,47 +701,13 @@ end
-- do_alphabetic(n,counters[code] or counters['**'],uppercased)
-- end
--- korean:
---
--- 하 0xD558 => ㅎ 0x314E
--- 파 0xD30C => ㅍ 0x314D
--- 타 0xD0C0 => ㅌ 0x314C
--- 카 0xCE74 => ㅋ 0x314B
--- 차 0xCC28 => ㅊ 0x314A
--- 자 0xC790 => ㅈ 0x3148
--- 아 0xC544 => ㅇ 0x3147
--- 사 0xC0AC => ㅅ 0x3145
--- 바 0xBC14 => ㅂ 0x3142
--- 마 0xB9C8 => ㅁ 0x3141
--- 라 0xB77C => ㄹ 0x3139
--- 다 0xB2E4 => ㄷ 0x3137
--- 나 0xB098 => ㄴ 0x3134
--- 가 0xAC20 => ㄱ 0x3131
-
---~ function converters.koreanconsonants(n)
---~ if n < 0xAC00 then return n -- original
---~ elseif n > 0xD7AF then return n -- original
---~ elseif n >= 0xD558 then return 0x314E -- 하 => ㅎ
---~ elseif n >= 0xD30C then return 0x314D -- 파 => ㅍ
---~ elseif n >= 0xD0C0 then return 0x314C -- 타 => ㅌ
---~ elseif n >= 0xCE74 then return 0x314B -- 카 => ㅋ
---~ elseif n >= 0xCC28 then return 0x314A -- 차 => ㅊ
---~ elseif n >= 0xC790 then return 0x3148 -- 자 => ㅈ
---~ elseif n >= 0xC544 then return 0x3147 -- 아 => ㅇ
---~ elseif n >= 0xC0AC then return 0x3145 -- 사 => ㅅ
---~ elseif n >= 0xBC14 then return 0x3142 -- 바 => ㅂ
---~ elseif n >= 0xB9C8 then return 0x3141 -- 마 => ㅁ
---~ elseif n >= 0xB77C then return 0x3139 -- 라 => ㄹ
---~ elseif n >= 0xB2E4 then return 0x3137 -- 다 => ㄷ
---~ elseif n >= 0xB098 then return 0x3134 -- 나 => ㄴ
---~ elseif n >= 0xAC20 then return 0x3131 -- 가 => ㄱ
---~ else return n -- can't happen
---~ end
---~ end
+-- For the moment here:
languages.firstcharacters = { }
local firstcharacters = languages.firstcharacters
+-- korean:
+
function firstcharacters.korean(chr)
local consonant
if chr < 0xAC00 then consonant = chr -- original
@@ -759,7 +725,7 @@ function firstcharacters.korean(chr)
elseif chr >= 0xB77C then consonant = 0x3139 -- 라 => ㄹ
elseif chr >= 0xB2E4 then consonant = 0x3137 -- 다 => ㄷ
elseif chr >= 0xB098 then consonant = 0x3134 -- 나 => ㄴ
- elseif chr >= 0xAC00 then consonant = 0x3131 -- 가 => ㄱ
+ elseif chr >= 0xAC00 then consonant = 0x3131 -- 가 => ㄱ -- was 0xAC20
else consonant = chr -- can't happen
end
-- print(format("korean: 0x%04X 0x%04X",chr,consonant))
diff --git a/tex/context/base/meta-tex.lua b/tex/context/base/meta-tex.lua
index 63028d28d..3cd70024b 100644
--- a/tex/context/base/meta-tex.lua
+++ b/tex/context/base/meta-tex.lua
@@ -6,25 +6,33 @@ if not modules then modules = { } end modules ['meta-tex'] = {
license = "see context related readme files"
}
-local P, C, lpegmatch = lpeg.P, lpeg.C, lpeg.match
+--~ local P, C, lpegmatch = lpeg.P, lpeg.C, lpeg.match
-local left = P("[")
-local right = P("]")
-local space = P(" ")
-local argument = left * C((1-right)^1) * right
-local pattern = (argument + space)^0
+-- local left = P("[")
+-- local right = P("]")
+-- local space = P(" ")
+-- local argument = left * C((1-right)^1) * right
+-- local pattern = (argument + space)^0
-function metapost.sometxt(optional,str)
- if optional == "" then
- context.sometxta(str)
- else
- local one, two = lpegmatch(pattern,optional)
- if two then
- context.sometxtc(one,two,str)
- elseif one then
- context.sometxtb(one,str)
- else
- context.sometxta(str)
- end
- end
+-- function metapost.sometxt(optional,str)
+-- if optional == "" then
+-- context.sometxta(str)
+-- else
+-- local one, two = lpegmatch(pattern,optional)
+-- if two then
+-- context.sometxtc(one,two,str)
+-- elseif one then
+-- context.sometxtb(one,str)
+-- else
+-- context.sometxta(str)
+-- end
+-- end
+-- end
+
+local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match
+
+local pattern = Cs((P([[\"]]) + P([["]])/"\\quotedbl " + P(1))^0)
+
+function metapost.escaped(str)
+ context(lpegmatch(pattern,str))
end
diff --git a/tex/context/base/meta-tex.mkiv b/tex/context/base/meta-tex.mkiv
index a6c785094..2496440c7 100644
--- a/tex/context/base/meta-tex.mkiv
+++ b/tex/context/base/meta-tex.mkiv
@@ -64,85 +64,82 @@
% \stopMPcode
% a tex one:
-
-\unexpanded\def\definetextext [#1]#2{\setvalue{@@st@@#1}{#2}}
- \def\sometxt #1#{\dosometxt{#1}}
- \def\dosometxt #1#2{textext.drt("\dodosometxt#1{#2}")}
-
-%unexpanded\def\dodosometxt {\doifnextoptionalelse\dododosometxt\relax}
-% \def\dododosometxt [#1]{\dodododosometxt{#1}}
-% \def\dodododosometxt #1{\doifnextoptionalelse{\dododododosometxt{#1}}{\getsometxt{#1}}}
-% \def\dododododosometxt #1[#2]{\switchtobodyfont[#2]\getsometxt{#1}}
-% \def\getsometxt #1#2{\csname @@st@@#1\endcsname{#2}}
-%
-% or:
-
-\unexpanded\def\dodosometxt {\dodoubleempty\dododosometxt}
- \def\dododosometxt {\ifsecondargument
- \expandafter\dododosometxtA
- \else\iffirstargument
- \expandafter\expandafter\expandafter\dododosometxtB
- \else
- \expandafter\expandafter\expandafter\dododosometxtC
- \fi\fi}
- \def\dododosometxtA[#1][#2]#3{\getsometxt{#1}{\switchtobodyfont[#2]#3}}
- \def\dododosometxtB[#1][#2]#3{\getsometxt{#1}{#3}}
- \def\dododosometxtC[#1][#2]#3{#3}
- \def\getsometxt #1#2{\csname @@st@@#1\endcsname{#2}}
-
-
-% a variant ... if m likes it:
-%
-% \unexpanded\def\definetextext[#1]%
-% {\def\currenttextext{#1}%
-% \dosingleempty\dodefinetextext}
-%
-% \def\dodefinetextext
-% {\iffirstargument
-% \expandafter\dodefinetextextone
-% \else
-% \expandafter\dodefinetextextzero
-% \fi}
-%
-% \def\dodefinetextextone {\setvalue{@@st@@one\currenttextext}}
-% \def\dodefinetextextzero[#1]{\setvalue{@@st@@zero\currenttextext}}
-%
-% \def\sometxt#1#%
-% {\dosometxt{#1}}
-%
-% \def\dosometxt#1#2%
-% {textext.drt("\dodosometxt#1{#2}")}
-%
-% \unexpanded\def\dodosometxt
-% {\dosingleempty\dododosometxt}
-%
-% \def\dododosometxt
-% {\iffirstargument
-% \expandafter\dosometxtsome
-% \else
-% \expandafter\dosometxtzero
-% \fi}
-%
-% \def\dosometxtsome[#1]%
-% {\def\currenttextext{#1}%
-% \csname @@st@@%
-% \ifcsname @@st@@one#1\endcsname one\else
-% \ifcsname @@st@@zero#1\endcsname zero\else
-% none\fi\fi
-% \endcsname}
-%
-% \def\dosometxtzero[#1]%
-% {}
-%
-% \def\@@st@@one {\dosingleempty\do@@st@@one}
-% \def\do@@st@@one{\csname @@st@@one\currenttextext\endcsname}
-% \def\@@st@@zero {\csname @@st@@zero\currenttextext\endcsname}
-% \def\@@st@@none {}
-%
-% \protect
-%
-% \definetextext[framed][#1]#2{\framed[width=4cm]{\switchtobodyfont[#1]#2}}
-% \definetextext[simple]{\framed[width=8cm]}
+%
+% \unexpanded\def\definetextext [#1]#2{\setvalue{@@st@@#1}{#2}}
+% \def\sometxt #1#{\dosometxt{#1}}
+% \def\dosometxt #1#2{textext.drt("\dodosometxt#1{#2}")}
+%
+% \unexpanded\def\dodosometxt {\doifnextoptionalelse\dododosometxt\relax}
+% \def\dododosometxt [#1]{\dodododosometxt{#1}}
+% \def\dodododosometxt #1{\doifnextoptionalelse{\dododododosometxt{#1}}{\getsometxt{#1}}}
+% \def\dododododosometxt #1[#2]{\switchtobodyfont[#2]\getsometxt{#1}}
+% \def\getsometxt #1#2{\csname @@st@@#1\endcsname{#2}}
+%
+% or:
+%
+% \unexpanded\def\dodosometxt {\dodoubleempty\dododosometxt}
+% \def\dododosometxt {\ifsecondargument
+% \expandafter\dododosometxtA
+% \else\iffirstargument
+% \expandafter\expandafter\expandafter\dododosometxtB
+% \else
+% \expandafter\expandafter\expandafter\dododosometxtC
+% \fi\fi}
+% \def\dododosometxtA[#1][#2]#3{\getsometxt{#1}{\switchtobodyfont[#2]#3}}
+% \def\dododosometxtB[#1][#2]#3{\getsometxt{#1}{#3}}
+% \def\dododosometxtC[#1][#2]#3{#3}
+% \def\getsometxt #1#2{\csname @@st@@#1\endcsname{#2}}
+%
+% a nicer variant:
+
+\unexpanded\def\definetextext[#1]%
+ {\def\currenttextext{#1}%
+ \dosingleempty\dodefinetextext}
+
+\def\dodefinetextext
+ {\iffirstargument
+ \expandafter\dodefinetextextone
+ \else
+ \expandafter\dodefinetextextzero
+ \fi}
+
+\def\dodefinetextextone {\setvalue{@@st@@one\currenttextext}}
+\def\dodefinetextextzero[#1]{\setvalue{@@st@@zero\currenttextext}}
+
+\def\sometxt#1#%
+ {\dosometxt{#1}}
+
+\def\dosometxt#1#2% we need to capture embedded quotes (a bit messy as later on textext is filtered
+ {textext.drt("\dodosometxt#1{\ctxlua{metapost.escaped(\!!bs#2\!!es)}}")}
+
+\unexpanded\def\dodosometxt
+ {\dosingleempty\dododosometxt}
+
+\def\dododosometxt
+ {\iffirstargument
+ \expandafter\dosometxtsome
+ \else
+ \expandafter\dosometxtzero
+ \fi}
+
+\def\dosometxtsome[#1]%
+ {\def\currenttextext{#1}%
+ \csname @@st@@%
+ \ifcsname @@st@@one#1\endcsname one\else
+ \ifcsname @@st@@zero#1\endcsname zero\else
+ none\fi\fi
+ \endcsname}
+
+\def\dosometxtzero[#1]%
+ {}
+
+\def\@@st@@one {\dosingleempty\do@@st@@one}
+\def\do@@st@@one{\csname @@st@@one\currenttextext\endcsname}
+\def\@@st@@zero {\csname @@st@@zero\currenttextext\endcsname}
+\def\@@st@@none {}
+
+% \definetextext[framed][#1]#2{\framed[width=4cm]{\switchtobodyfont[#1]#2}}
+% \definetextext[simple]{\framed[width=8cm]}
%
% \starttext
%
@@ -150,11 +147,11 @@
% draw \sometxt{This is for} rotated 45 ;
% draw \sometxt [framed] [ss,16pt] {Mojca's};
% draw \sometxt[framed]{eyes only!} rotated -45 ;
-% draw \sometxt[simple]{Indeed!} rotated 180 ;
+% draw \sometxt[simple]{Quotes "indeed" work!} rotated 180 ;
% \stopMPcode
%
% \stoptext
-
+%
% a lua one:
%
% \unexpanded\def\definetextext[#1]#2{\setvalue{@@st@@#1}{#2}}
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index 3eb861342..947c19af4 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -644,7 +644,7 @@ local function force()
forced = true
end
-local texmess = (dquote/ditto + (1 - etex))^0
+local texmess = (dquote/ditto + (1 - etex))^0
local function ignore(s)
report_metapost("ignoring verbatim tex: %s",s)
@@ -661,6 +661,10 @@ end
-- currently a a one-liner produces less code
+-- textext.*(".*") can have "'s but tricky parsing as we can have concatenated strings
+-- so this is something for a boring plain or train trip and we might assume proper mp
+-- input anyway
+
local parser = Cs((
(ttex + gtex)/register
+ (btex * spacing * Cs(texmess) * etex)/convert
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index fb5fa6315..cde9a0dac 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv
index b91940523..22267ef9b 100644
--- a/tex/context/base/strc-ref.mkiv
+++ b/tex/context/base/strc-ref.mkiv
@@ -640,37 +640,55 @@
\newconstant\autocrossfilereferences % not yet supported in mkiv
\newconstant\referencefilecaseswap % not yet supported in mkiv
+\newtoks \everysetupreferencing
+
\unexpanded\def\setupreferencing
{\dosingleargument\dosetupreferencing}
\def\dosetupreferencing[#1]%
- {\getparameters
- [\??rf]
- [\c!prefix=\s!unknown,#1]%
+ {\getparameters[\??rf][\c!prefix=\s!unknown,#1]%
+ \the\everysetupreferencing}
+
+\appendtoks
\processaction
[\@@rfstate]
[ \v!stop=>\referencingfalse,
\v!start=>\referencingtrue]%
- \processaction
- [\@@rfinteraction]
- [ \v!all=>\let\dowantedreference\docompletereference,
- \v!label=>\let\dowantedreference\dolabelonlyreference,
- \v!text=>\let\dowantedreference\dotextonlyreference,
- \v!symbol=>\let\dowantedreference\dosymbolreference]%
+\to \everysetupreferencing
+
+% \newconstant \referencecontentmode
+%
+% \appendtoks
+% \processaction
+% [\@@rfinteraction]
+% [ \v!all=>\referencecontentmode\zerocount,
+% \v!label=>\referencecontentmode\plusone,
+% \v!text=>\referencecontentmode\plustwo,
+% \v!symbol=>\referencecontentmode\plusthree]%
+% \to \everysetupreferencing
+
+\appendtoks
\autocrossfilereferences\zerocount
\processaction
- [\@@rfautofile]
+ [\@@rfautofile] % not yet in mkiv
[ \v!yes=>\autocrossfilereferences\plusone,
\v!page=>\autocrossfilereferences\plustwo]%
- \referencefilecaseswap\zerocount
- \processaction[\@@rfconvertfile]
- [ \v!yes=>\referencefilecaseswap\plusone,
- \v!big=>\referencefilecaseswap\plusone,
- \v!small=>\referencefilecaseswap\plustwo]%
+\to \everysetupreferencing
+
+\appendtoks
+ \referencefilecaseswap\zerocount
+ \processaction[\@@rfconvertfile] % not yet in mkiv
+ [ \v!yes=>\referencefilecaseswap\plusone,
+ \v!big=>\referencefilecaseswap\plusone,
+ \v!small=>\referencefilecaseswap\plustwo]%
+\to \everysetupreferencing
+
+\appendtoks
\setupreferenceprefix[\@@rfprefix]%
\doifelse\@@rfglobal\v!yes
- {\settrue \autoglobalfilereferences}
- {\setfalse\autoglobalfilereferences}}
+ {\settrue \autoglobalfilereferences}%
+ {\setfalse\autoglobalfilereferences}%
+\to \everysetupreferencing
% \appendtoks\ctxlua{structures.references.export("whatever")}\to\everystoptext
% \starttext
@@ -885,95 +903,97 @@
\v!next%
\fi]}}}
-\def\dosymbolreference#1#2[#3]%
- {\removeunwantedspaces
- \goto{\referencesymbol}[#3]}
-
-\def\symbolreference[#1]%
- {\removeunwantedspaces
- \goto{\referencesymbol}[#1]}
-
-
%D The other alternatives just conform their names: only the
%D label, only the text, or the label and the text.
-\def\dounknownreference#1#2[#3]%
- {\dotextprefix{#2}{\leftofreference\dummyreference\rightofreference}}
-
-\def\docompletereference #1#2[#3]{\goto{\dotextprefix{#2}#1}[#3]}
-\def\dolabelonlyreference#1#2[#3]{\goto{\dotextprefix{#2}}[#3]}
-\def\dotextonlyreference #1#2[#3]{\dotextprefix{#2}\goto{#1}[#3]}
-
-\let\dowantedreference\docompletereference
-
-\unexpanded\def\dospecialin{\dontleavehmode\begingroup\doinatreference\currentreferencedefault} % ends in \doinatreference
-\unexpanded\def\dospecialat{\dontleavehmode\begingroup\doinatreference\currentreferencepage } % ends in \doinatreference
-
-\newtoks\leftreferencetoks \newtoks\defaultleftreferencetoks \glet\leftofreference \relax
-\newtoks\rightreferencetoks \newtoks\defaultrightreferencetoks \glet\rightofreference\relax
-
-\def\doinatreference#1%
- {\let\currentreferencecontent#1%
- \futurelet\next\doinatreferenceone}
-
-\def\doinatreferenceone
- {\ifx\next\bgroup
- \afterassignment\doinatreferenceonetwo
- \expandafter\leftreferencetoks
- \else
- \leftreferencetoks\emptytoks
- \expandafter\dodoinatreferencenone
- \fi}
-
-\def\doinatreferenceonetwo
- {\futurelet\next\doinatreferencetwo}
-
-\def\doinatreferencetwo
- {\ifx\next\bgroup
- \afterassignment\dodoinatreferenceboth
- \expandafter\rightreferencetoks
- \else
- \rightreferencetoks\emptytoks
- \expandafter\dodoinatreferenceleft
- \fi}
-
-\def\dodoinatreferencenone
- {\dodoinatreferenceindeed
- {\the\defaultleftreferencetoks\leftofreference\currentreferencecontent\rightofreference}
- {\the\defaultrightreferencetoks}}
-
-\def\dodoinatreferenceleft
- {\dodoinatreferenceindeed
- {\leftofreference\currentreferencecontent\rightofreference}
- {\the\leftreferencetoks}}
-
-\def\dodoinatreferenceboth
- {\doifnothing{\the\leftreferencetoks}
- {\leftreferencetoks\defaultleftreferencetoks}%
- \dodoinatreferenceindeed
- {\leftofreference\currentreferencecontent\the\rightreferencetoks\rightofreference}
- {\the\leftreferencetoks}}
-
-% lefttext left <ref> right righttext
+% \dounknownreference -> \dummyreference
+
+\def\symbolreference[#1]% for old times sake
+ {\goto{\referencesymbol}[#1]}
+
+% \referencecontentmode 0=all 1=label 2=text 3=symbol
+
+\newtoks\leftreferencetoks
+\newtoks\rightreferencetoks
+\newtoks\defaultleftreferencetoks
+\newtoks\defaultrightreferencetoks
+
+\def\leftofreferencecontent {\nobreakspace} % we cannot do \definereferenceformat[at] .. so we need this
+\let\rightofreferencecontent \empty
+\let\leftofreference \empty
+\let\rightofreference \empty
+
+\setvalue{\??rf\c!interaction\v!all}%
+ {\leftofreference
+ \the\leftreferencetoks
+ \leftofreferencecontent
+ \currentreferencecontent
+ \rightofreferencecontent
+ \the\rightreferencetoks
+ \rightofreference}
+
+\setvalue{\??rf\c!interaction\v!label}%
+ {\leftofreference
+ \the\leftreferencetoks
+ \the\rightreferencetoks
+ \rightofreference}
+
+\setvalue{\??rf\c!interaction\v!text}%
+ {\leftofreference
+ \currentreferencecontent
+ \rightofreference}
+
+\setvalue{\??rf\c!interaction\v!symbol}%
+ {\referencesymbol}
+
+\def\referencesequence
+ {\csname \??rf\c!interaction
+ \ifcsname\??rf\c!interaction\@@rfinteraction\endcsname
+ \@@rfinteraction
+ \else
+ \v!all
+ \fi
+ \endcsname}
\newtoks\everyresetinatreference
-\def\dodoinatreferenceindeed#1#2#3[#4]% #3 gobbles space
- {%\dontleavehmode\begingroup % already done
- \postponenotes
- \doifreferencefoundelse{#4}
- {\doifelsenothing{#1}\dosymbolreference\dowantedreference{#1}{#2}[#4]}%
- {\dounknownreference{#1}{#2}[#4]}%
- \the\everyresetinatreference
- \endgroup}
-
-\let\dosymbolreference\dowantedreference
-
\appendtoks
\glet\leftofreference \relax
\glet\rightofreference\relax
\to \everyresetinatreference
+\def\dostartgotoreference
+ {\dontleavehmode
+ \begingroup}
+
+\def\dostopgotoreference
+ {\the\everyresetinatreference
+ \endgroup}
+
+\def\dopickupgotoreference
+ {\dodoublegroupempty\dodopickupgotoreference}
+
+\def\dodopickupgotoreference#1#2#3[#4]% #3 gobbles spaces (really needed)
+ {\leftreferencetoks
+ \iffirstargument
+ {#1}%
+ \else
+ \defaultleftreferencetoks
+ \let\leftofreferencecontent\empty
+ \fi
+ \rightreferencetoks
+ \ifsecondargument
+ {#2}%
+ \else
+ \defaultrightreferencetoks
+ \let\rightofreferencecontent\empty
+ \fi
+ \goto{\referencesequence}[#4]%
+ \dostopgotoreference}
+
+\unexpanded\def\dospecialin{\dostartgotoreference\let\currentreferencecontent\currentreferencedefault\dopickupgotoreference}
+\unexpanded\def\dospecialat{\dostartgotoreference\let\currentreferencecontent\currentreferencepage \dopickupgotoreference}
+
%D \macros
%D {definereferenceformat}
%D
@@ -1034,8 +1054,8 @@
\setuvalue{#1}{\doexecutereferenceformat{#1}}%
\fi}
-\def\doexecutereferenceformat#1%
- {\dontleavehmode\begingroup % ends in \doinatreference
+\def\doexecutereferenceformat#1% quite slow due to all assignments but we will speed it up
+ {\dostartgotoreference
\edef\currentreferenceformat{#1}%
\gdef\leftofreference {\referenceformatparameter\c!left }%
\gdef\rightofreference{\referenceformatparameter\c!right}%
@@ -1049,12 +1069,28 @@
\let\@@iacontrastcolor\empty
\let\@@iacolor \empty}%
%
- \doifsomethingelse{\referenceformatparameter\c!label}
- {\defaultleftreferencetoks {\leftlabeltext {\referenceformatparameter\c!label}}%
- \defaultrightreferencetoks{\rightlabeltext{\referenceformatparameter\c!label}}}%
- {\defaultleftreferencetoks {\referenceformatparameter\c!text}%
- \defaultrightreferencetoks\emptytoks}%
- \doinatreference\currentreferencedefault} % we can make \currentreferencedefault configurable
+ \edef\currentreferenceformatlabel{\referenceformatparameter\c!label}%
+ \ifx\currentreferenceformatlabel\autoreferencelabeltextflag
+ \edef\currentreferenceformatlabel{\autoreferencelabeltext}%
+ \fi
+ \ifx\currentreferenceformatlabel\empty
+ \defaultleftreferencetoks {\referenceformatparameter\c!text}%
+ \defaultrightreferencetoks\emptytoks
+ \else
+ \defaultleftreferencetoks {\leftlabeltext \currentreferenceformatlabel}%
+ \defaultrightreferencetoks{\rightlabeltext\currentreferenceformatlabel}%
+ \fi
+ \doifelse{\referenceformatparameter\c!type}\v!page
+ {\let\currentreferencecontent\currentreferencepage}
+ {\let\currentreferencecontent\currentreferencedefault}%
+ \let\leftofreferencecontent \empty
+ \let\rightofreferencecontent\empty
+ \dopickupgotoreference}
+
+\def\autoreferencelabeltextflag{*} % a proper key like 'auto' or 'name' can clash with a label key
+
+\unexpanded\def\autoreferencelabeltext
+ {\ctxlua{structures.references.getcurrentmetadata("name")}}
% \starttext
% \definereferenceformat[inxx] [left=(,right=),text=txt]
@@ -1111,13 +1147,13 @@
{\dontleavehmode
\begingroup
\attribute\referenceattribute\attributeunsetvalue
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\iflocation
\dostarttagged\t!link\empty % not here
\ctxlua{structures.references.inject("\referenceprefix","#2",\number\ht\strutbox,\number\dp\strutbox,\extrareferencearguments)}%
\setlocationattributes\??ia
\setstrut % can be option
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\attribute\referenceattribute\lastreferenceattribute
#1%
\dostoptagged
@@ -1129,7 +1165,7 @@
\def\dodirectgotohtdp#1[#2]% no test for valid references
{\dontleavehmode
\begingroup
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\attribute\referenceattribute\attributeunsetvalue
\iflocation
\dostarttagged\t!link\empty
@@ -1137,7 +1173,7 @@
\dostoptagged
\setlocationattributes\??ia
\attribute\referenceattribute\lastreferenceattribute
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\fi
#1%
\endgroup}
@@ -1146,7 +1182,7 @@
{\dontleavehmode
\begingroup
%\setbox\referencebox\hbox\bgroup % experiment, might change again to non \par support
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\attribute\referenceattribute\attributeunsetvalue
\iflocation
\ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}%
@@ -1156,7 +1192,7 @@
\dostoptagged
\setlocationattributes\??ia
\setstrut % can be option
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\attribute\referenceattribute\lastreferenceattribute}%
{}%
\fi
@@ -1167,7 +1203,7 @@
\def\dogotohtdp#1#2[#3]% #2 gobbles spaces after #1 so that \goto{xx} [yy] works ok
{\dontleavehmode
\begingroup
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\attribute\referenceattribute\attributeunsetvalue
\iflocation
\ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}%
@@ -1176,7 +1212,7 @@
\ctxlua{structures.references.injectcurrentset(\number\dimexpr\@@iaheight\relax,\number\dimexpr\@@iadepth\relax)}%
\dostoptagged
\setlocationattributes\??ia
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\attribute\referenceattribute\lastreferenceattribute}%
{}%
\fi
@@ -1186,14 +1222,14 @@
\unexpanded\def\directgotobox#1[#2]% no test for valid references
{\dontleavehmode
\begingroup
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\attribute\referenceattribute\attributeunsetvalue
\iflocation
\dostarttagged\t!link\empty
\ctxlua{structures.references.inject("\referenceprefix","#2",nil,nil,\extrareferencearguments)}%
\dostoptagged
\setlocationattributes\??ia
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\hbox attr \referenceattribute \lastreferenceattribute {#1}%
\else
#1%
@@ -1203,14 +1239,14 @@
\unexpanded\def\directgotospecbox#1#2[#3]% no test for valid references
{\dontleavehmode
\begingroup
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\attribute\referenceattribute\attributeunsetvalue
\iflocation
\dostarttagged\t!link\empty
\ctxlua{structures.references.inject("\referenceprefix","#3",nil,nil,\extrareferencearguments)}%
\dostoptagged
\setlocationcolorspec{#1}% no consequence for strut
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\hbox attr \referenceattribute \lastreferenceattribute {#2}%
\else
#2%
@@ -1220,13 +1256,13 @@
\unexpanded\def\directgotodumbbox#1[#2]% no test for valid references
{\dontleavehmode
\begingroup
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\attribute\referenceattribute\attributeunsetvalue
\iflocation
\dostarttagged\t!link\empty
\ctxlua{structures.references.inject("\referenceprefix","#2",nil,nil,\extrareferencearguments)}%
\dostoptagged
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\hbox attr \referenceattribute \lastreferenceattribute {#1}%
\else
#1%
@@ -1236,7 +1272,7 @@
\unexpanded\def\gotobox#1[#2]% no test for valid references
{\dontleavehmode
\begingroup
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\attribute\referenceattribute\attributeunsetvalue
\iflocation
\ctxlua{structures.references.doifelse("\referenceprefix","#2",\extrareferencearguments)}%
@@ -1245,7 +1281,7 @@
\ctxlua{structures.references.injectcurrentset(nil,nil)}%
\dostoptagged
\setlocationattributes\??ia
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\hbox attr \referenceattribute \lastreferenceattribute {#1}}%
{}%
\else
@@ -1256,12 +1292,12 @@
\unexpanded\def\gotowdhtbox#1#2[#3]% fast variant for overlays
{\dontleavehmode
\begingroup
-\global\lastsavedreferenceattribute\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
\attribute\referenceattribute\attributeunsetvalue
\ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}%
{\ctxlua{structures.references.injectcurrentset(nil,nil)}%
\setbox\scratchbox\emptyhbox\wd\scratchbox#1\ht\scratchbox#2%
-\global\lastsavedreferenceattribute\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
\hbox attr \referenceattribute \lastreferenceattribute {\box\scratchbox}}%
{}%
\endgroup}
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 53709dcca..ebd305744 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 02/11/11 12:50:43
+-- merge date : 02/11/11 18:18:29
do -- begin closure to overcome local limits and interference