summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-languages-counters.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
commit8d8d528d2ad52599f11250cfc567fea4f37f2a8b (patch)
tree94286bc131ef7d994f9432febaf03fe23d10eef8 /tex/context/modules/mkiv/s-languages-counters.lua
parentf5aed2e51223c36c84c5f25a6cad238b2af59087 (diff)
downloadcontext-8d8d528d2ad52599f11250cfc567fea4f37f2a8b.tar.gz
2016-01-12 16:26:00
Diffstat (limited to 'tex/context/modules/mkiv/s-languages-counters.lua')
-rw-r--r--tex/context/modules/mkiv/s-languages-counters.lua52
1 files changed, 52 insertions, 0 deletions
diff --git a/tex/context/modules/mkiv/s-languages-counters.lua b/tex/context/modules/mkiv/s-languages-counters.lua
new file mode 100644
index 000000000..436e64a64
--- /dev/null
+++ b/tex/context/modules/mkiv/s-languages-counters.lua
@@ -0,0 +1,52 @@
+if not modules then modules = { } end modules ['s-languages-counters'] = {
+ version = 1.001,
+ comment = "companion to s-languages-counters.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+moduledata.languages = moduledata.languages or { }
+moduledata.languages.counters = moduledata.languages.counters or { }
+
+local data = converters.verbose.data
+
+function moduledata.languages.counters.showverbose(specification)
+ specification = interfaces.checkedspecification(specification)
+ local list = utilities.parsers.settings_to_array(specification.language or "")
+ if #list == 0then
+ return
+ end
+ local used = { }
+ local words = { }
+ for i=1,#list do
+ local ai = list[i]
+ local di = data[ai]
+ if di and di.words then
+ used[#used+1] = ai
+ table.merge(words,di.words)
+ end
+ end
+ context.starttabulate { string.rep("|l",#used) .. "|r|" }
+ context.HL()
+ context.NC()
+ for i=1,#used do
+ context.bold(used[i])
+ context.NC()
+ end
+ context.bold("number")
+ context.NC()
+ context.NR()
+ context.HL()
+ for k, v in table.sortedhash(words) do
+ context.NC()
+ for i=1,#used do
+ context(data[used[i]].words[k] or "")
+ context.NC()
+ end
+ context(k)
+ context.NC()
+ context.NR()
+ end
+ context.stoptabulate()
+end