summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/typo-cln.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/typo-cln.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/typo-cln.lua34
1 files changed, 18 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/context/base/typo-cln.lua b/Master/texmf-dist/tex/context/base/typo-cln.lua
index be00ac10df1..8b1ac78768d 100644
--- a/Master/texmf-dist/tex/context/base/typo-cln.lua
+++ b/Master/texmf-dist/tex/context/base/typo-cln.lua
@@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['typo-cln'] = {
}
-- This quick and dirty hack took less time than listening to a CD (In
--- this case Dream Theaters' Octavium. Of course extensions will take
+-- this case Dream Theaters' Octavium). Of course extensions will take
-- more time.
local utfbyte = utf.byte
@@ -26,9 +26,17 @@ local variables = interfaces.variables
local nodecodes = nodes.nodecodes
local tasks = nodes.tasks
-local texattribute = tex.attribute
+local texsetattribute = tex.setattribute
-local traverse_id = node.traverse_id
+local nuts = nodes.nuts
+local tonut = nuts.tonut
+
+local setfield = nuts.setfield
+local getchar = nuts.getchar
+local getattr = nuts.getattr
+local setattr = nuts.setattr
+
+local traverse_id = nuts.traverse_id
local unsetvalue = attributes.unsetvalue
@@ -46,20 +54,20 @@ local resetter = { -- this will become an entry in char-def
-- the other hand we might want to apply casing afterwards. So,
-- cleaning comes first.
-local function process(namespace,attribute,head)
+function cleaners.handler(head)
local inline, done = false, false
- for n in traverse_id(glyph_code,head) do
- local char = n.char
+ for n in traverse_id(glyph_code,tonut(head)) do
+ local char = getchar(n)
if resetter[char] then
inline = false
elseif not inline then
- local a = n[attribute]
+ local a = getattr(n,a_cleaner)
if a == 1 then -- currently only one cleaner so no need to be fancy
local upper = uccodes[char]
if type(upper) == "table" then
-- some day, not much change that \SS ends up here
else
- n.char = upper
+ setfield(n,"char",upper)
done = true
if trace_autocase then
report_autocase("")
@@ -78,7 +86,7 @@ local enabled = false
function cleaners.set(n)
if n == variables.reset or not tonumber(n) or n == 0 then
- texattribute[a_cleaner] = unsetvalue
+ texsetattribute(a_cleaner,unsetvalue)
else
if not enabled then
tasks.enableaction("processors","typesetters.cleaners.handler")
@@ -87,16 +95,10 @@ function cleaners.set(n)
end
enabled = true
end
- texattribute[a_cleaner] = n
+ texsetattribute(a_cleaner,n)
end
end
-cleaners.handler = nodes.installattributehandler {
- name = "cleaner",
- namespace = cleaners,
- processor = process,
-}
-
-- interface
commands.setcharactercleaning = cleaners.set