1% engine=luatex 2 3\input test-patterns 4 5% \mainlanguage[sl] 6 7% \righthyphenmin=2% Note quite sure what I'm doing (default is 3) 8\righthyphenmin=1% Even better :-) 9 10\definefont[charis][CharisSILR] 11 12\ctxlua{hyphenations = hyphenations or { }} 13 14\ctxlua{nbwords = 0} 15 16\def\collecthyphenatedwords{% 17 \startluacode 18 local tag = languages.tag 19 20 for _, h in pairs(hyphens) do 21 local w = h:gsub("-", "") 22 if w == "zglob" then 23 texio.write_nl("term and log", "Found zglob") 24 end 25 texio.write_nl("term and log", "w: " .. tostring(w) .. ", h: " .. tostring(h)) 26 if hyphenations[w] then 27 hyphenations[w][tag] = h 28 else 29 nbwords = nbwords + 1 30 texio.write_nl("term and log", "Adding word n° " .. nbwords .. ": " .. w .. " (tag = " .. tag .. ")") 31 hyphenations[w] = { [tag] = h } 32 end 33 end 34 \stopluacode 35} 36 37\starttext 38 39\charis 40 41\lefthyphenmin=1 42 43\define\samplewords{% 44Alek-sandra 45bolan 46član-stvo 47go-spod 48gospodar-ski 49Gradniš-nik 50indu-strijski 51ipav-ski 52istovrsten 53jas-no 54jav-nosti 55kakrš-nikoli 56kak-šen 57kas-neje 58ka-znjenec 59konjski 60krč-mar 61krš-kemu 62kveč-jemu 63la-stnik 64liker-ja 65mo-stov 66mož-gani 67na-mreč 68naprav-ljene 69nem-ški 70ne-sreča 71neum-nosti 72ne-zgod 73peš-nemu 74plod-nih 75pod-uke 76pogum-no 77polje 78polobla 79pooblastilo 80posest-nica 81po-slanstvo 82po-vsem 83pov-sod 84po-vzpeti 85praz-nih 86pred-lagala 87pre-iskovali 88preko-smate 89prerdeč 90pre-strašil 91pre-usmeriti 92pre-vzeti 93proiz-vodnje 94pro-store 95pro-storček 96pu-sta 97raz-red 98razum-ljiv 99razum-nim 100repub-likanski 101res-nica 102revir-jev 103samoupraven 104sestra 105smr-dljiv 106soljo 107so-udeležen 108sov-raštvu 109srbski 110srbščina 111stadion 112stanje 113steb-lica 114strež-nik 115teksta 116tekstilen 117ures-ničeval 118ustvar-jeno 119vero-znanstvo 120vot-ljina 121vzklik-niti 122zapu-stivši 123zarip-li 124za-slišali 125zem-lja 126žanrski 127želez-nica 128živ-ljenje 129mrtav mrtev superior 130zglob 131% Added 2010-08-23, manually 132brezplačen 133potrt 134} 135 136\loadpatterns{sl} 137\comparehyphenation\samplewords 138 139\collecthyphenatedwords 140 141\loadpatterns{hr} 142\comparehyphenation\samplewords 143\collecthyphenatedwords 144 145\loadpatterns{sr-latn} 146\comparehyphenation\samplewords 147\collecthyphenatedwords 148 149\startluacode 150 texio.write_nl("term and log", "hyphenations has " .. table.nentries(hyphenations) .. " elements") 151 texio.write_nl("term and log", table.serialize(hyphenations, "hyphenations")) 152\stopluacode 153 154\setupTABLE[split=yes] 155\bTABLE 156\bTR \bTD sl \eTD \bTD hr \eTD \bTD sr-latn \eTD \eTR 157\startluacode 158 -- for word, hyphs in pairs(hyphenations) do 159 for _, word in ipairs(table.sortedkeys(hyphenations)) do 160 local hyphs = hyphenations[word] 161 tex.print"\\bTR " 162 tex.print"\\bTD " ; tex.print(tostring(hyphs.sl)) ; tex.print"\\eTD " 163 tex.print"\\bTD " ; tex.print(tostring(hyphs.hr)) ; tex.print"\\eTD " 164 tex.print"\\bTD " ; tex.print(tostring(hyphs["sr-latn"])) ; tex.print"\\eTD " 165 tex.print"\\eTR " 166 end 167\stopluacode 168\eTABLE 169 170\loadpatterns{sl} 171 172\collecthyphens{\input krst.tex} 173 174\loadpatterns{cs} 175 176% ne-smy-sl 177% ubrouskem! Even with lhm = rhm = 1 178\collecthyphens{\input RUR.tex} 179 180\collecthyphens{ubrouskem ubrousek ubrousky ubrúskem obrúsok obrúskem} 181 182\loadpatterns{sk} 183\collecthyphens{ubrouskem ubrousek ubrousky ubrúskem obrúsok obrúskem} 184 185\stoptext 186