From 2ba81259a75af1ae03dfd8ee29464274081fc48b Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Tue, 14 Apr 2015 19:15:04 +0200 Subject: 2015-04-14 19:05:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4193 -> 4187 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/grph-inc.lua | 58 ++++++++------- tex/context/base/node-ref.lua | 68 +++++++++--------- tex/context/base/publ-imp-apa.mkvi | 8 +-- tex/context/base/publ-imp-aps.lua | 4 -- tex/context/base/status-files.pdf | Bin 24485 -> 24486 bytes tex/context/base/status-lua.pdf | Bin 249949 -> 249951 bytes tex/context/base/strc-con.mkvi | 12 ++-- tex/context/base/strc-doc.lua | 79 ++++++++++++--------- tex/context/base/strc-itm.mkvi | 11 +-- tex/context/base/strc-lst.lua | 18 ++--- tex/context/base/strc-lst.mkvi | 2 +- tex/context/base/strc-num.mkiv | 20 +++--- tex/context/base/strc-ref.lua | 52 ++++++++------ tex/context/base/strc-ref.mkvi | 38 +++++----- tex/context/base/strc-sbe.mkiv | 8 ++- tex/context/base/strc-sec.mkiv | 12 ++-- tex/generic/context/luatex/luatex-fonts-merged.lua | 11 ++- tex/generic/context/luatex/luatex-fonts-otn.lua | 13 +++- 21 files changed, 235 insertions(+), 183 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index f28c10d49..828782e01 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{2015.04.14 00:54} +\newcontextversion{2015.04.14 19:03} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 6eef61668..e81738ba5 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.mkiv b/tex/context/base/context.mkiv index b4fd91e60..676871e7c 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.04.14 00:54} +\edef\contextversion{2015.04.14 19:03} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index ab1c0d314..8a064c8e9 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -1228,11 +1228,11 @@ end function checkers.generic(data) local dr, du, ds = data.request, data.used, data.status - local name = du.fullname or "unknown generic" - local page = du.page or dr.page - local size = dr.size or "crop" + local name = du.fullname or "unknown generic" + local page = du.page or dr.page + local size = dr.size or "crop" local color = dr.color or "natural" - local mask = dr.mask or "none" + local mask = dr.mask or "none" local conversion = dr.conversion local resolution = dr.resolution if not conversion or conversion == "" then @@ -1299,9 +1299,9 @@ end function includers.generic(data) local dr, du, ds = data.request, data.used, data.status -- here we set the 'natural dimensions' - dr.width = du.width - dr.height = du.height - local hash = figures.hash(data) + dr.width = du.width + dr.height = du.height + local hash = figures.hash(data) local figure = figures_used[hash] -- figures.registerresource { -- filename = du.fullname, @@ -1317,9 +1317,7 @@ function includers.generic(data) figures_used[hash] = figure end if figure then - local nr = figures.boxnumber - -- it looks like we have a leak in attributes here .. todo - + local nr = figures.boxnumber nofimages = nofimages + 1 ds.pageindex = nofimages local image = images.node(figure) @@ -1328,7 +1326,7 @@ function includers.generic(data) end) image.next = pager pager.prev = image - local box = hpack(image) -- images.node(figure) not longer valid + local box = hpack(image) -- images.node(figure) not longer valid indexed[figure.index] = figure box.width, box.height, box.depth = figure.width, figure.height, 0 -- new, hm, tricky, we need to do that in tex (yet) @@ -1567,6 +1565,7 @@ local epstopdf = { -dEPSCrop -dCompatibilityLevel=%level% -sOutputFile="%newname%" + %colorspace% "%oldname%" -c quit ]], @@ -1607,7 +1606,7 @@ cleaners.ai = function(name) return tmpname end -function epsconverter.pdf(oldname,newname,resolution) -- the resolution interface might change +function epsconverter.pdf(oldname,newname,resolution,colorspace) -- the resolution interface might change local epstopdf = programs.epstopdf -- can be changed local presets = epstopdf.resolutions[resolution or "high"] or epstopdf.resolutions.high local level = codeinjections.getformatoption("pdf_level") or "1.3" @@ -1615,17 +1614,28 @@ function epsconverter.pdf(oldname,newname,resolution) -- the resolution interfac if cleanups.ai then tmpname = cleaners.ai(oldname) end + if colorspace == "gray" then + colorspace = "-sColorConversionStrategy=Gray -sProcessColorModel=DeviceGray" + -- colorspace = "-sColorConversionStrategy=Gray" + else + colorspace = nil + end runprogram(epstopdf.command, epstopdf.argument, { - newname = newname, - oldname = tmpname, - presets = presets, - level = tostring(level), + newname = newname, + oldname = tmpname, + presets = presets, + level = tostring(level), + colorspace = colorspace, } ) if tmpname ~= oldname then os.remove(tmpname) end end +epsconverter["gray.pdf"] = function(oldname,newname,resolution) -- the resolution interface might change + epsconverter.pdf(oldname,newname,resolution,"gray") +end + epsconverter.default = epsconverter.pdf local pdfconverter = converters.pdf or { } @@ -1895,10 +1905,10 @@ local function bases_find(basename,askedlabel) page = page + 1 if xml.text(e) == askedlabel then t = { - base = file.replacesuffix(base[2],"pdf"), + base = file.replacesuffix(base[2],"pdf"), format = "pdf", - name = xml.text(e,"../*:file"), -- to be checked - page = page, + name = xml.text(e,"../*:file"), -- to be checked + page = page, } bases_found[askedlabel] = t if trace_bases then @@ -1933,13 +1943,13 @@ function identifiers.base(data) local dr, du, ds = data.request, data.used, data.status local fbl = bases_locate(dr.name or dr.label) if fbl then - du.page = fbl.page - du.format = fbl.format + du.page = fbl.page + du.format = fbl.format du.fullname = fbl.base ds.fullname = fbl.name - ds.format = fbl.format - ds.page = fbl.page - ds.status = 10 + ds.format = fbl.format + ds.page = fbl.page + ds.status = 10 end end return data diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua index 1f802a49f..9703cc184 100644 --- a/tex/context/base/node-ref.lua +++ b/tex/context/base/node-ref.lua @@ -37,8 +37,8 @@ local tasks = nodes.tasks local trace_references = false trackers.register("nodes.references", function(v) trace_references = v end) local trace_destinations = false trackers.register("nodes.destinations", function(v) trace_destinations = v end) local trace_areas = false trackers.register("nodes.areas", function(v) trace_areas = v end) -local show_references = false trackers.register("nodes.references.show", function(v) show_references = v end) -local show_destinations = false trackers.register("nodes.destinations.show", function(v) show_destinations = v end) +local show_references = false trackers.register("nodes.references.show", function(v) show_references = tonumber(v) or (v and 2.25 or false) end) +local show_destinations = false trackers.register("nodes.destinations.show", function(v) show_destinations = tonumber(v) or (v and 2.00 or false) end) local report_reference = logs.reporter("backend","references") local report_destination = logs.reporter("backend","destinations") @@ -434,7 +434,7 @@ local u_transparency = nil local u_colors = { } local force_gray = true -local function addstring(what,str) --todo make a pluggable helper (in font-ctx) +local function addstring(what,str,shift) --todo make a pluggable helper (in font-ctx) if str then local typesetters = nuts.typesetters if typesetters then @@ -442,16 +442,15 @@ local function addstring(what,str) --todo make a pluggable helper (in font-ctx) local infofont = fonts.infofont() local emwidth = hashes.emwidths [infofont] local exheight = hashes.exheights[infofont] - local shift = nil if what == "reference" then str = str .. " " - shift = - 1.25*exheight + shift = - (shift or 2.25) * exheight else str = str .. " " - shift = 2*exheight + shift = (shift or 2) * exheight end local text = typesetters.fast_hpack(str,infofont) - local rule = new_rule(emwidth/10,4*exheight,3*exheight) + local rule = new_rule(emwidth/5,4*exheight,3*exheight) local list = getlist(text) setfield(text,"shift",shift) return nuts.fasthpack(nuts.linked(text,rule)) @@ -461,7 +460,7 @@ local function addstring(what,str) --todo make a pluggable helper (in font-ctx) end end -local function colorize(width,height,depth,n,reference,what,sr) +local function colorize(width,height,depth,n,reference,what,sr,offset) if force_gray then n = 0 end u_transparency = u_transparency or transparencies.register(nil,2,.65) local ucolor = u_colors[n] @@ -501,7 +500,7 @@ local function colorize(width,height,depth,n,reference,what,sr) else if sr and sr ~= "" then - local text = addstring(what,sr) + local text = addstring(what,sr,shift) if text then local kern = new_kern(-getfield(text,"width")) setfield(kern,"next",text) @@ -516,9 +515,9 @@ end end end -local function justadd(what,sr) +local function justadd(what,sr,shift) if sr and sr ~= "" then - local text = addstring(what,sr) + local text = addstring(what,sr,shift) if text then local kern = new_kern(-getfield(text,"width")) setfield(kern,"next",text) @@ -570,13 +569,12 @@ local function makereference(width,height,depth,reference) -- height and depth a report_reference("resolving attribute %a",reference) end local resolved, ht, dp, set, n = sr[1], sr[2], sr[3], sr[4], sr[5] --- logs.report("temp","child: ht=%p dp=%p, parent: ht=%p dp=%p",ht,dp,height,depth) + -- logs.report("temp","child: ht=%p dp=%p, parent: ht=%p dp=%p",ht,dp,height,depth) if ht then if height < ht then height = ht end if depth < dp then depth = dp end end --- logs.report("temp","used: ht=%p dp=%p",height,depth) --- step = 0 + -- logs.report("temp","used: ht=%p dp=%p",height,depth) local annot = nodeinjections.reference(width,height,depth,set) if annot then annot = tonut(annot) -- todo @@ -600,11 +598,11 @@ local function makereference(width,height,depth,reference) -- height and depth a end if trace_references then local step = 65536 - result = hpack_list(colorize(width,height-step,depth-step,2,reference,"reference",texts)) -- step subtracted so that we can see seperate links + result = hpack_list(colorize(width,height-step,depth-step,2,reference,"reference",texts,show_references)) -- step subtracted so that we can see seperate links setfield(result,"width",0) current = result elseif texts then - texts = justadd("reference",texts) + texts = justadd("reference",texts,show_references) if texts then result = hpack_list(texts) setfield(result,"width",0) @@ -676,31 +674,35 @@ local function makedestination(width,height,depth,reference) if trace_destinations then report_destination("resolving attribute %a",reference) end - local resolved, ht, dp, name, view = sr[1], sr[2], sr[3], sr[4], sr[5] + local resolved, ht, dp, name, view = sr[1], sr[2], sr[3], sr[4], sr[5] -- sr[4] will change to just internal if ht then if height < ht then height = ht end if depth < dp then depth = dp end end local result, current, texts if show_destinations then - local str = sr[4] - if str and #str > 0 then + if name and #name > 0 then local t = { } - for i=1,#str do - local d = references.internals[str[i]] - if d then - d = d.references - local r = d.reference - local p = d.usedprefix - if r then - if p then - t[#t+1] = p .. "|" .. r + for i=1,#name do + local s = name[i] + if type(s) == "number" then + local d = references.internals[s] + if d then + d = d.references + local r = d.reference + local p = d.usedprefix + if r then + if p then + t[#t+1] = p .. "|" .. r + else + t[#t+1] = r + end else - t[#t+1] = r + -- t[#t+1] = d.internal or "?" end - else - -- t[#t+1] = d.internal or "?" end + else + -- in fact we have a prefix:name here end end if #t > 0 then @@ -714,7 +716,7 @@ local function makedestination(width,height,depth,reference) step = 4*65536 width, height, depth = 5*step, 5*step, 0 end - local rule = hpack_list(colorize(width,height,depth,3,reference,"destination",texts)) + local rule = hpack_list(colorize(width,height,depth,3,reference,"destination",texts,show_destinations)) setfield(rule,"width",0) if not result then result, current = rule, rule @@ -725,7 +727,7 @@ local function makedestination(width,height,depth,reference) end width, height = width - step, height - step elseif texts then - texts = justadd("destination",texts) + texts = justadd("destination",texts,show_destinations) if texts then result = hpack_list(texts) if result then diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 2edb4dc28..3052eab3c 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -968,12 +968,12 @@ \setbreakpoints[doi] \ifconditional\btxinteractive \goto { - \btxflush{url} + \hyphenatedurl{\btxflush{url}} } [ url(\btxflush{url}) ] \else - \btxflush{url} + \hyphenatedurl{\btxflush{url}} \fi \endgroup \stoptexdefinition @@ -986,12 +986,12 @@ \setbreakpoints[doi] \ifconditional\btxinteractive \goto { - doi:\btxflush{doi} + \hyphenatedurl{doi:\btxflush{doi}} } [ url(http://dx.doi.org/\btxflush{doi}) ] \else - doi:\btxflush{doi} + \hyphenatedurl{doi:\btxflush{doi}} \fi \endgroup \stoptexdefinition diff --git a/tex/context/base/publ-imp-aps.lua b/tex/context/base/publ-imp-aps.lua index efd1c85c1..1ec75d7d1 100644 --- a/tex/context/base/publ-imp-aps.lua +++ b/tex/context/base/publ-imp-aps.lua @@ -32,10 +32,6 @@ local specification = { -- author = "author", -- interpreted as name(s) editor = "author", - artist = "author", - interpreter = "author", - composer = "author", - producer = "author", doi = "url", -- an external link url = "url", page = "pagenumber", -- number or range: f--t diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index be436f6c7..fe46665b6 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 dc0a481c8..eb37397a8 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-con.mkvi b/tex/context/base/strc-con.mkvi index f4c20dbc9..11f6f758e 100644 --- a/tex/context/base/strc-con.mkvi +++ b/tex/context/base/strc-con.mkvi @@ -953,12 +953,12 @@ % \currentdirectionparameters } references { - internal \nextinternalreference - order \nextinternalorderreference - reference {\currentconstructionreference} - referenceprefix {\referenceprefix} - block {\currentsectionblock} - % section structures.sections.currentid(), + internal \nextinternalreference + order \nextinternalorderreference + reference {\currentconstructionreference} + prefix {\referenceprefix} + % block {\currentsectionblock} + % section structures.sections.currentid(), } titledata { label {\detokenize\expandafter{\currentconstructionlabel}} diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua index a8647684c..029d68a9d 100644 --- a/tex/context/base/strc-doc.lua +++ b/tex/context/base/strc-doc.lua @@ -17,7 +17,7 @@ if not modules then modules = { } end modules ['strc-doc'] = { local next, type, tonumber, select = next, type, tonumber, select local format, gsub, find, gmatch, match = string.format, string.gsub, string.find, string.gmatch, string.match -local concat, fastcopy = table.concat, table.fastcopy +local concat, fastcopy, insert, remove = table.concat, table.fastcopy, table.insert, table.remove local max, min = math.max, math.min local allocate, mark, accesstable = utilities.storage.allocate, utilities.storage.mark, utilities.tables.accesstable local setmetatableindex = table.setmetatableindex @@ -239,7 +239,7 @@ end function sections.pushblock(name,settings) counters.check(0) -- we assume sane usage of \page between blocks local block = name or data.block - data.blocks[#data.blocks+1] = block + insert(data.blocks,block) data.block = block sectionblockdata[block] = settings documents.reset() @@ -247,17 +247,18 @@ function sections.pushblock(name,settings) end function sections.popblock() - data.blocks[#data.blocks] = nil - local block = data.blocks[#data.blocks] or data.block + local block = remove(data.blocks) or data.block data.block = block documents.reset() return block end -function sections.currentblock() +local function getcurrentblock() return data.block or data.blocks[#data.blocks] or "unknown" end +sections.currentblock = getcurrentblock + function sections.currentlevel() return data.depth end @@ -271,15 +272,33 @@ local saveset = { } -- experiment, see sections/tricky-001.tex function sections.setentry(given) -- old number local numbers = data.numbers + -- + local metadata = given.metadata + local numberdata = given.numberdata + local references = given.references + local directives = given.directives + local userdata = given.userdata + + if not metadata then + metadata = { } + given.metadata = metadata + end + if not numberdata then + numberdata = { } + given.numberdata = numberdata + end + if not references then + references = { } + given.references = references + end local ownnumbers = data.ownnumbers local forced = data.forced local status = data.status local olddepth = data.depth - local givenname = given.metadata.name + local givenname = metadata.name local mappedlevel = levelmap[givenname] local newdepth = tonumber(mappedlevel or (olddepth > 0 and olddepth) or 1) -- hm, levelmap only works for section-* - local directives = given.directives local resetset = directives and directives.resetset or "" -- local resetter = sets.getall("structure:resets",data.block,resetset) -- a trick to permit userdata to overload title, ownnumber and reference @@ -289,14 +308,13 @@ function sections.setentry(given) report_structure("name %a, mapped level %a, old depth %a, new depth %a, reset set %a", givenname,mappedlevel,olddepth,newdepth,resetset) end - local u = given.userdata - if u then - -- kind of obsolete as we can pass them directly anyway - if u.reference and u.reference ~= "" then given.metadata.reference = u.reference ; u.reference = nil end - if u.ownnumber and u.ownnumber ~= "" then given.numberdata.ownnumber = u.ownnumber ; u.ownnumber = nil end - if u.title and u.title ~= "" then given.titledata.title = u.title ; u.title = nil end - if u.bookmark and u.bookmark ~= "" then given.titledata.bookmark = u.bookmark ; u.bookmark = nil end - if u.label and u.label ~= "" then given.titledata.label = u.label ; u.label = nil end + if userdata then + -- kind of obsolete as we can pass them directly anyway ... NEEDS CHECKING ! + if userdata.reference and userdata.reference ~= "" then given.metadata.reference = userdata.reference ; userdata.reference = nil end + if userdata.ownnumber and userdata.ownnumber ~= "" then given.numberdata.ownnumber = userdata.ownnumber ; userdata.ownnumber = nil end + if userdata.title and userdata.title ~= "" then given.titledata.title = userdata.title ; userdata.title = nil end + if userdata.bookmark and userdata.bookmark ~= "" then given.titledata.bookmark = userdata.bookmark ; userdata.bookmark = nil end + if userdata.label and userdata.label ~= "" then given.titledata.label = userdata.label ; userdata.label = nil end end -- so far for the trick if saveset then @@ -334,12 +352,12 @@ function sections.setentry(given) end end counters.check(newdepth) - ownnumbers[newdepth] = given.numberdata.ownnumber or "" - given.numberdata.ownnumber = nil + ownnumbers[newdepth] = numberdata.ownnumber or "" + numberdata.ownnumber = nil data.depth = newdepth -- new number olddepth = newdepth - if given.metadata.increment then + if metadata.increment then local oldn, newn = numbers[newdepth] or 0, 0 local fd = forced[newdepth] if fd then @@ -369,40 +387,31 @@ function sections.setentry(given) v[2](k) end end - local numberdata= given.numberdata - if not numberdata then - -- probably simplified to nothing - numberdata = { } - given.numberdata = numberdata - end - local n = { } for i=1,newdepth do n[i] = numbers[i] end numberdata.numbers = n --- numberdata.numbers = fastcopy(numbers) - + if not numberdata.block then + numberdata.block = getcurrentblock() -- also in references + end if #ownnumbers > 0 then numberdata.ownnumbers = fastcopy(ownnumbers) end if trace_detail then report_structure("name %a, numbers % a, own numbers % a",givenname,numberdata.numbers,numberdata.ownnumbers) end - - local metadata = given.metadata - local references = given.references - + if not references.block then + references.block = getcurrentblock() -- also in numberdata + end local tag = references.tag or tags.getid(metadata.kind,metadata.name) if tag and tag ~= "" and tag ~= "?" then references.tag = tag end - local setcomponent = structures.references.setcomponent if setcomponent then setcomponent(given) -- might move to the tex end end - references.section = sections.save(given) -- given.numberdata = nil end @@ -1025,9 +1034,9 @@ implement { { "references", { { "internal", "integer" }, { "block" }, - { "referenceprefix" }, - { "reference" }, { "backreference" }, + { "prefix" }, + { "reference" }, } }, { "directives", { diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi index 903471913..86fc9d9fd 100644 --- a/tex/context/base/strc-itm.mkvi +++ b/tex/context/base/strc-itm.mkvi @@ -248,13 +248,12 @@ \fi \fi} \def\strc_itemgroups_insert_reference_indeed % maybe we need a 'frozen counter' numberdata blob / quick hack .. .mive this to strc-ref - {%\setnextinternalreference + {% needs testing, gave problems: + \setnextinternalreference % no need to collect nodes in \b_strc_destination_nodes here ... maybe at some point \strc_references_start_destination_nodes % this is somewhat over the top ... we should use the counter's reference \clf_setreferenceattribute - {\referenceprefix}% - {\currentitemreference}% {% metadata {% kind {item}% was item, why? @@ -264,9 +263,11 @@ catcodes \catcodetable }% references {% - % internal \nextinternalreference % no: this spoils references - block {\currentsectionblock}% + internal \nextinternalreference % no: this spoils references + % block {\currentsectionblock}% view {\interactionparameter\c!focus}% + prefix {\referenceprefix}% + reference {\currentitemreference}% }% prefixdata {% prefix {\namedcounterparameter\v_strc_itemgroups_counter\c!prefix}% diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 8ea0a75b9..4ed542eb6 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -195,15 +195,15 @@ end -- we could use t (as hash key) in order to check for dup entries function lists.addto(t) -- maybe more more here (saves parsing at the tex end) - local m = t.metadata - local u = t.userdata - if u and type(u) == "string" then - t.userdata = helpers.touserdata(u) + local metadata = t.metadata + local userdata = t.userdata + local numberdata = t.numberdata + if userdata and type(userdata) == "string" then + t.userdata = helpers.touserdata(userdata) end - if not m.level then - m.level = structures.sections.currentlevel() + if not metadata.level then + metadata.level = structures.sections.currentlevel() -- this is not used so it will go away end - local numberdata = t.numberdata if numberdata then local numbers = numberdata.numbers if type(numbers) == "string" then @@ -211,7 +211,7 @@ function lists.addto(t) -- maybe more more here (saves parsing at the tex end) end end local group = numberdata and numberdata.group - local name = m.name + local name = metadata.name if not group then -- forget about it elseif group == "" then @@ -986,7 +986,7 @@ implement { { "block" }, { "section", "integer" }, { "location" }, - { "referenceprefix" }, + { "prefix" }, { "reference" }, { "order", "integer" }, } diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index b0f900b68..afbfdab31 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -137,7 +137,7 @@ \scratchcounter\clf_addtolist references { internal \nextinternalreference - block {\currentsectionblock} + % block {\currentsectionblock} % section structures.sections.currentid() % location {\p_location} } diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index d51b6f48c..58095b8e7 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -535,13 +535,13 @@ \strc_counters_register_component_check_prefix \setnextinternalreference \clf_setreferenceattribute - {\currentstructurecomponentreferenceprefix}% - {\currentstructurecomponentreference}% {% references {% - internal \nextinternalreference - block {\currentsectionblock}% move to lua - view {\interactionparameter\c!focus}% + internal \nextinternalreference + % block {\currentsectionblock}% move to lua + view {\interactionparameter\c!focus}% + prefix {\currentstructurecomponentreferenceprefix}% + reference {\currentstructurecomponentreference}% }% metadata {% kind {\s!page}% @@ -613,11 +613,11 @@ \fi } references { - internal \nextinternalreference - block {\currentsectionblock} - reference {\currentstructurecomponentreference} - referenceprefix {\currentstructurecomponentreferenceprefix} - % section structures.sections.currentid() + internal \nextinternalreference + % block {\currentsectionblock} + reference {\currentstructurecomponentreference} + prefix {\currentstructurecomponentreferenceprefix} + % section structures.sections.currentid() } titledata { label {\detokenize\expandafter{\currentstructurecomponentlabel}} diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index ba5ddd139..5174b289d 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -344,8 +344,8 @@ local function setcomponent(data) local references = data and data.references if references then references.component = component - if references.referenceprefix == component then - references.referenceprefix = nil + if references.prefix == component then + references.prefix = nil end end return component @@ -376,9 +376,14 @@ implement { arguments = { "string", "string" } } -function references.set(kind,prefix,tag,data) --- setcomponent(data) --- print(kind,prefix,tag) +function references.set(data) + local references = data.references + local prefix = references.prefix or "" + local reference = references.reference + if not reference or reference == "" then + report_references("invalid reference") + return 0 + end local pd = tobesaved[prefix] -- nicer is a metatable if not pd then pd = { } @@ -401,7 +406,7 @@ function references.set(kind,prefix,tag,data) ctx_dofinishreference(prefix or "",ref or "",r and r.internal or 0) end end - process_settings(tag,action) + process_settings(reference,action) return n > 0 end @@ -469,7 +474,7 @@ local function register_from_lists(collected,derived,pages,sections) entry = collected[i] local metadata = entry.metadata if metadata then - local kind = metadata.kind + local kind = metadata.kind -- why this check if kind then local references = entry.references if references then @@ -477,7 +482,7 @@ local function register_from_lists(collected,derived,pages,sections) if reference and reference ~= "" then local realpage = references.realpage if realpage then - prefix = references.referenceprefix + prefix = references.prefix component = references.component if prefix and prefix ~= "" then derived_p = derived[prefix] @@ -513,7 +518,7 @@ local function collectbypage(tracedpages) local collected = structures.lists.collected local data = nil local function action(reference) - local prefix = data.referenceprefix + local prefix = data.prefix local component = data.component local realpage = data.realpage if realpage then @@ -549,9 +554,8 @@ local function collectbypage(tracedpages) do for prefix, list in next, collected do for reference, entry in next, list do - local data = entry.references - local reference = data and data.reference - if reference then + local data = entry.references + if data then local realpage = data.realpage local internal = data.internal or 0 local pagelist = rawget(tracedpages,realpage) @@ -1005,7 +1009,7 @@ local function loadexternalreferences(name,utilitydata) local realpage = references.realpage if kind and realpage then references.pagedata = pages[realpage] - local prefix = references.referenceprefix or "" + local prefix = references.prefix or "" local target = external[prefix] if not target then target = { } @@ -1107,7 +1111,7 @@ local function loadproductreferences(productname,componentname,utilitydata) local realpage = references.realpage if kind and realpage then references.pagedata = pages[realpage] - local prefix = references.referenceprefix or "" + local prefix = references.prefix or "" local component = references.component local ctarget, ptarget if not component or component == componentname then @@ -1900,7 +1904,7 @@ local function setinternalreference(specification) local internal = specification.internal local destination = unsetvalue if innermethod == v_auto then - local t, tn = { }, 0 -- maybe add to current + local t, tn = { }, 0 -- maybe add to current (now only used for tracing) local reference = specification.reference if reference then local prefix = specification.prefix @@ -1960,7 +1964,7 @@ implement { -- arguments = "integer", -- } -function references.setandgetattribute(prefix,tag,data) -- maybe do internal automatically here +function references.setandgetattribute(data) -- maybe do internal automatically here local attr = unsetvalue local mdat = data.metadata local rdat = data.references @@ -1984,9 +1988,17 @@ function references.setandgetattribute(prefix,tag,data) -- maybe do internal aut if type(udat) == "string" then data.userdata = structures.helpers.touserdata(udat) end - local done = references.set(mdat.kind or "page",prefix,tag,data) -- we had kind i.e .item -> full + if not rdat.block then + rdat.block = structures.sections.currentblock() + end + local done = references.set(data) -- we had kind i.e .item -> full if done then - attr = setinternalreference(prefix,tag,nil,rdat.view) or unsetvalue + attr = setinternalreference { + prefix = prefix, + reference = tag, + internal = rdat.internal, + view = rdat.view + } or unsetvalue end end texsetcount("lastdestinationattribute",attr) @@ -1997,14 +2009,14 @@ implement { name = "setreferenceattribute", actions = references.setandgetattribute, arguments = { - "string", - "string", { { "references", { { "internal", "integer" }, { "block" }, { "view" }, + { "prefix" }, + { "reference" }, }, }, { diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index fea01d270..7bf198998 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -217,13 +217,13 @@ \setnextinternalreference \strc_references_start_destination_nodes \clf_setreferenceattribute - {\referenceprefix}% - {\currentreferencelabels}% {% references {% - internal \nextinternalreference - block {\currentsectionblock}% - view {\interactionparameter\c!focus}% + internal \nextinternalreference + % block {\currentsectionblock}% + view {\interactionparameter\c!focus}% + prefix {\referenceprefix}% + reference {\currentreferencelabels}% }% metadata {% kind {\currentreferencekind}% @@ -271,13 +271,13 @@ \strc_references_start_destination_nodes \setnextinternalreference \clf_setreferenceattribute - {\referenceprefix}% - {\currentreferencelabels}% {% references {% - internal \nextinternalreference - block {\currentsectionblock}% - view {\interactionparameter\c!focus}% + internal \nextinternalreference + % block {\currentsectionblock}% + view {\interactionparameter\c!focus}% + prefix {\referenceprefix}% + reference {\currentreferencelabels}% }% metadata {% kind {page}% @@ -298,13 +298,13 @@ \edef\m_strc_references_user{#user}% \edef\m_strc_references_text{#text}% \clf_setreferenceattribute - {\referenceprefix}% - {#labels}% {% references {% - internal \nextinternalreference - block {\currentsectionblock}% - view {\interactionparameter\c!focus}% + internal \nextinternalreference + % block {\currentsectionblock}% + view {\interactionparameter\c!focus}% + prefix {\referenceprefix}% + reference {#labels}% }% metadata {% kind {\s!full}% @@ -375,12 +375,12 @@ {\iflocation \strc_references_start_destination_nodes \clf_setreferenceattribute - {\referenceprefix}% - {#label}% {% references {% - block {\currentsectionblock}% - view {\interactionparameter\c!focus}% + % block {\currentsectionblock}% + view {\interactionparameter\c!focus}% + prefix {\referenceprefix}% + reference {#label}% }% metadata {% kind {\s!page}% diff --git a/tex/context/base/strc-sbe.mkiv b/tex/context/base/strc-sbe.mkiv index 61f6f16b2..9f1d214cf 100644 --- a/tex/context/base/strc-sbe.mkiv +++ b/tex/context/base/strc-sbe.mkiv @@ -81,7 +81,9 @@ \def\strc_sectionblock_set[#1][#2]% used to set the default {\edef\currentsectionblock{#1}% from now on we assume a value \setupcurrentsectionblock[#2]% - \clf_setsectionblock{#1}{ bookmark {\sectionblockparameter\c!bookmark} }} + \clf_setsectionblock{#1} + bookmark {\sectionblockparameter\c!bookmark}% + \relax} \let\currentsectionblock\empty % was \s!unknown @@ -93,7 +95,9 @@ \begingroup \edef\currentsectionblock{#1}% from now on we assume a value \setupcurrentsectionblock[#2]% - \clf_pushsectionblock{#1}{ bookmark {\sectionblockparameter\c!bookmark} }% + \clf_pushsectionblock{#1} + bookmark {\sectionblockparameter\c!bookmark}% + \relax \csname #1true\endcsname % obsolete \setsystemmode\currentsectionblock \the\everybeforesectionblock\relax diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index eb6d3738d..f2a183601 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -177,11 +177,11 @@ \strc_sectioning_set_reference_prefix \clf_setsectionentry references { - internal \nextinternalreference\space - block {\currentsectionblock} - referenceprefix {\currentstructurereferenceprefix} - reference {\currentstructurereference} - backreference {\currentstructurebackreference} + internal \nextinternalreference\space + % block {\currentsectionblock} + prefix {\currentstructurereferenceprefix} + reference {\currentstructurereference} + backreference {\currentstructurebackreference} } directives { resetset {\structureparameter\c!sectionresetset} @@ -220,7 +220,7 @@ \fi } numberdata { - block {\currentsectionblock} + % block {\currentsectionblock} \ifx\currentstructureshownumber\v!no hidenumber \space true\space \fi diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 96c7c0878..bbc2b53e4 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 : 04/14/15 00:54:19 +-- merge date : 04/14/15 19:03:21 do -- begin closure to overcome local limits and interference @@ -11276,6 +11276,7 @@ local report_chain=logs.reporter("fonts","otf chain") local report_process=logs.reporter("fonts","otf process") local report_prepare=logs.reporter("fonts","otf prepare") local report_warning=logs.reporter("fonts","otf warning") +local report_run=logs.reporter("fonts","otf run") registertracker("otf.verbose_chain",function(v) otf.setcontextchain(v and "verbose") end) registertracker("otf.normal_chain",function(v) otf.setcontextchain(v and "normal") end) registertracker("otf.replacements","otf.singles,otf.multiples,otf.alternatives,otf.ligatures") @@ -11298,12 +11299,18 @@ local setprop=nuts.setprop local getfont=nuts.getfont local getsubtype=nuts.getsubtype local getchar=nuts.getchar +local insert_node_before=nuts.insert_before local insert_node_after=nuts.insert_after local delete_node=nuts.delete +local remove_node=nuts.remove local copy_node=nuts.copy +local copy_node_list=nuts.copy_list local find_node_tail=nuts.tail local flush_node_list=nuts.flush_list +local free_node=nuts.free local end_of_math=nuts.end_of_math +local traverse_nodes=nuts.traverse +local traverse_id=nuts.traverse_id local setmetatableindex=table.setmetatableindex local zwnj=0x200C local zwj=0x200D @@ -11321,6 +11328,8 @@ local math_code=nodecodes.math local dir_code=whatcodes.dir local localpar_code=whatcodes.localpar local discretionary_code=disccodes.discretionary +local regular_code=disccodes.regular +local automatic_code=disccodes.automatic local ligature_code=glyphcodes.ligature local privateattribute=attributes.private local a_state=privateattribute('state') diff --git a/tex/generic/context/luatex/luatex-fonts-otn.lua b/tex/generic/context/luatex/luatex-fonts-otn.lua index 3f53078cc..343e1826e 100644 --- a/tex/generic/context/luatex/luatex-fonts-otn.lua +++ b/tex/generic/context/luatex/luatex-fonts-otn.lua @@ -29,7 +29,6 @@ if not modules then modules = { } end modules ['font-otn'] = { -- todo: -- --- kerning is probably not yet ok for latin around dics nodes (interesting challenge) -- extension infrastructure (for usage out of context) -- sorting features according to vendors/renderers -- alternative loop quitters @@ -169,6 +168,7 @@ local report_chain = logs.reporter("fonts","otf chain") local report_process = logs.reporter("fonts","otf process") local report_prepare = logs.reporter("fonts","otf prepare") local report_warning = logs.reporter("fonts","otf warning") +local report_run = logs.reporter("fonts","otf run") registertracker("otf.verbose_chain", function(v) otf.setcontextchain(v and "verbose") end) registertracker("otf.normal_chain", function(v) otf.setcontextchain(v and "normal") end) @@ -197,12 +197,18 @@ local getfont = nuts.getfont local getsubtype = nuts.getsubtype local getchar = nuts.getchar +local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after local delete_node = nuts.delete +local remove_node = nuts.remove local copy_node = nuts.copy +local copy_node_list = nuts.copy_list local find_node_tail = nuts.tail local flush_node_list = nuts.flush_list +local free_node = nuts.free local end_of_math = nuts.end_of_math +local traverse_nodes = nuts.traverse +local traverse_id = nuts.traverse_id local setmetatableindex = table.setmetatableindex @@ -226,13 +232,15 @@ local dir_code = whatcodes.dir local localpar_code = whatcodes.localpar local discretionary_code = disccodes.discretionary +local regular_code = disccodes.regular +local automatic_code = disccodes.automatic local ligature_code = glyphcodes.ligature local privateattribute = attributes.private -- Something is messed up: we have two mark / ligature indices, one at the injection --- end and one here ... this is bases in KE's patches but there is something fishy +-- end and one here ... this is based on KE's patches but there is something fishy -- there as I'm pretty sure that for husayni we need some connection (as it's much -- more complex than an average font) but I need proper examples of all cases, not -- of only some. @@ -2627,6 +2635,7 @@ elseif typ == "gpos_single" or typ == "gpos_pair" then if trace_steps then -- ? registerstep(head) end + end head = tonode(head) -- cgit v1.2.3