summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/syst-aux.lua
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
commit15995e10bfc68edf79970c4ea4fbb6678566c46e (patch)
tree2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/syst-aux.lua
parentc9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff)
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/syst-aux.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/syst-aux.lua52
1 files changed, 52 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/syst-aux.lua b/Master/texmf-dist/tex/context/base/syst-aux.lua
new file mode 100644
index 00000000000..7fd25d6ab0a
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/syst-aux.lua
@@ -0,0 +1,52 @@
+if not modules then modules = { } end modules ['syst-aux'] = {
+ version = 1.001,
+ comment = "companion to syst-aux.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local settings_to_array = utilities.parsers.settings_to_array
+local concat = table.concat
+
+local setvalue = context.setvalue
+
+function commands.getfirstcharacter(str)
+ local first, rest = utf.match(str,"(.?)(.*)$")
+ setvalue("firstcharacter",first)
+ setvalue("remainingcharacters",rest)
+end
+
+function commands.doiffirstcharelse(chr,str)
+ commands.doifelse(utf.sub(str,1,1) == chr)
+end
+
+-- function commands.addtocommalist(list,item)
+-- if list == "" then
+-- context(item)
+-- else
+-- context("%s,%s",list,item) -- using tex.print is some 10% faster
+-- end
+-- end
+--
+-- function commands.removefromcommalist(list,item)
+-- if list == "" then
+-- context(item)
+-- else
+-- -- okay, using a proper lpeg is probably faster
+-- -- we could also check for #l = 1
+-- local l = settings_to_array(list)
+-- local t, n = { }
+-- for i=1,#l do
+-- if l[i] ~= item then
+-- n = n + 1
+-- t[n] = item
+-- end
+-- end
+-- if n == 0 then
+-- context(item)
+-- else
+-- context(concat(list,","))
+-- end
+-- end
+-- end