summaryrefslogtreecommitdiff
path: root/tex/context/base/s-lan-03.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/s-lan-03.mkiv')
-rw-r--r--tex/context/base/s-lan-03.mkiv40
1 files changed, 40 insertions, 0 deletions
diff --git a/tex/context/base/s-lan-03.mkiv b/tex/context/base/s-lan-03.mkiv
new file mode 100644
index 000000000..b8d24539b
--- /dev/null
+++ b/tex/context/base/s-lan-03.mkiv
@@ -0,0 +1,40 @@
+%D \module
+%D [ file=s-lan-03,
+%D version=2010.10.21,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Language Environment 3,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startluacode
+languages.words.tracers = languages.words.tracers or { }
+
+function languages.words.tracers.showwords(filename)
+ filename = filename or file.addsuffix(tex.jobname,"words")
+ if lfs.isfile(filename) then
+ local w = dofile(filename)
+ if w then
+ -- table.print(w)
+ for cname, category in table.sortedpairs(w.categories) do
+ for lname, language in table.sortedpairs(category.languages) do
+ context.bold(string.format("category: %s, language: %s, total: %s, unique: %s:",
+ cname, lname, language.total or 0, language.unique or 0)
+ )
+ for word, n in table.sortedpairs(language.list) do
+ context(" %s (%s)",word,n)
+ end
+ context.par()
+ end
+ end
+ end
+ end
+end
+\stopluacode
+
+% \ctxlua{languages.words.tracers.showwords("words-003.words")}
+