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
19local ctx_type = context.type
20
21function moduledata.languages.system.loadinstalled()
22 context.start()
23 for k, v in sortedhash(registered) do
24 context.language{ k }
25 end
26 context.stop()
27end
28
29function moduledata.languages.system.showinstalled()
30
31 context.starttabulate { "|l|p(8em)|r|l|l|r|p|" }
32 context.FL()
33 ctx_NC() ctx_bold("tag")
34 ctx_NC() ctx_bold("synonyms")
35 ctx_NC() ctx_bold("id")
36 ctx_NC() ctx_bold("parent")
37 ctx_NC() ctx_bold("file")
38 ctx_NC() ctx_bold("patterns")
39 ctx_NC() ctx_bold("characters")
40 ctx_NC() ctx_NR()
41 context.FL()
42 for k, v in sortedhash(registered) do
43 local parent = v.parent
44 local resources = v.resources and v.resources[1]
45 local patterns = resources and resources.patterns
46 ctx_NC()
47
48
49
50 context(k)
51
52 ctx_NC()
53 for k, v in sortedhash(v.synonyms) do
54
55
56
57 context(k)
58
59 context.par()
60 end
61 ctx_NC()
62 context(v.number)
63 ctx_NC()
64 context(parent)
65 ctx_NC()
66 context(v.patterns)
67 if patterns then
68 ctx_NC() context(patterns.n)
69 ctx_NC() context("% t",utf.split(patterns.characters))
70 else
71 ctx_NC()
72 ctx_NC()
73 end
74 ctx_NC() ctx_NR()
75 end
76 context.LL()
77 context.stoptabulate()
78
79end
80 |