summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/strc-reg.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/strc-reg.lua')
-rw-r--r--tex/context/base/mkiv/strc-reg.lua22
1 files changed, 13 insertions, 9 deletions
diff --git a/tex/context/base/mkiv/strc-reg.lua b/tex/context/base/mkiv/strc-reg.lua
index 66c264a49..32924ad81 100644
--- a/tex/context/base/mkiv/strc-reg.lua
+++ b/tex/context/base/mkiv/strc-reg.lua
@@ -9,8 +9,7 @@ if not modules then modules = { } end modules ['strc-reg'] = {
local next, type = next, type
local format, gmatch = string.format, string.gmatch
local equal, concat, remove = table.are_equal, table.concat, table.remove
-local utfchar = utf.char
-local lpegmatch = lpeg.match
+local lpegmatch, P, C, Ct = lpeg.match, lpeg.P, lpeg.C, lpeg.Ct
local allocate = utilities.storage.allocate
local trace_registers = false trackers.register("structures.registers", function(v) trace_registers = v end)
@@ -43,7 +42,6 @@ local v_yes = variables.yes
local v_packed = variables.packed
local v_current = variables.current
local v_previous = variables.previous
-local v_next = variables.next
local v_first = variables.first
local v_last = variables.last
local v_text = variables.text
@@ -64,9 +62,6 @@ local internalreferences = references.internals
local setinternalreference = references.setinternalreference
local setmetatableindex = table.setmetatableindex
-local texsetattribute = tex.setattribute
-
-local a_destination = attributes.private('destination')
local absmaxlevel = 5 -- \c_strc_registers_maxlevel
@@ -441,7 +436,13 @@ implement {
arguments = { "string", "string" }
}
-local entrysplitter = lpeg.tsplitat('+') -- & obsolete in mkiv
+
+local p_s = P("+")
+local p_e = P("&") * (1-P(";"))^0 * P(";")
+local p_r = C((p_e + (1-p_s))^0)
+
+local entrysplitter_xml = Ct(p_r * (p_s * p_r)^0) -- bah
+local entrysplitter_tex = lpeg.tsplitat('+') -- & obsolete in mkiv
local tagged = { }
@@ -472,6 +473,7 @@ local function preprocessentries(rawdata)
local kt = entries.keys
local entryproc = processors and processors.entry
local pageproc = processors and processors.page
+ local coding = rawdata.metadata.coding
if entryproc == "" then
entryproc = nil
end
@@ -483,14 +485,14 @@ local function preprocessentries(rawdata)
if p then
entryproc = p
end
- et = lpegmatch(entrysplitter,e)
+ et = lpegmatch(coding == "xml" and entrysplitter_xml or entrysplitter_tex,e)
end
if not kt then
local p, k = splitprocessor(entries.key or "")
if p then
pageproc = p
end
- kt = lpegmatch(entrysplitter,k)
+ kt = lpegmatch(coding == "xml" and entrysplitter_xml or entrysplitter_tex,k)
end
--
entries = { }
@@ -1071,6 +1073,8 @@ local function collapsepages(pages)
return #pages
end
+-- todo: create an intermediate structure and flush that
+
function registers.flush(data,options,prefixspec,pagespec)
local compress = options.compress
local collapse_singles = compress == v_yes