1
2
3
4
5
6
7
8
9
10
11
12
13
14\registerctxluafile{langurl}{autosuffix}
15
16\unprotect
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44\newtoks\everyhyphenatedurl
45
46\appendtoks
47 \resetfontfeature
48 \resetcharacterspacing
49
50 \enforced\let\&\letterampersand
51 \enforced\let\#\letterhash
52 \enforced\let\~\lettertilde
53 \enforced\let\\\letterbackslash
54 \enforced\let\$\letterdollar
55 \enforced\let\^\letterhat
56 \enforced\let\_\letterunderscore
57 \enforced\let\{\letterleftbrace
58 \enforced\let\}\letterrightbrace
59 \enforced\let\|\letterbar
60
61
62 \enforced\letcharcode\tildeasciicode\lettertilde
63 \enforced\letcharcode\barasciicode \letterbar
64 \enforced\let\Ux\eUx
65\to \everyhyphenatedurl
66
67\mutable\lettonothing\hyphenatedurlseparator
68\mutable\lettonothing\hyphenatedurldiscretionary
69
70\setnewconstant\hyphenatedurllefthyphenmin \plusthree
71\setnewconstant\hyphenatedurlrighthyphenmin\plusthree
72
73\def\lang_url_more{\penalty\plustenthousand\hskip\scratchskipone\penalty\plustenthousand}
74\def\lang_url_less{\penalty\plustenthousand\hskip\scratchskiptwo\penalty\plustenthousand}
75\def\lang_url_trac{\penalty\plustenthousand\hsmash{\darkred\vl}\penalty\plustenthousand}
76
77\def\lang_url_a#1{\lang_url_more\char#1\lang_url_show\discretionary{}{\hyphenatedurlseparator}{}}
78\def\lang_url_b#1{\lang_url_more\discretionary{\hyphenatedurlseparator}{}{}\lang_url_show\char#1\relax}
79\def\lang_url_d {\lang_url_more\discretionary{\lang_url_show}{\lang_url_show}{\lang_url_show}}
80\def\lang_url_l#1{\lang_url_less\char#1\relax}
81\def\lang_url_c#1{\lang_url_more\char#1\relax}
82\def\lang_url_L#1{\lang_url_less\char#1\relax}
83\def\lang_url_C#1{\lang_url_more\char#1\relax}
84
85\permanent\protected\def\showhyphenatedurlbreaks
86 {\let\lang_url_show\lang_url_trac}
87
88\installtextracker
89 {languages.url}
90 {\let\lang_url_show\lang_url_trac}
91 {\let\lang_url_show\relax}
92
93\let\lang_url_show\relax
94
95\permanent\protected\def\sethyphenatedurlnormal#1{\clf_sethyphenatedurlcharacters{#1}{\v!normal}}
96\permanent\protected\def\sethyphenatedurlbefore#1{\clf_sethyphenatedurlcharacters{#1}{\v!before}}
97\permanent\protected\def\sethyphenatedurlafter #1{\clf_sethyphenatedurlcharacters{#1}{\v!after }}
98
99
100
101\permanent\protected\def\hyphenatedurl#1
102 {\dontleavehmode
103 \begingroup
104 \expand\everyhyphenatedurl
105 \normallanguage\zerocount
106 \scratchskipone\zeropoint\s!plus\dimexpr\emwidth12\s!minus\dimexpr\emwidth24\relax
107 \scratchskiptwo\zeropoint\s!plus\dimexpr\emwidth48\s!minus\dimexpr\emwidth96\relax
108 \unprotect
109 \normalexpanded{\noexpand\clf_hyphenatedurl
110 {\noexpand\detokenize{#1}}
111 \hyphenatedurllefthyphenmin
112 \hyphenatedurlrighthyphenmin
113 {\hyphenatedurldiscretionary}
114 }
115 \protect
116 \endgroup}
117
118
119
120
121
122
123
124
125
126
127\ifdefined\hyphenatedfilename \else \aliased\let\hyphenatedfilename\hyphenatedurl \fi
128
129
130
131
132
133
134
135
136
137
138
139
140
141\protect \endinput
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170 |