summaryrefslogtreecommitdiff
path: root/tex/context/base/typo-cap.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-01-12 12:20:15 +0200
committerMarius <mariausol@gmail.com>2012-01-12 12:20:15 +0200
commit84d94e9754958d12711a8f07086a3d815d305d40 (patch)
treec84c7ab0812e5506873b5f51b1225fe278eb8e3f /tex/context/base/typo-cap.lua
parentb7617f4f872bb6559addb5ee5fed28f06288a59a (diff)
downloadcontext-84d94e9754958d12711a8f07086a3d815d305d40.tar.gz
beta 2012.01.12 11:03
Diffstat (limited to 'tex/context/base/typo-cap.lua')
-rw-r--r--tex/context/base/typo-cap.lua41
1 files changed, 29 insertions, 12 deletions
diff --git a/tex/context/base/typo-cap.lua b/tex/context/base/typo-cap.lua
index 2e20a95e7..3d70ffbfd 100644
--- a/tex/context/base/typo-cap.lua
+++ b/tex/context/base/typo-cap.lua
@@ -4,7 +4,7 @@ if not modules then modules = { } end modules ['typo-cap'] = {
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
-}
+ }
local next, type = next, type
local format, insert = string.format, table.insert
@@ -23,6 +23,7 @@ local traverse_id = node.traverse_id
local copy_node = node.copy
local texattribute = tex.attribute
+local unsetvalue = attributes.unsetvalue
local nodecodes = nodes.nodecodes
local skipcodes = nodes.skipcodes
@@ -40,6 +41,8 @@ local fonthashes = fonts.hashes
local fontdata = fonthashes.identifiers
local fontchar = fonthashes.characters
+local v_reset = interfaces.variables.reset
+
local chardata = characters.data
typesetters = typesetters or { }
@@ -257,19 +260,29 @@ end
local m, enabled = 0, false -- a trick to make neighbouring ranges work
function cases.set(n)
- if not enabled then
- tasks.enableaction("processors","typesetters.cases.handler")
- if trace_casing then
- report_casing("enabling case handler")
- end
- enabled = true
- end
- if m == 100 then
- m = 1
+ if n == v_reset then
+ n = unsetvalue
else
- m = m + 1
+ n = tonumber(n)
+ if n then
+ if not enabled then
+ tasks.enableaction("processors","typesetters.cases.handler")
+ if trace_casing then
+ report_casing("enabling case handler")
+ end
+ enabled = true
+ end
+ if m == 100 then
+ m = 1
+ else
+ m = m + 1
+ end
+ n = m * 100 + n
+ else
+ n = unsetvalue
+ end
end
- texattribute[a_cases] = m * 100 + n
+ texattribute[a_cases] = n
end
cases.handler = nodes.installattributehandler {
@@ -277,3 +290,7 @@ cases.handler = nodes.installattributehandler {
namespace = cases,
processor = process,
}
+
+-- interface
+
+commands.setcharactercasing = cases.set