1if not modules then modules = { } end modules ['s-languages-system'] = {
2 version = 1.001,
3 comment = "companion to s-languages-system.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9moduledata.languages = moduledata.languages or { }
10moduledata.languages.system = moduledata.languages.system or { }
11
12local NC, NR, HL = context.NC, context.NR, context.HL
13local sortedhash = table.sortedhash
14local registered = languages.registered
15local context = context
16local ctx_NC = context.NC
17local ctx_NR = context.NR
18local ctx_bold = context.bold
19
20function moduledata.languages.system.loadinstalled()
21 context.start()
22 for k, v in sortedhash(registered) do
23 context.language{ k }
24 end
25 context.stop()
26end
27
28function moduledata.languages.system.showinstalled()
29
30 context.starttabulate { "|l|r|l|l|p(7em)|r|p|" }
31 context.FL()
32 ctx_NC() ctx_bold("tag")
33 ctx_NC() ctx_bold("n")
34 ctx_NC() ctx_bold("parent")
35 ctx_NC() ctx_bold("file")
36 ctx_NC() ctx_bold("synonyms")
37 ctx_NC() ctx_bold("patterns")
38 ctx_NC() ctx_bold("characters")
39 ctx_NC() ctx_NR()
40 context.FL()
41 for k, v in sortedhash(registered) do
42 local parent = v.parent
43 local resources = v.resources
44 local patterns = resources and resources.patterns
45 ctx_NC() context(k)
46 ctx_NC() context(v.number)
47 ctx_NC() context(v.parent)
48 ctx_NC() context(v.patterns)
49 ctx_NC() for k, v in sortedhash(v.synonyms) do context("%s\\par",k) end
50 if patterns then
51 ctx_NC() context(patterns.n)
52 ctx_NC() context("% t",utf.split(patterns.characters))
53 else
54 ctx_NC()
55 ctx_NC()
56 end
57 ctx_NC() ctx_NR()
58 end
59 context.LL()
60 context.stoptabulate()
61
62end
63 |