diff options
Diffstat (limited to 'Master/texmf-dist/scripts/oberdiek/luacolor.lua')
-rw-r--r-- | Master/texmf-dist/scripts/oberdiek/luacolor.lua | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/Master/texmf-dist/scripts/oberdiek/luacolor.lua b/Master/texmf-dist/scripts/oberdiek/luacolor.lua index 0d3f1ce9262..816667d6397 100644 --- a/Master/texmf-dist/scripts/oberdiek/luacolor.lua +++ b/Master/texmf-dist/scripts/oberdiek/luacolor.lua @@ -9,7 +9,7 @@ -- This is a generated file. -- -- Project: luacolor --- Version: 2018/11/22 v1.11 +-- Version: 2019/07/25 v1.12 -- -- Copyright (C) 2007, 2009-2011 by -- Heiko Oberdiek <heiko.oberdiek at googlemail.com> @@ -34,16 +34,13 @@ -- luacolor-test1.tex, luacolor-test2.tex, luacolor-test3.tex, -- luacolor.lua, -- -module("oberdiek.luacolor", package.seeall) -function getversion() - tex.write("2018/11/22 v1.11") -end -local ifpdf -if tonumber(tex.outputmode or tex.pdfoutput) > 0 then - ifpdf = true -else - ifpdf = false +oberdiek = oberdiek or {} +local luacolor = oberdiek.luacolor or {} +oberdiek.luacolor = luacolor +function luacolor.getversion() + tex.write("2019/07/25 v1.12") end +local ifpdf = tonumber(tex.outputmode or tex.pdfoutput) > 0 local prefix local prefixes = { dvips = "color ", @@ -70,7 +67,7 @@ local function info(msg, term) texio.write_nl(target, "Package luacolor info: " .. msg .. ".") texio.write_nl(target, "") end -function dvidetect() +function luacolor.dvidetect() local v = tex.box[0] assert(v.id == node.id("hlist")) for v in node.traverse_id(node.id("whatsit"), v.head) do @@ -92,10 +89,10 @@ end local map = { n = 0, } -function get(color) - tex.write("" .. getvalue(color)) +function luacolor.get(color) + tex.write("" .. luacolor.getvalue(color)) end -function getvalue(color) +function luacolor.getvalue(color) local n = map[color] if not n then n = map.n + 1 @@ -106,22 +103,23 @@ function getvalue(color) return n end local attribute -function setattribute(attr) +function luacolor.setattribute(attr) attribute = attr end -function getattribute() +function luacolor.getattribute() return attribute end local LIST = 1 local LIST_LEADERS = 2 -local COLOR = 3 +local LIST_DISC = 3 +local COLOR = 4 local RULE = node.id("rule") local node_types = { [node.id("hlist")] = LIST, [node.id("vlist")] = LIST, [node.id("rule")] = COLOR, [node.id("glyph")] = COLOR, - [node.id("disc")] = COLOR, + [node.id("disc")] = LIST_DISC, [node.id("whatsit")] = { [node.subtype("special")] = COLOR, [node.subtype("pdf_literal")] = COLOR, @@ -160,14 +158,18 @@ local function traverse(list, color, dry) if not list then return color end - if get_type(list) ~= LIST then + local head + if get_type(list) == LIST then + head = list.head + elseif get_type(list) == LIST_DISC then + head = list.replace + else texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id)) return color end - local head = list.head for n in node.traverse(head) do local t = get_type(n) - if t == LIST then + if t == LIST or t == LIST_DISC then color = traverse(n, color, dry) elseif t == LIST_LEADERS then local color_after = traverse(n.leader, color, DRY_TRUE) @@ -199,10 +201,14 @@ local function traverse(list, color, dry) end end end - list.head = head + if get_type(list) == LIST then + list.head = head + else + list.replace = head + end return color end -function process(box) +function luacolor.process(box) local color = "" local list = tex.getbox(box) traverse(list, color, DRY_FALSE) |