diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-10-31 00:09:22 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-10-31 00:09:22 +0100 |
commit | 7043cd3b7046f6a11112a5d49c4ae5e2dc0c6896 (patch) | |
tree | 92ffcd258fb29e37b4a136eb071fbfd0717be29e /tex/context/base/mkiv/luat-mac.lua | |
parent | a0270f13065d116355a953c6f246cbba26289fc2 (diff) | |
download | context-7043cd3b7046f6a11112a5d49c4ae5e2dc0c6896.tar.gz |
2020-10-30 22:27:00
Diffstat (limited to 'tex/context/base/mkiv/luat-mac.lua')
-rw-r--r-- | tex/context/base/mkiv/luat-mac.lua | 66 |
1 files changed, 51 insertions, 15 deletions
diff --git a/tex/context/base/mkiv/luat-mac.lua b/tex/context/base/mkiv/luat-mac.lua index c754f602c..3c50a41f8 100644 --- a/tex/context/base/mkiv/luat-mac.lua +++ b/tex/context/base/mkiv/luat-mac.lua @@ -72,23 +72,60 @@ local stack, top, n, hashes = { }, nil, 0, { } -- end -- end -local function set(s) - if top then - local ns = #stack - local h = hashes[ns] - if not h then - h = rep("#",2^(ns-1)) - hashes[ns] = h +local set = CONTEXTLMTXMODE > 0 and + function(s) + if top then + local ns = #stack + local h = hashes[ns] + if not h then + h = rep("#",2^(ns-1)) + hashes[ns] = h + end + if s == "ignore" then + return h .. "-" + elseif s == "spacer" then + return h .. "*" + elseif s == "pickup" then + return h .. ":" + else + n = n + 1 + if n > 9 then + report_macros("number of arguments > 9, ignoring %s",s) + elseif s == "discard" then + top[s] = "" + return h .. "0" + elseif s == "keepbraces" then + top[s] = "" + return h .. "+" + elseif s == "mandate" then + top[s] = "" + return h .. "=" + elseif s == "keepmandate" then + top[s] = "" + return h .. "_" + elseif s == "prunespacing" then + top[s] = "" + return h .. "/" + else + local m = h .. n + top[s] = m + return m + end + end end - if s == "ignore" then - return h .. "-" - else + end +or + function(s) + if top then + local ns = #stack + local h = hashes[ns] + if not h then + h = rep("#",2^(ns-1)) + hashes[ns] = h + end n = n + 1 if n > 9 then report_macros("number of arguments > 9, ignoring %s",s) - elseif s == "discard" then - top[s] = "" - return h .. "0" else local m = h .. n top[s] = m @@ -96,7 +133,6 @@ local function set(s) end end end -end local function get(s) if s == "ignore" or s == "discard" then @@ -262,7 +298,7 @@ end function macros.convertfile(oldname,newname) -- beware, no testing on oldname == newname local data = loadtexfile(oldname) - data = interfaces.preprocessed(data) or "" -- interfaces not yet defined + data = macros.preprocessed(data) or "" -- interfaces not yet defined savedata(newname,data) end |