1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31\writestatus{loading}{ConTeXt Language Macros Initialization}
32
33\registerctxluafile{langdis}{autosuffix}
34\registerctxluafile{langhyp}{autosuffix}
35
36\unprotect
37
38\definesystemattribute[hyphenation][public]
39
40
41
42
43
44
45
46\newcount\compoundhyphenpenalty
47
48\ifcase\contextlmtxmode
49 \hyphenpenaltymode\plusfour
50 \automatichyphenmode\plusone
51\fi
52
53\hyphenpenalty 50
54\automatichyphenpenalty 50
55\explicithyphenpenalty 50
56\compoundhyphenpenalty 50
57\exceptionpenalty 1000
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79\installcorenamespace{hyphenation}
80\installcorenamespace{hyphenationfeatures}
81
82\installparameterhandler \??hyphenation {hyphenation}
83\installsetuphandler \??hyphenation {hyphenation}
84
85\setuphyphenation
86 [\c!method=\s!default,
87 \s!righthyphenchar=0,
88 \s!lefthyphenchar=0]
89
90\appendtoks
91 \clf_sethyphenationmethod{\hyphenationparameter\c!method}
92\to \everysetuphyphenation
93
94
95
96\unexpanded\def\starthyphenation[#1]
97 {\begingroup
98 \clf_pushhyphenation{#1}}
99
100\unexpanded\def\stophyphenation
101 {\ifhmode\par\fi
102 \clf_pophyphenation
103 \endgroup}
104
105
106
107
108
109
110
111
112\unexpanded\def\definehyphenationfeatures
113 {\dodoubleargument\lang_hyphenation_define_features}
114
115\unexpanded\def\lang_hyphenation_define_features[#1][#2]
116 {\begingroup
117 \letdummyparameter\c!characters\empty
118 \letdummyparameter\c!hyphens\empty
119 \letdummyparameter\c!joiners\empty
120 \letdummyparameter\c!rightwords\zerocount
121 \letdummyparameter\s!lefthyphenmin\zerocount
122 \letdummyparameter\s!righthyphenmin\zerocount
123 \letdummyparameter\s!hyphenmin\zerocount
124 \letdummyparameter\s!lefthyphenchar\zerocount
125 \letdummyparameter\s!righthyphenchar\zerocount
126 \letdummyparameter\c!alternative\empty
127 \letdummyparameter\c!rightedge\empty
128 \letdummyparameter\c!rightchars\empty
129 \getdummyparameters[#2]
130 \clf_definehyphenationfeatures
131 {#1}
132 {
133 characters {\dummyparameter\c!characters}
134 hyphens {\dummyparameter\c!hyphens}
135 joiners {\dummyparameter\c!joiners}
136 rightwordmin \numexpr\dummyparameter\c!rightwords\relax
137 rightchars {\dummyparameter\c!rightchars}
138 charmin \numexpr\dummyparameter\s!hyphenmin\relax
139 leftcharmin \numexpr\dummyparameter\s!lefthyphenmin\relax
140 rightcharmin \numexpr\dummyparameter\s!righthyphenmin\relax
141 leftchar \numexpr\dummyparameter\s!lefthyphenchar\relax
142 rightchar \numexpr\dummyparameter\s!righthyphenchar\relax
143 alternative {\dummyparameter\c!alternative}
144rightedge {\dummyparameter\c!rightedge}
145
146
147 }
148 \relax
149 \endgroup}
150
151\unexpanded\def\sethyphenationfeatures[#1]
152 {\clf_sethyphenationfeatures{#1}}
153
154\unexpanded\def\resethyphenationfeatures
155 {\attribute\hyphenationattribute\attributeunsetvalue}
156
157\resethyphenationfeatures
158
159
160
161\unexpanded\def\registerhyphenationpattern
162 {\dodoubleempty\lang_hyphenation_register_pattern}
163
164\def\lang_hyphenation_register_pattern[#1][#2]
165 {\clf_registerhyphenationpattern\ifsecondargument{#1}{#2}\else{\currentlanguage}{#1}\fi\s!true\relax}
166
167\unexpanded\def\unregisterhyphenationpattern
168 {\dodoubleempty\lang_hyphenation_unregister_pattern}
169
170\def\lang_hyphenation_unregister_pattern[#1][#2]
171 {\clf_registerhyphenationpattern\ifsecondargument{#1}{#2}\else{\currentlanguage}{#1}\fi\s!false\relax}
172
173\unexpanded\def\registerhyphenationexception
174 {\dodoubleempty\lang_hyphenation_register_exception}
175
176\def\lang_hyphenation_register_exception[#1][#2]
177 {\clf_registerhyphenationexception\ifsecondargument{#1}{#2}\else{\currentlanguage}{#1}\fi\relax}
178
179\unexpanded\def\showhyphenationtrace
180 {\dodoubleempty\lang_hyphenation_show_trace}
181
182\def\lang_hyphenation_show_trace[#1][#2]
183 {\begingroup
184 \tt
185 \clf_showhyphenationtrace\ifsecondargument{#1}{#2}\else{\currentlanguage}{#1}\fi\relax
186 \endgroup}
187
188
189
190\unexpanded\def\atleastoneword#1
191 {\begingroup
192 \starthyphenation[traditional]
193 \sethyphenationfeatures[words]
194 #1\par
195 \stophyphenation
196 \endgroup}
197
198
199
200\unexpanded\def\showdiscretionaries
201 {\clf_showdiscretionaries}
202
203
204
205\definehyphenationfeatures
206 [fences]
207 [\c!characters={[]()}]
208
209\definehyphenationfeatures
210 [words]
211 [\c!rightwords=1,
212 \s!lefthyphenmin=4,
213 \s!righthyphenmin=4]
214
215\definehyphenationfeatures
216 [default]
217 [
218 \c!hyphens=\v!yes,
219 \c!joiners=\v!yes]
220
221\definehyphenationfeatures
222 [strict]
223 [\c!rightedge=\s!tex]
224
225
226
227
228
229
230
231
232
233
234\protect \endinput
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295 |