From 22239196756b1e1afff74003befd86150ab8013b Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 21 Oct 2010 22:00:11 +0300 Subject: beta 2010.10.21 19:55 --- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/lang-ger.tex | 3 + tex/context/base/mult-cld.lua | 32 ++--- tex/context/base/mult-de.tex | 1 + tex/context/base/mult-def.lua | 10 ++ tex/context/base/mult-en.tex | 1 + tex/context/base/mult-fr.tex | 1 + tex/context/base/mult-it.tex | 1 + tex/context/base/mult-nl.tex | 1 + tex/context/base/mult-pe.tex | 1 + tex/context/base/mult-ro.tex | 1 + tex/context/base/strc-reg.lua | 182 +++++++++++++++++++--------- tex/context/base/strc-reg.mkiv | 49 ++++---- tex/context/interface/keys-cs.xml | 1 + tex/context/interface/keys-de.xml | 1 + tex/context/interface/keys-en.xml | 1 + tex/context/interface/keys-fr.xml | 1 + tex/context/interface/keys-it.xml | 1 + tex/context/interface/keys-nl.xml | 1 + tex/context/interface/keys-pe.xml | 1 + tex/context/interface/keys-ro.xml | 1 + tex/generic/context/luatex-fonts-merged.lua | 2 +- 23 files changed, 196 insertions(+), 101 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index dee54ad50..90105af26 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.10.21 14:02} +\newcontextversion{2010.10.21 19:55} %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.tex b/tex/context/base/context.tex index 32ee54b45..876ec1152 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.10.21 14:02} +\edef\contextversion{2010.10.21 19:55} %D For those who want to use this: diff --git a/tex/context/base/lang-ger.tex b/tex/context/base/lang-ger.tex index a3cf45e20..cfab5e2bc 100644 --- a/tex/context/base/lang-ger.tex +++ b/tex/context/base/lang-ger.tex @@ -619,18 +619,21 @@ \setuplabeltext [\s!nl] [\v!hencefore=hierboven] \setuplabeltext [\s!nl] [\v!hereafter=hieronder] \setuplabeltext [\s!nl] [\v!see=zie ] +\setuplabeltext [\s!nl] [\v!and= en ] \setuplabeltext [\s!en] [\v!page=page ] \setuplabeltext [\s!en] [\v!atpage=at page ] \setuplabeltext [\s!en] [\v!hencefore=as we show above] \setuplabeltext [\s!en] [\v!hereafter=as we show below] \setuplabeltext [\s!en] [\v!see=see ] +\setuplabeltext [\s!en] [\v!and= and ] \setuplabeltext [\s!de] [\v!page=Seite ] \setuplabeltext [\s!de] [\v!atpage=auf Seite ] \setuplabeltext [\s!de] [\v!hencefore=siehe oben] \setuplabeltext [\s!de] [\v!hereafter=siehe unten] \setuplabeltext [\s!de] [\v!see=siehe ] +\setuplabeltext [\s!de] [\v!and= und ] \setuplabeltext [\s!da] [\v!page=Side ] \setuplabeltext [\s!da] [\v!atpage=p\aring\ side ] diff --git a/tex/context/base/mult-cld.lua b/tex/context/base/mult-cld.lua index 373300d69..f4c501423 100644 --- a/tex/context/base/mult-cld.lua +++ b/tex/context/base/mult-cld.lua @@ -28,25 +28,26 @@ local insert, remove = table.insert, table.remove local tex = tex -local texsprint = tex.sprint -local textprint = tex.tprint -local texprint = tex.print -local texiowrite = texio.write -local texcount = tex.count +local texsprint = tex.sprint +local textprint = tex.tprint +local texprint = tex.print +local texiowrite = texio.write +local texcount = tex.count -local isnode = node.is_node -local writenode = node.write +local isnode = node.is_node +local writenode = node.write -local ctxcatcodes = tex.ctxcatcodes -local prtcatcodes = tex.prtcatcodes -local texcatcodes = tex.texcatcodes -local txtcatcodes = tex.txtcatcodes -local vrbcatcodes = tex.vrbcatcodes -local xmlcatcodes = tex.xmlcatcodes +local ctxcatcodes = tex.ctxcatcodes +local prtcatcodes = tex.prtcatcodes +local texcatcodes = tex.texcatcodes +local txtcatcodes = tex.txtcatcodes +local vrbcatcodes = tex.vrbcatcodes +local xmlcatcodes = tex.xmlcatcodes -local flush = texsprint +local flush = texsprint -local report_cld = logs.new("cld") +local trace_context = logs.new("context") -- here +local report_cld = logs.new("cld") local _stack_, _n_ = { }, 0 @@ -251,7 +252,6 @@ setmetatable(context, { __index = indexer, __call = caller } ) -- logging -local trace_context = logs.new("context") -- here local trace_stack = { } local normalflush = flush diff --git a/tex/context/base/mult-de.tex b/tex/context/base/mult-de.tex index 0f47cc406..fa3ed479b 100644 --- a/tex/context/base/mult-de.tex +++ b/tex/context/base/mult-de.tex @@ -68,6 +68,7 @@ \setinterfacevariable{after}{nach} \setinterfacevariable{all}{alles} \setinterfacevariable{always}{immer} +\setinterfacevariable{and}{und} \setinterfacevariable{answerarea}{answerarea} \setinterfacevariable{appendices}{anhaenge} \setinterfacevariable{appendix}{anhang} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 436e22f51..6fced681d 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -11941,6 +11941,16 @@ return { ["pe"]="همواره", ["ro"]="totdeauna", }, + ["and"]={ + --["cs"]="", + ["de"]="und", + ["en"]="and", + --["fr"]="", + --["it"]="", + ["nl"]="en", + --["pe"]="", + --["ro"]="", + }, ["answerarea"]={ ["cs"]="answerarea", ["de"]="answerarea", diff --git a/tex/context/base/mult-en.tex b/tex/context/base/mult-en.tex index ea48f0c16..c6765ce3f 100644 --- a/tex/context/base/mult-en.tex +++ b/tex/context/base/mult-en.tex @@ -68,6 +68,7 @@ \setinterfacevariable{after}{after} \setinterfacevariable{all}{all} \setinterfacevariable{always}{always} +\setinterfacevariable{and}{and} \setinterfacevariable{answerarea}{answerarea} \setinterfacevariable{appendices}{appendices} \setinterfacevariable{appendix}{appendix} diff --git a/tex/context/base/mult-fr.tex b/tex/context/base/mult-fr.tex index 14cad19c3..84974bb43 100644 --- a/tex/context/base/mult-fr.tex +++ b/tex/context/base/mult-fr.tex @@ -68,6 +68,7 @@ \setinterfacevariable{after}{apres} \setinterfacevariable{all}{tout} \setinterfacevariable{always}{toujours} +\setinterfacevariable{and}{and} \setinterfacevariable{answerarea}{answerarea} \setinterfacevariable{appendices}{annexes} \setinterfacevariable{appendix}{annexe} diff --git a/tex/context/base/mult-it.tex b/tex/context/base/mult-it.tex index 5dc791b24..bae816c40 100644 --- a/tex/context/base/mult-it.tex +++ b/tex/context/base/mult-it.tex @@ -68,6 +68,7 @@ \setinterfacevariable{after}{dopo} \setinterfacevariable{all}{tutti} \setinterfacevariable{always}{sempre} +\setinterfacevariable{and}{and} \setinterfacevariable{answerarea}{answerarea} \setinterfacevariable{appendices}{appendici} \setinterfacevariable{appendix}{appendice} diff --git a/tex/context/base/mult-nl.tex b/tex/context/base/mult-nl.tex index 9e1a4aa5f..d0acd81eb 100644 --- a/tex/context/base/mult-nl.tex +++ b/tex/context/base/mult-nl.tex @@ -68,6 +68,7 @@ \setinterfacevariable{after}{na} \setinterfacevariable{all}{alles} \setinterfacevariable{always}{altijd} +\setinterfacevariable{and}{en} \setinterfacevariable{answerarea}{antwoordgebied} \setinterfacevariable{appendices}{bijlagen} \setinterfacevariable{appendix}{bijlage} diff --git a/tex/context/base/mult-pe.tex b/tex/context/base/mult-pe.tex index 703a7193c..7ea06050c 100644 --- a/tex/context/base/mult-pe.tex +++ b/tex/context/base/mult-pe.tex @@ -68,6 +68,7 @@ \setinterfacevariable{after}{بعداز} \setinterfacevariable{all}{همه} \setinterfacevariable{always}{همواره} +\setinterfacevariable{and}{and} \setinterfacevariable{answerarea}{answerarea} \setinterfacevariable{appendices}{پیوستها} \setinterfacevariable{appendix}{پیوست} diff --git a/tex/context/base/mult-ro.tex b/tex/context/base/mult-ro.tex index 137e09408..8c852215f 100644 --- a/tex/context/base/mult-ro.tex +++ b/tex/context/base/mult-ro.tex @@ -68,6 +68,7 @@ \setinterfacevariable{after}{dupa} \setinterfacevariable{all}{tot} \setinterfacevariable{always}{totdeauna} +\setinterfacevariable{and}{and} \setinterfacevariable{answerarea}{answerarea} \setinterfacevariable{appendices}{apendixuri} \setinterfacevariable{appendix}{apendix} diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua index 1ea285a90..8ab611677 100644 --- a/tex/context/base/strc-reg.lua +++ b/tex/context/base/strc-reg.lua @@ -258,8 +258,6 @@ local function preprocessentries(rawdata) rawdata.processors = { entryproc, pageproc } end rawdata.entries = nil - else - rawdata.list = { { "", "" } } -- br end end @@ -324,16 +322,22 @@ function registers.compare(a,b) local result = compare(a,b) if result ~= 0 then return result - elseif a.metadata.kind == 'entry' then -- e/f/t - local page_a, page_b = a.references.realpage, b.references.realpage - if not page_a or not page_b then - return 0 - elseif page_a < page_b then + else + local ka, kb = a.metadata.kind, b.metadata.kind + if ka == kb then + local page_a, page_b = a.references.realpage, b.references.realpage + if not page_a or not page_b then + return 0 + elseif page_a < page_b then + return -1 + elseif page_a > page_b then + return 1 + end + elseif ka == "see" then + return 1 + elseif kb == "see" then return -1 - elseif page_a > page_b then - return 1 end - else -- see end return 0 end @@ -342,6 +346,75 @@ function registers.filter(data,options) data.result = registers.filtercollected(nil,options.criterium,options.number,data.entries,true) end +local seeindex = 0 + +local function crosslinkseewords(result) + -- hash words (potential see destinations) + local words = { } + for i=1,#result do + local data = result[i] + local word = data.list[1] + word = word and word[1] + if word then + words[word] = data + else + -- can't happen + end + end + -- link seewords to words and tag destination + for i=1,#result do + local data = result[i] + local seeword = data.seeword + if seeword then + local text = seeword.text + if text then + local word = words[text] + if word then + local wr = word.references -- the referred word + local dr = data.references -- the see word + if wr.seeparent then + dr.seeindex = wr.seeparent + else + seeindex = seeindex + 1 + wr.seeparent = seeindex + dr.seeindex = seeindex + end + local s, d, w, l = { }, data.split, word.split, data.list + -- trick: we influence sorting by adding fake subentries + for i=1,#d do + s[#s+1] = d[i] -- parent + end + for i=1,#w do + s[#s+1] = w[i] -- see + end + data.split = s + -- we also register a fake extra list entry so that the + -- collapser works okay + l[#l+1] = { text, "" } + end + end + end + end +end + + +local function removeemptyentries(result) + local i, n, m = 1, #result, 0 + while i <= n do + local entry = result[i] + if #entry.list == 0 or #entry.split == 0 then + remove(result,i) + n = n - 1 + m = m + 1 + else + i = i + 1 + end + end + if m > 0 then + report_registers("%s empty entries removed in register") + end +end + function registers.prepare(data) -- data has 'list' table local strip = sorters.strip @@ -363,6 +436,8 @@ function registers.prepare(data) end entry.split = split end + removeemptyentries(result) + crosslinkseewords(result) end end @@ -451,8 +526,6 @@ end -- todo: ownnumber -local seeindex = 0 - local function pagerange(f_entry,t_entry,is_last,prefixspec,pagespec) local fer, ter = f_entry.references, t_entry.references context.registerpagerange( @@ -559,50 +632,11 @@ function collapsepages(pages) while collapsedpage(pages) do end end -local function crosslinkseewords(result) - -- hash words (potential see destinations) - local words = { } - for i=1,#result do - local data = result[i].data - for j=1,#data do - local d = data[j] - local word = d.list[1][1] - words[word] = d - end - end - -- link seewords to words and tag destination - for i=1,#result do - local data = result[i].data - for j=1,#data do - local d = data[j] - local seeword = d.seeword - if seeword then - local text = seeword.text - if text then - local w = words[text] - if w then - local wr = w.references -- the referred word - local dr = d.references -- the see word - if wr.seeparent then - dr.seeindex = wr.seeparent - else - seeindex = seeindex + 1 - wr.seeparent = seeindex - dr.seeindex = seeindex - end - end - end - end - end - end -end - function registers.flush(data,options,prefixspec,pagespec) local equal = table.are_equal local collapse_singles = options.compress == variables.yes local collapse_ranges = options.compress == variables.all local result = data.result - crosslinkseewords(result) context.startregisteroutput() for i=1,#result do -- ranges need checking ! @@ -616,9 +650,15 @@ function registers.flush(data,options,prefixspec,pagespec) local entry = data[d] local e = { false, false, false, false } local metadata = entry.metadata + local kind = metadata.kind + local list = entry.list + if kind == "see" then + -- remove fake entry + list[#list] = nil + end for i=1,4 do -- max 4 - if entry.list[i] then - e[i] = entry.list[i][1] + if list[i] then + e[i] = list[i][1] end if e[i] ~= done[i] then if e[i] and e[i] ~= "" then @@ -649,10 +689,8 @@ function registers.flush(data,options,prefixspec,pagespec) end end end - local kind = entry.metadata.kind if kind == 'entry' then context.startregisterpages() - --~ collapse_ranges = true if collapse_singles or collapse_ranges then -- we collapse ranges and keep existing ranges as they are -- so we get prebuilt as well as built ranges @@ -728,12 +766,36 @@ function registers.flush(data,options,prefixspec,pagespec) end context.stopregisterpages() elseif kind == 'see' then - -- maybe some day more words, todo: metadata like normal entries + local t, lasttext = { }, "" + while true do + local text = entry.seeword.text or "" + if text ~= "" and lasttext ~= text then + t[#t+1] = { + seeindex = entry.references.seeindex or "", + seetext = text, + processor = entry.processors and entry.processors[1] or "", + } + lasttext = text + end + if d == #data then + break + else + d = d + 1 + local next = data[d] + if next and next.metadata.kind == "see" then + entry = next + else + d = d - 1 + break + end + end + end context.startregisterseewords() - local seeindex = entry.references.seeindex or "" - local seetext = entry.seeword.text or "" - local processor = entry.processors and entry.processors[1] or "" - context.registeroneword(processor,0,seeindex,seetext) + local n = #t + for i=1,n do + local ti = t[i] + context.registerseeword(i,n,ti.processor,0,ti.seeindex,ti.seetext) + end context.stopregisterseewords() end end diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index 94250767c..900a49e9c 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -686,7 +686,8 @@ \endgroup} \unexpanded\def\startregisterseewords - {\begingroup + {\par + \begingroup \setfalse\registerpagedone \dostarttagged\t!registerpage\empty \dosetregisterattributes\c!pagestyle\c!pagecolor} @@ -731,28 +732,10 @@ \dostoptagged \dostoptagged} -\def\registeroneword#1#2#3#4% #1:processor #2:internal #3:seeindex #4:word - {\registerpageseparator - \def\currentregisterpageindex{#2}% - \dostarttagged\t!registersee\empty - \iflocation - \def\currentregisterseeindex{#3}% - \else - \let\currentregisterseeindex\empty - \fi - \ifx\currentregisterseeindex\empty - \registerseeword{#1}{#4}% - \else -% [>\currentregisterseeindex]% - \registerseeword{#1}{\goto{#4}[seeindex:\currentregisterseeindex]}% - \fi - \dostoptagged} - \def\doapplyregisterentrycommand#1#2% processor text {\dostarttagged\t!registerentry\empty \ifx\currentregisterseeindex\empty \else \dontleavehmode -% [<\currentregisterseeindex]% \pagereference[seeindex:\currentregisterseeindex]% maybe some day we will support an area \fi \applyprocessor{#1}{\registerparameter\c!textcommand{\limitedregisterentry{\registerparameter\c!deeptextcommand{#2}}}}% @@ -770,9 +753,31 @@ \doapplyregisterentrycommand{#1}{#4}% \fi} -\def\defaultregisterseeword#1#2% processor word - {\dostarttagged\t!registersee\empty - \applyprocessor{#1}{\labeltexts\v!see{#2}}% +\unexpanded\def\doapplyregisterseecommand#1#2% + {\ifx\currentregisterseeindex\empty + % \dontleavehmode + \applyprocessor{#1}{#2}% + \else + \goto{\applyprocessor{#1}{#2}}[seeindex:\currentregisterseeindex]% + \fi} + +\def\defaultregisterseeword#1#2#3#4#5#6% i n #3:processor #4:internal #5:seeindex #6:word + {%\registerpageseparator + \def\currentregisterpageindex{#4}% + \dostarttagged\t!registersee\empty + \settrue\registerpagedone + \iflocation + \def\currentregisterseeindex{#5}% + \else + \let\currentregisterseeindex\empty + \fi + \ifnum#1=\plusone + \labeltexts\v!see{\doapplyregisterseecommand{#3}{#6}}% + \else\ifnum#1=#2\relax + \labeltexts\v!and{\doapplyregisterseecommand{#3}{#6}}% + \else + ,\space\doapplyregisterseecommand{#3}{#6}% + \fi\fi \dostoptagged} \let\registerseeword \defaultregisterseeword diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index fec038251..a16abecfe 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -71,6 +71,7 @@ + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index c1e8a989e..355b11feb 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -71,6 +71,7 @@ + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index fc148cfbb..43a4fcfd7 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -71,6 +71,7 @@ + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 78a4ebb4c..87a189e5d 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -71,6 +71,7 @@ + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 12ecd566d..b6f56e964 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -71,6 +71,7 @@ + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index df1f277b9..843d0db37 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -71,6 +71,7 @@ + diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index cd3c6c101..78fd96d27 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -71,6 +71,7 @@ + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 99ca40a16..6a311ec3d 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -71,6 +71,7 @@ + diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index bf2cd47fa..f1b31447b 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 : 10/21/10 14:02:50 +-- merge date : 10/21/10 19:55:03 do -- begin closure to overcome local limits and interference -- cgit v1.2.3