1if not modules then modules = { } end modules ['lang-exp'] = {
2 version = 1.001,
3 comment = "companion to lang-ini.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
9
10
11
12
13if true then
14 return
15end
16
17
18
19local expanders
20
21
22
23
24
25
26
27
28
29
30
31
32if LUATEXVERSION < 1.005 then
33
34
35
36 expanders = {
37 [discretionary_code] = function(d,template)
38
39 return template
40 end,
41 [explicit_code] = function(d,template)
42
43 local pre, post, replace = getdisc(d)
44 local done = false
45 if pre then
46 local char = isglyph(pre)
47 if char and char <= 0 then
48 done = true
49 flushlist(pre)
50 pre = nil
51 end
52 end
53 if post then
54 local char = isglyph(post)
55 if char and char <= 0 then
56 done = true
57 flushlist(post)
58 post = nil
59 end
60 end
61 if done then
62
63 setdisc(d,pre,post,replace,explicit_code,tex.exhyphenpenalty)
64 else
65 setsubtype(d,explicit_code)
66 end
67 return template
68 end,
69 [automatic_code] = function(d,template)
70 local pre, post, replace = getdisc(d)
71 if pre then
72
73
74 if not template then
75
76 template = getprev(d)
77 if template and getid(template) ~= glyph_code then
78 template = getnext(d)
79 if template and getid(template) ~= glyph_code then
80 template = nil
81 end
82 end
83 end
84 if template then
85 local pseudohead = getprev(template)
86 if pseudohead then
87 while template ~= d do
88 pseudohead, template, removed = remove_node(pseudohead,template)
89
90 replace = removed
91
92 end
93 else
94
95 end
96 setdisc(d,pre,post,replace,automatic_code,tex.hyphenpenalty)
97 else
98
99 end
100 else
101 setdisc(d,pre,post,replace,automatic_code,tex.hyphenpenalty)
102 end
103 return template
104 end,
105 [regular_code] = function(d,template)
106 if check_regular then
107
108 if not template then
109
110 template = getprev(d)
111 if template and getid(template) ~= glyph_code then
112 template = getnext(d)
113 if template and getid(template) ~= glyph_code then
114 template = nil
115 end
116 end
117 end
118 if template then
119 local language = template and getlanguage(template)
120 local data = getlanguagedata(language)
121 local prechar = data.prehyphenchar
122 local postchar = data.posthyphenchar
123 local pre, post, replace = getdisc(d)
124 local done = false
125 if prechar and prechar > 0 then
126 done = true
127 pre = copy_node(template)
128 setchar(pre,prechar)
129 end
130 if postchar and postchar > 0 then
131 done = true
132 post = copy_node(template)
133 setchar(post,postchar)
134 end
135 if done then
136 setdisc(d,pre,post,replace,regular_code,tex.hyphenpenalty)
137 end
138 else
139
140 end
141 return template
142 end
143 end,
144 [disccodes.first] = function()
145
146 end,
147 [disccodes.second] = function()
148
149 end,
150 }
151
152 function languages.expand(d,template,subtype)
153 if not subtype then
154 subtype = getsubtype(d)
155 end
156 if subtype ~= discretionary_code then
157 return expanders[subtype](d,template)
158 end
159 end
160
161else
162
163 function languages.expand()
164
165 end
166
167end
168
169languages.expanders = expanders
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222 |