diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-10-27 11:15:05 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-10-27 11:15:05 +0100 |
commit | f09a83056cb0fba2e79228858f5e86f2d297e3ca (patch) | |
tree | a986de0953f95b9266738b3b685a9177686ce676 /tex/context/base/lpdf-tag.lua | |
parent | 3a43c9a819d5d675e2a90f90b1ba1e36076a1af0 (diff) | |
download | context-f09a83056cb0fba2e79228858f5e86f2d297e3ca.tar.gz |
2014-10-27 09:29:00
Diffstat (limited to 'tex/context/base/lpdf-tag.lua')
-rw-r--r-- | tex/context/base/lpdf-tag.lua | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/tex/context/base/lpdf-tag.lua b/tex/context/base/lpdf-tag.lua index 678a57edd..904d5b196 100644 --- a/tex/context/base/lpdf-tag.lua +++ b/tex/context/base/lpdf-tag.lua @@ -83,16 +83,14 @@ local names = pdfarray() local structurestags = structures.tags local taglist = structurestags.taglist +local specifications = structurestags.specifications local usedlabels = structurestags.labels local properties = structurestags.properties -local userdata = structurestags.userdata local lasttaginchain = structurestags.lastinchain local usedmapping = { } -local tagsplitter = structurestags.patterns.splitter ------ colonsplitter = lpeg.splitat(":") ------ dashsplitter = lpeg.splitat("-") +-- local tagsplitter = structurestags.patterns.splitter local add_ids = false -- true @@ -173,7 +171,6 @@ end -- here we can flush and free elements that are finished -local userproperties = structurestags.userproperties local pdf_userproperties = pdfconstant("UserProperties") local function makeattribute(t) @@ -192,26 +189,27 @@ local function makeattribute(t) end end -local function makeelement(fulltag,parent,attr) - local tg, detail, n = lpegmatch(tagsplitter,fulltag) - -- local tag, n = lpegmatch(dashsplitter,fulltag) - -- local tg, detail = lpegmatch(colonsplitter,tag) - if tg == "ignore" then +local function makeelement(fulltag,parent) + local specification = specifications[fulltag] + local tag = specification.tagname + if tag == "ignore" then return false - elseif tg == "mstackertop" or tg == "mstackerbot" or tg == "mstackermid"then + elseif tag == "mstackertop" or tag == "mstackerbot" or tag == "mstackermid"then + -- TODO return true - elseif tg == "mstacker" then - local p = properties[fulltag] - tg = p and p.subtype or tg end + -- + local detail = specification.detail + local userdata = specification.userdata + -- + usedmapping[tag] = true + -- local k = pdfarray() local r = pdfreserveobject() - local a = userproperties[fulltag] - usedmapping[tg] = true - tg = usedlabels[tg] or tg + local t = usedlabels[tag] or tag local d = pdfdictionary { Type = pdf_struct_element, - S = pdfconstant(tg), + S = pdfconstant(t), ID = (add_ids and fulltag) or nil, T = detail and detail or nil, P = parent.pref, @@ -228,8 +226,7 @@ local function makeelement(fulltag,parent,attr) end local kids = parent.kids kids[#kids+1] = s --- local e = { tag = tag, pref = s, kids = k, knum = r, pnum = pagenum } - local e = { tag = detail and (tg .. "<" .. detail) or tg, pref = s, kids = k, knum = r, pnum = pagenum } + local e = { tag = t, pref = s, kids = k, knum = r, pnum = pagenum } elements[fulltag] = e return e end @@ -345,12 +342,13 @@ function nodeinjections.addtags(head) for i=1,#ranges do local range = ranges[i] local attr, id, start, stop, list = range[1], range[2], range[3], range[4], range[5] - local tags = taglist[attr] + local specification = taglist[attr] + local list = specification.taglist local prev = root - local noftags, tag = #tags, nil + local noftags, tag = #list, nil for j=1,noftags do - local tag = tags[j] - local prv = elements[tag] or makeelement(tag,prev,attr) + local tag = list[j] + local prv = elements[tag] or makeelement(tag,prev) if prv == false then -- ignore this one prev = false |