From 3953a443f750b4cd90f0b0a906c98ca5642be22a Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 6 Sep 2011 19:00:27 +0300 Subject: beta 2011.09.06 17:46 --- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4086 -> 4092 bytes tex/context/base/context-version.png | Bin 104502 -> 105777 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/lpdf-ano.lua | 1 - tex/context/base/mult-aux.mkiv | 21 ++++--- tex/context/base/scrn-but.mkvi | 3 +- tex/context/base/scrn-ini.mkvi | 29 +++++----- tex/context/base/status-files.pdf | Bin 23932 -> 23953 bytes tex/context/base/status-lua.pdf | Bin 162268 -> 162273 bytes tex/context/base/strc-lst.mkiv | 2 +- tex/context/base/strc-ref.lua | 39 +++++++------ tex/context/base/strc-ref.mkiv | 61 +++++---------------- tex/context/base/strc-reg.mkiv | 2 +- tex/context/base/typo-krn.lua | 5 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 18 files changed, 77 insertions(+), 96 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 0eff1e671..786a54b79 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.09.06 14:02} +\newcontextversion{2011.09.06 17:46} %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 907415df8..f3fa1ebf3 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.09.06 14:02} +\newcontextversion{2011.09.06 17:46} %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-version.pdf b/tex/context/base/context-version.pdf index fe96d9b72..a6f5b3ea2 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index f9dc15ab5..796c6a21a 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index c38fbc41c..0c5b11a71 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.09.06 14:02} +\edef\contextversion{2011.09.06 17:46} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index e6501b852..dc50a9492 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.09.06 14:02} +\edef\contextversion{2011.09.06 17:46} %D For those who want to use this: diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index 3660d5a65..9dfe42039 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -180,7 +180,6 @@ end local function pdfaction(actions) local nofactions = #actions - texcount.referencepagestate = 0 -- goodie, as we do all in the backend, we need to set it here too if nofactions > 0 then local a = actions[1] local action = runners[a.kind] diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index c5ae2a407..52dbf8966 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -120,19 +120,26 @@ \expandafter\noexpand\csname let#2parameter\endcsname \expandafter\noexpand\csname reset#2parameter\endcsname}} -\unexpanded\def\doinstallattributehandler#1#2#3% #1 not used here - {\def#2##1##2% style color - {\edef\fontattributehash {#3{##1}}% this name is public - \edef\colorattributehash{#3{##2}}% this name is public +\unexpanded\def\doinstallattributehandler#1#2#3#4% + {\unexpanded\def#2##1##2% style color + {\edef\fontattributehash {#1{##1}}% this name is public + \edef\colorattributehash{#1{##2}}% this name is public \ifx\fontattributehash \empty\else\dosetfontattribute \fontattributehash {##1}\fi - \ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash{##2}\fi}} + \ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash{##2}\fi}% + \unexpanded\def#3##1% style + {\edef\fontattributehash {#1{##1}}% this name is public + \ifx\fontattributehash \empty\else\dosetfontattribute \fontattributehash {##1}\fi}% + \unexpanded\def#4##1% color + {\edef\colorattributehash{#1{##1}}% this name is public + \ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash{##1}\fi}} \unexpanded\def\installattributehandler#1#2% {\normalexpanded {\doinstallattributehandler - {\noexpand#1}% \??aa + \expandafter\noexpand\csname #2parameterhash\endcsname \expandafter\noexpand\csname doset#2attributes\endcsname - \expandafter\noexpand\csname #2parameterhash\endcsname}} + \expandafter\noexpand\csname doset#2fontattribute\endcsname + \expandafter\noexpand\csname doset#2colorattribute\endcsname}} \let\definehandlerparent\empty diff --git a/tex/context/base/scrn-but.mkvi b/tex/context/base/scrn-but.mkvi index 7ee9f5473..fee8e757c 100644 --- a/tex/context/base/scrn-but.mkvi +++ b/tex/context/base/scrn-but.mkvi @@ -166,8 +166,7 @@ \endgroup} \def\scrn_button_make_yes - {\analyzecurrentreference % needed as we act on the state - \ifcase\referencepagestate + {\ifcase\referencepagestate\relax \expandafter\scrn_button_make_normal % no state : something else than a page reference \or \ifcase\locationboxpagestate\relax diff --git a/tex/context/base/scrn-ini.mkvi b/tex/context/base/scrn-ini.mkvi index 5715f69c3..e7684f02d 100644 --- a/tex/context/base/scrn-ini.mkvi +++ b/tex/context/base/scrn-ini.mkvi @@ -27,7 +27,7 @@ %D %D \showsetup{setupinteraction} -\installcommandhandler\??ia{interaction}\??ia +\installcommandhandler\??ia {interaction} \??ia \let\currentinteraction\empty @@ -107,33 +107,32 @@ %D When we're dealing with pure page references, contrast %D colors are used when we are already at the page mentioned. -\def\setlocationcolor#1% not grouped ! +\def\setlocationcolor % not grouped ! {\ifnum\referencepagestate=\plusone - \edef\askedcontrastcolor{\csname#1\c!contrastcolor\endcsname}% + \edef\askedcontrastcolor{\interactionparameter\c!contrastcolor}% \ifx\askedcontrastcolor\empty - \dosetcolorattribute{#1}\c!color + \dosetinteractioncolorattribute\c!color \else - \dosetcolorattribute{#1}\c!contrastcolor + \dosetinteractioncolorattribute\c!contrastcolor \fi \else % we could just set and if > 0 set again - \dosetcolorattribute{#1}\c!color + \dosetinteractioncolorattribute\c!color \fi} -\def\setlocationfont#1% - {\dosetfontattribute{#1}\c!style} +\def\setlocationfont % not grouped ! + {\dosetinteractionfontattribute\c!style} -\def\setlocationattributes#1% +\def\setlocationattributes % not grouped ! {\ifnum\referencepagestate=\plusone - \edef\askedcontrastcolor{\csname#1\c!contrastcolor\endcsname}% + \edef\askedcontrastcolor{\interactionparameter\c!contrastcolor}% \ifx\askedcontrastcolor\empty - \dosetcolorattribute{#1}\c!color + \dosetinteractionattributes\c!style\c!color \else - \dosetcolorattribute{#1}\c!contrastcolor + \dosetinteractionattributes\c!style\c!contrastcolor \fi \else % we could just set and if > 0 set again - \dosetcolorattribute{#1}\c!color - \fi - \dosetfontattribute{#1}\c!style} + \dosetinteractionattributes\c!style\c!color + \fi} \def\setlocationcolorspec#1% \resolver {\ifnum\referencepagestate=\plusone diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index aaaede636..7638971e5 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index fa9d18a12..4af2b8652 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv index 09bdd79bf..ec09b3b2d 100644 --- a/tex/context/base/strc-lst.mkiv +++ b/tex/context/base/strc-lst.mkiv @@ -614,7 +614,7 @@ \doif{\namedheadparameter\currentlist\c!interaction}\v!list {\dosetsimplepagereference{bck:#2}% \attribute\destinationattribute\currentdestinationattribute}% - \directgoto{\setlocationcolor\??ia#4}[internal(#2)]% we can get the attribute instead so then we don't need a goto + \directgoto{\setlocationcolor#4}[internal(#2)]% we can get the attribute instead so then we don't need a goto \endgroup}% was \directgotobox {#3{#4}}% \else diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index d3c3f7ff7..cc7e4799d 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -945,8 +945,8 @@ local n = 0 local function identify(prefix,reference) local set = resolve(prefix,reference) local bug = false -n = n + 1 -set.n = n + n = n + 1 + set.n = n for i=1,#set do local var = set[i] local special, inner, outer, arguments, operation = var.special, var.inner, var.outer, var.arguments, var.operation @@ -1199,6 +1199,7 @@ set.n = n bug = bug or var.error set[i] = var end +--~ references.analyze(set) references.currentset = mark(set) -- mark, else in api doc if trace_analyzing then report_references(table.serialize(set,reference)) @@ -1328,7 +1329,8 @@ function references.filter(name,...) -- number page title ... local data = currentreference and currentreference.i -- maybe we should take realpage from here if data then if name == "realpage" then - references.realpage() -- special case, does an analysis (maybe we have more) + local cs = references.analyze() -- normally already analyzed but also sets state + context(cs.realpage or 0) -- todo, return and in command namespace else local kind = data.metadata and data.metadata.kind if kind then @@ -1499,14 +1501,14 @@ local function checkedpagestate(n,page) end end -local function analyze(actions) +function references.analyze(actions) actions = actions or references.currentset if not actions then - actions = { realpage = 0 } - texcount.referencepagestate = 0 + actions = { realpage = 0, pagestate = 0 } + elseif actions.pagestate then + -- already done elseif actions.realpage then - -- already analyzed - texcount.referencepagestate = checkedpagestate(actions.n,actions.realpage) + actions.pagestate = checkedpagestate(actions.n,actions.realpage) else -- we store some analysis data alongside the indexed array -- at this moment only the real reference page is analyzed @@ -1517,22 +1519,27 @@ local function analyze(actions) local a = actions[i] local what = runners[a.kind] if what then - what = what(a,actions) + what = what(a,actions) -- needs documentation end end - texcount.referencepagestate = checkedpagestate(actions.n,actions.realpage) + actions.pagestate = checkedpagestate(actions.n,actions.realpage) else - texcount.referencepagestate = 0 + actions.pagestate = 0 end end return actions end -references.analyze = analyze - -function references.realpage() -- special case, we always want result (also does test ... still needed?) - local cs = analyze() - context(cs.realpage or 0) +function commands.referencepagestate(actions) + actions = actions or references.currentset + if not actions then + context(0) + else + if not actions.pagestate then + references.analyze(actions) -- delayed unless explicitly asked for + end + context(actions.pagestate) + end end local plist diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv index 5800f677f..5c97fba5d 100644 --- a/tex/context/base/strc-ref.mkiv +++ b/tex/context/base/strc-ref.mkiv @@ -290,28 +290,14 @@ \let\currentsubtextreference \empty \let\currentsubsubtextreference\empty -\newcount\referencepagestate % set in backend \newcount\referencehastexstate % set in backend +\def\referencepagestate{\ctxcommand{referencepagestate()}} + % referencepagestate: % % 0 = no page ref, 1=same page, 2=before, 3=after -%D Text references can contain more than one entry and -%D therefore we check for -%D -%D \starttyping -%D {entry} -%D \stoptyping -%D -%D or -%D -%D \starttyping -%D {{entry}{entry}{entry}} -%D \stoptyping -%D -%D and split accordingly. - %D Cross references appear as numbers (figure~1.1, chapter~2) %D or pagenumbers (page~2, page 3--2), and are called with %D \type{\in} and \type{\at}. In interactive documents we also @@ -332,28 +318,9 @@ %D are references to a file or \URL. The brace delimited %D references for instance refer to a \JAVASCRIPT. The last %D example shows that we can pass arguments to the actions. -%D -%D When we split off the components of such a reference, the -%D results are available in: -%D -%D \starttyping -%D \currentreferencespecial -%D \currentreferenceoperation -%D \currentreferencearguments -%D \currentinnerreference -%D \currentouterreference -%D \currentfullreference -%D \stoptyping \newif\ifreferencefound -% \let\currentfullreference \empty -% \let\currentreferencespecial \empty -% \let\currentreferenceoperation\empty -% \let\currentreferencearguments\empty -% \let\currentouterreference \empty -% \let\currentinnerreference \empty - %D Now we've come to the testing step. As we can see below, %D this macro does bit more than testing: it also resolves %D the reference. This means that whenever we test for the @@ -469,8 +436,8 @@ %D one wants to use the pagestate the next macro seldom needs to %D be called. -\def\analyzecurrentreference - {\ctxlua{structures.references.analyze()}} +% \def\analyzecurrentreference +% {\ctxlua{structures.references.analyze()}} %D The inner case is simple. Only two cases have to be taken %D care of: @@ -876,12 +843,12 @@ \unexpanded\def\somewhere#1#2#3[#4]% #3 gobbles space around #2 % todo {\doifreferencefoundelse{#4}% kind of inefficient as \goto also analyzes - {\goto{\analyzecurrentreference\ifcase\referencepagestate\relax#1/#2\or#2\or#1\or#2\fi}[#4]} + {\goto{\ifcase\referencepagestate\relax#1/#2\or#2\or#1\or#2\fi}[#4]} {[#1/#2]}} \unexpanded\def\atpage[#1]% todo {\doifreferencefoundelse{#1}% kind of inefficient as \goto also analyzes - {\goto{\analyzecurrentreference\ifcase\referencepagestate + {\goto{\ifcase\referencepagestate\relax \labeltexts\v!page\dummyreference \or \labeltexts\v!atpage\currentreferencepage @@ -900,7 +867,7 @@ {\hbox{\strut\high {\setupsymbolset[\interactionparameter\c!symbolset]% \symbol - [\ifcase\referencepagestate + [\ifcase\referencepagestate\relax \v!somewhere \or % same \v!nowhere @@ -1186,7 +1153,7 @@ \global\lastsavedreferenceattribute\attributeunsetvalue \iflocation \ctxlua{structures.references.inject("\referenceprefix","#2",\number\ht\strutbox,\number\dp\strutbox,\extrareferencearguments)}% - \setlocationattributes\??ia + \setlocationattributes \setstrut % can be option \global\lastsavedreferenceattribute\lastreferenceattribute \attribute\referenceattribute\lastreferenceattribute @@ -1205,7 +1172,7 @@ \attribute\referenceattribute\attributeunsetvalue \iflocation \ctxlua{structures.references.inject("\referenceprefix","#2",\number\dimexpr\interactionparameter\c!height\relax,\number\dimexpr\interactionparameter\c!depth\relax,\extrareferencearguments)}% - \setlocationattributes\??ia + \setlocationattributes \attribute\referenceattribute\lastreferenceattribute \global\lastsavedreferenceattribute\lastreferenceattribute \dostarttagged\t!link\empty @@ -1226,7 +1193,7 @@ \ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}% {\expandtexincurrentreference \ctxlua{structures.references.injectcurrentset(\number\ht\strutbox,\number\dp\strutbox)}% - \setlocationattributes\??ia + \setlocationattributes \setstrut % can be option \global\lastsavedreferenceattribute\lastreferenceattribute \attribute\referenceattribute\lastreferenceattribute @@ -1249,7 +1216,7 @@ \ctxlua{structures.references.doifelse("\referenceprefix","#3",\extrareferencearguments)}% {\expandtexincurrentreference \ctxlua{structures.references.injectcurrentset(\number\dimexpr\interactionparameter\c!height\relax,\number\dimexpr\interactionparameter\c!depth\relax)}% - \setlocationattributes\??ia + \setlocationattributes \global\lastsavedreferenceattribute\lastreferenceattribute \attribute\referenceattribute\lastreferenceattribute \dostarttagged\t!link\empty @@ -1268,7 +1235,7 @@ \attribute\referenceattribute\attributeunsetvalue \iflocation \ctxlua{structures.references.inject("\referenceprefix","#2",nil,nil,\extrareferencearguments)}% - \setlocationattributes\??ia + \setlocationattributes \global\lastsavedreferenceattribute\lastreferenceattribute \dostarttagged\t!link\empty \hbox attr \referenceattribute \lastreferenceattribute {#1}% @@ -1285,7 +1252,7 @@ \attribute\referenceattribute\attributeunsetvalue \iflocation \ctxlua{structures.references.inject("\referenceprefix","#3",nil,nil,\extrareferencearguments)}% - \setlocationcolorspec{#1}% no consequence for strut + \setlocationcolorspec{#1}% #1=\resolver; no consequence for strut \global\lastsavedreferenceattribute\lastreferenceattribute \dostarttagged\t!link\empty \hbox attr \referenceattribute \lastreferenceattribute {#2}% @@ -1320,7 +1287,7 @@ \ctxlua{structures.references.doifelse("\referenceprefix","#2",\extrareferencearguments)}% {\expandtexincurrentreference \ctxlua{structures.references.injectcurrentset(nil,nil)}% - \setlocationattributes\??ia + \setlocationattributes \global\lastsavedreferenceattribute\lastreferenceattribute \dostarttagged\t!link\empty \hbox attr \referenceattribute \lastreferenceattribute {#1}% diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index 0e391a0d7..0467eac96 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -743,7 +743,7 @@ \iflocation \def\currentregisterseeindex{#3}% \doifelse{\registerparameter\c!interaction}\v!text - {\directgoto{\setlocationcolor\??ia\doapplyregisterentrycommand{#1}{#4}}[internal(#2)]} + {\directgoto{\setlocationcolor\doapplyregisterentrycommand{#1}{#4}}[internal(#2)]} {\doapplyregisterentrycommand{#1}{#4}}% \else \let\currentregisterseeindex\empty diff --git a/tex/context/base/typo-krn.lua b/tex/context/base/typo-krn.lua index 7d8f65a38..3b1a8b413 100644 --- a/tex/context/base/typo-krn.lua +++ b/tex/context/base/typo-krn.lua @@ -45,6 +45,8 @@ local vlist_code = nodecodes.vlist local kerning_code = kerncodes.kerning local userkern_code = kerncodes.userkern local userskip_code = skipcodes.userskip +local spaceskip_code = skipcodes.spaceskip +local xspaceskip_code = skipcodes.xspaceskip local fonthashes = fonts.hashes local fontdata = fonthashes.identifiers @@ -220,7 +222,8 @@ local function do_process(namespace,attribute,head,force) -- todo: glue so that end end elseif id == glue_code then - if start.subtype == userskip_code then + local subtype = start.subtype + if subtype == userskip_code or subtype == xspaceskip_code or subtype == spaceskip_code then local s = start.spec local w = s.width if w > 0 then diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b5fc340a2..b33e232ea 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/06/11 14:02:36 +-- merge date : 09/06/11 17:46:31 do -- begin closure to overcome local limits and interference -- cgit v1.2.3