diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/babel.def | 88 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/babel.sty | 5 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/hyphen.cfg | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/luababel.def | 291 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/nil.ldf | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/switch.def | 19 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/test-hyphen-post-wiki.tex | 31 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/txtbabel.def | 1 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/xebabel.def | 30 |
9 files changed, 368 insertions, 101 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index e5c5d8f6ac6..ad0e6d9a70a 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -41,7 +41,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2019/11/14 3.36 Babel common definitions] +\ProvidesFile{babel.def}[2019/12/08 3.37 Babel common definitions] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi @@ -416,7 +416,6 @@ \def\bbl@main@language{#1}% \let\languagename\bbl@main@language \bbl@id@assign - \chardef\localeid\@nameuse{bbl@id@@\languagename}% \bbl@patterns{\languagename}} \def\bbl@beforestart{% \bbl@usehooks{beforestart}{}% @@ -1376,7 +1375,6 @@ % Set name and locale id \def\languagename{#2}% \bbl@id@assign - \chardef\localeid\@nameuse{bbl@id@@\languagename}% \let\bbl@KVP@captions\@nil \let\bbl@KVP@import\@nil \let\bbl@KVP@main\@nil @@ -1438,8 +1436,8 @@ \bbl@read@ini{##1}{basic data}% \bbl@exportkey{chrng}{characters.ranges}{}% \bbl@exportkey{dgnat}{numbers.digits.native}{}% - % \bbl@exportkey{hyphr}{typography.hyphenrules}{}% - % \bbl@exportkey{intsp}{typography.intraspace}{}% + \bbl@exportkey{hyphr}{typography.hyphenrules}{}% + \bbl@exportkey{intsp}{typography.intraspace}{}% \endgroup}% boxed, to avoid extra spaces: {\setbox\z@\hbox{\InputIfFileExists{babel-#2.tex}{}{}}}}% {}% @@ -1483,65 +1481,7 @@ \ifx\bbl@KVP@intraspace\@nil\else % We can override the ini or set \bbl@csarg\edef{intsp@#2}{\bbl@KVP@intraspace}% \fi - \ifcase\bbl@engine\or % lua - \bbl@ifunset{bbl@intsp@\languagename}{}% - {\expandafter\ifx\csname bbl@intsp@\languagename\endcsname\@empty\else - \bbl@xin@{\bbl@cs{sbcp@\languagename}}{Hant,Hans,Jpan,Kore,Kana}% - \ifin@ % cjk - \bbl@cjkintraspace - \directlua{ - Babel = Babel or {} - Babel.locale_props = Babel.locale_props or {} - Babel.locale_props[\the\localeid].linebreak = 'c' - }% - \bbl@exp{\\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}% - \ifx\bbl@KVP@intrapenalty\@nil - \bbl@intrapenalty0\@@ - \fi - \else % sea - \bbl@seaintraspace - \bbl@exp{\\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}% - \directlua{ - Babel = Babel or {} - Babel.sea_ranges = Babel.sea_ranges or {} - Babel.set_chranges('\bbl@cs{sbcp@\languagename}', - '\bbl@cs{chrng@\languagename}') - }% - \ifx\bbl@KVP@intrapenalty\@nil - \bbl@intrapenalty0\@@ - \fi - \fi - \fi - \ifx\bbl@KVP@intrapenalty\@nil\else - \expandafter\bbl@intrapenalty\bbl@KVP@intrapenalty\@@ - \fi}% - \or % xe - \bbl@xin@{\bbl@cs{sbcp@\languagename}}{Thai,Laoo,Khmr}% - \ifin@ % sea (currently ckj not handled) - \bbl@ifunset{bbl@intsp@\languagename}{}% - {\expandafter\ifx\csname bbl@intsp@\languagename\endcsname\@empty\else - \ifx\bbl@KVP@intraspace\@nil - \bbl@exp{% - \\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}% - \fi - \ifx\bbl@KVP@intrapenalty\@nil - \bbl@intrapenalty0\@@ - \fi - \fi - \ifx\bbl@KVP@intraspace\@nil\else % We may override the ini - \expandafter\bbl@intraspace\bbl@KVP@intraspace\@@ - \fi - \ifx\bbl@KVP@intrapenalty\@nil\else - \expandafter\bbl@intrapenalty\bbl@KVP@intrapenalty\@@ - \fi - \ifx\bbl@ispacesize\@undefined - \AtBeginDocument{% - \expandafter\bbl@add - \csname selectfont \endcsname{\bbl@ispacesize}}% - \def\bbl@ispacesize{\bbl@cs{xeisp@\bbl@cs{sbcp@\languagename}}}% - \fi}% - \fi - \fi + \bbl@provide@intraspace % == maparabic == % Native digits, if provided in ini (TeX level, xe and lua) \ifcase\bbl@engine\else @@ -1761,6 +1701,14 @@ \expandafter\bbl@iniline\bbl@line\bbl@iniline \fi \repeat + \bbl@foreach\bbl@renewlist{% + \bbl@ifunset{bbl@renew@##1}{}{\bbl@inisec[##1]\@@}}% + \global\let\bbl@renewlist\@empty + % Ends last section. See \bbl@inisec + \def\bbl@elt##1##2{\bbl@inireader##1=##2\@@}% + \@nameuse{bbl@renew@\bbl@section}% + \global\bbl@csarg\let{renew@\bbl@section}\relax + \@nameuse{bbl@secpost@\bbl@section}% \fi} \def\bbl@iniline#1\bbl@iniline{% \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inipreread}#1\@@}% ] @@ -1770,15 +1718,19 @@ \@nameuse{bbl@renew@\bbl@section}% \global\bbl@csarg\let{renew@\bbl@section}\relax \@nameuse{bbl@secpost@\bbl@section}% ends previous section - \def\bbl@section{#1}% + \def\bbl@section{#1}% starts current section \def\bbl@elt##1##2{% \@namedef{bbl@KVP@#1..##1}{}}% \@nameuse{bbl@renew@#1}% - \@nameuse{bbl@secpre@#1}% starts current section + \@nameuse{bbl@secpre@#1}% pre-section `hook' \bbl@ifunset{bbl@inikv@#1}% {\let\bbl@inireader\bbl@iniskip}% {\bbl@exp{\let\\\bbl@inireader\<bbl@inikv@#1>}}} +\let\bbl@renewlist\@empty \def\bbl@renewinikey#1..#2\@@#3{% + \bbl@ifunset{bbl@renew@#1}% + {\bbl@add@list\bbl@renewlist{#1}}% + {}% \bbl@csarg\bbl@add{renew@#1}{\bbl@elt{#2}{#3}}} \def\bbl@inikv#1=#2\@@{% key=value \bbl@trim@def\bbl@tempa{#1}% @@ -1993,6 +1945,10 @@ \bbl@adjust@layout{\let\list\bbl@NL@list}} \@namedef{bbl@ADJ@layout.lists@on}{% \bbl@adjust@layout{\let\list\bbl@OL@list}} +\@namedef{bbl@ADJ@hyphenation.extra@on}{% + \directlua{ + Babel.linebreaking.add_after(Babel.post_hyphenate_replace) + }} {\def\format{lplain} \ifx\fmtname\format \else diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty index 63c7c01ea66..7c86f368682 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.sty +++ b/Master/texmf-dist/tex/generic/babel/babel.sty @@ -33,7 +33,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{babel}[2019/11/14 3.36 The Babel package] +\ProvidesPackage{babel}[2019/12/08 3.37 The Babel package] \@ifpackagewith{babel}{debug} {\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}% \let\bbl@debug\@firstofone} @@ -235,9 +235,6 @@ if Babel.numbers and Babel.digits_mapped then head = Babel.numbers(head) end - if Babel.fixboxdirs then % Temporary! - head = Babel.fixboxdirs(head) - end if Babel.bidi_enabled then head = Babel.bidi(head, false, dir) end diff --git a/Master/texmf-dist/tex/generic/babel/hyphen.cfg b/Master/texmf-dist/tex/generic/babel/hyphen.cfg index ccb07c9b113..2f4e9738b92 100644 --- a/Master/texmf-dist/tex/generic/babel/hyphen.cfg +++ b/Master/texmf-dist/tex/generic/babel/hyphen.cfg @@ -37,7 +37,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{hyphen.cfg}[2019/11/14 3.36 Babel hyphens] +\ProvidesFile{hyphen.cfg}[2019/12/08 3.37 Babel hyphens] \xdef\bbl@format{\jobname} \ifx\AtBeginDocument\@undefined \def\@empty{} diff --git a/Master/texmf-dist/tex/generic/babel/luababel.def b/Master/texmf-dist/tex/generic/babel/luababel.def index 051009bf80c..c714612faa4 100644 --- a/Master/texmf-dist/tex/generic/babel/luababel.def +++ b/Master/texmf-dist/tex/generic/babel/luababel.def @@ -311,6 +311,21 @@ {\csname bbl@patterns@\bbl@tempa\endcsname\space}% #2}}}% \fi}} +\directlua{ + Babel = Babel or {} + Babel.linebreaking = Babel.linebreaking or {} + Babel.linebreaking.before = {} + Babel.linebreaking.after = {} + Babel.locale = {} % Free to use, indexed with \localeid + function Babel.linebreaking.add_before(func) + tex.print([[\noexpand\csname bbl@luahyphenate\endcsname]]) + table.insert(Babel.linebreaking.before , func) + end + function Babel.linebreaking.add_after(func) + tex.print([[\noexpand\csname bbl@luahyphenate\endcsname]]) + table.insert(Babel.linebreaking.after, func) + end +} \def\bbl@intraspace#1 #2 #3\@@{% \directlua{ Babel = Babel or {} @@ -450,7 +465,17 @@ if Babel.cjk_enabled then Babel.cjk_linebreak(head) end + if Babel.linebreaking.before then + for k, func in ipairs(Babel.linebreaking.before) do + func(head) + end + end lang.hyphenate(head) + if Babel.linebreaking.after then + for k, func in ipairs(Babel.linebreaking.after) do + func(head) + end + end if Babel.sea_enabled then Babel.sea_disc_to_space(head) end @@ -459,6 +484,38 @@ } } \endgroup +\def\bbl@provide@intraspace{% + \bbl@ifunset{bbl@intsp@\languagename}{}% + {\expandafter\ifx\csname bbl@intsp@\languagename\endcsname\@empty\else + \bbl@xin@{\bbl@cs{sbcp@\languagename}}{Hant,Hans,Jpan,Kore,Kana}% + \ifin@ % cjk + \bbl@cjkintraspace + \directlua{ + Babel = Babel or {} + Babel.locale_props = Babel.locale_props or {} + Babel.locale_props[\the\localeid].linebreak = 'c' + }% + \bbl@exp{\\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}% + \ifx\bbl@KVP@intrapenalty\@nil + \bbl@intrapenalty0\@@ + \fi + \else % sea + \bbl@seaintraspace + \bbl@exp{\\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}% + \directlua{ + Babel = Babel or {} + Babel.sea_ranges = Babel.sea_ranges or {} + Babel.set_chranges('\bbl@cs{sbcp@\languagename}', + '\bbl@cs{chrng@\languagename}') + }% + \ifx\bbl@KVP@intrapenalty\@nil + \bbl@intrapenalty0\@@ + \fi + \fi + \fi + \ifx\bbl@KVP@intrapenalty\@nil\else + \expandafter\bbl@intrapenalty\bbl@KVP@intrapenalty\@@ + \fi}} \AddBabelHook{luatex}{loadkernel}{% \begingroup % Reset chars "80-"C0 to category "other", no case mapping: @@ -529,7 +586,7 @@ \def\bbl@nostdfont#1{% \bbl@ifunset{bbl@WFF@\f@family}% {\bbl@csarg\gdef{WFF@\f@family}{}% Flag, to avoid dupl warns - \bbl@warning{The current font is not a babel standard family:\\% + \bbl@infowarn{The current font is not a babel standard family:\\% #1% \fontname\font\\% There is nothing intrinsically wrong with this warning, and\\% @@ -586,7 +643,7 @@ \expandafter\xdef\csname ##1default\endcsname{\f@family}}% {}}% \ifx\bbl@tempa\@empty\else - \bbl@warning{The following fonts are not babel standard families:\\% + \bbl@infowarn{The following fonts are not babel standard families:\\% \bbl@tempa There is nothing intrinsically wrong with it, but\\% 'babel' will no set Script and Language. Consider\\% @@ -670,26 +727,6 @@ \expandafter\addto\csname extras#1\endcsname{% \babel@save\bbl@langfeatures \edef\bbl@langfeatures{#2,}}} -\def\bbl@luafixboxdir{% - \setbox\z@\hbox{\textdir TLT}% - \directlua{ - function Babel.first_dir(head) - for item in node.traverse_id(node.id'dir', head) do - return item - end - return nil - end - if Babel.first_dir(tex.box[0].head) then - function Babel.fixboxdirs(head) - local fd = Babel.first_dir(head) - if fd and fd.dir:sub(1,1) == '-' then - head = node.remove(head, fd) - end - return head - end - end - }} -\AtBeginDocument{\bbl@luafixboxdir} \newcommand\babelcharproperty[1]{% \count@=#1\relax \ifvmode @@ -729,6 +766,216 @@ Babel.Babel.cjk_characters[\the\count@]['c'] = '#1' }} \let\bbl@chprop@lb\bbl@chprop@linebreak +\begingroup +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=14 +\directlua{ + Babel.linebreaking.replacements = {} + + function Babel.str_to_nodes(fn, matches, base) + local n, head, last + if fn == nil then return nil end + for s in string.utfvalues(fn(matches)) do + if base.id == 7 then + base = base.replace + end + n = node.copy(base) + n.char = s + if not head then + head = n + else + last.next = n + end + last = n + end + return head + end + + function Babel.fetch_word(head, funct) + local word_string = '' + local word_nodes = {} + local lang + local item = head + + while item do + + if item.id == 29 + and not(item.char == 124) &% ie, not | + and not(item.char == 61) &% ie, not = + and (item.lang == lang or lang == nil) then + lang = lang or item.lang + word_string = word_string .. unicode.utf8.char(item.char) + word_nodes[#word_nodes+1] = item + + elseif item.id == 7 and item.subtype == 2 then + word_string = word_string .. '=' + word_nodes[#word_nodes+1] = item + + elseif item.id == 7 and item.subtype == 3 then + word_string = word_string .. '|' + word_nodes[#word_nodes+1] = item + + elseif word_string == '' then + &% pass + + else + return word_string, word_nodes, item, lang + end + + item = item.next + end + end + + function Babel.post_hyphenate_replace(head) + local u = unicode.utf8 + local lbkr = Babel.linebreaking.replacements + local word_head = head + + while true do + local w, wn, nw, lang = Babel.fetch_word(word_head) + if not lang then return head end + + if not lbkr[lang] then + break + end + + for k=1, #lbkr[lang] do + local p = lbkr[lang][k].pattern + local r = lbkr[lang][k].replace + + while true do + local matches = { u.match(w, p) } + if #matches < 2 then break end + + local first = table.remove(matches, 1) + local last = table.remove(matches, #matches) + + &% Fix offsets, from bytes to unicode. + first = u.len(w:sub(1, first-1)) + 1 + last = u.len(w:sub(1, last-1)) + + local new &% used when inserting and removing nodes + local changed = 0 + + &% This loop traverses the replace list and takes the + &% corresponding actions + for q = first, last do + local crep = r[q-first+1] + local char_node = wn[q] + local char_base = char_node + + if crep and crep.data then + char_base = wn[crep.data+first-1] + end + + if crep == {} then + break + elseif crep == nil then + changed = changed + 1 + node.remove(head, char_node) + elseif crep and (crep.pre or crep.no or crep.post) then + changed = changed + 1 + d = node.new(7, 0) &% (disc, discretionary) + d.pre = Babel.str_to_nodes(crep.pre, matches, char_base) + d.post = Babel.str_to_nodes(crep.post, matches, char_base) + d.replace = Babel.str_to_nodes(crep.no, matches, char_base) + d.attr = char_base.attr + if crep.pre == nil then &% TeXbook p96 + d.penalty = crep.penalty or tex.hyphenpenalty + else + d.penalty = crep.penalty or tex.exhyphenpenalty + end + head, new = node.insert_before(head, char_node, d) + node.remove(head, char_node) + if q == 1 then + word_head = new + end + elseif crep and crep.string then + changed = changed + 1 + local str = crep.string(matches) + if str == '' then + if q == 1 then + word_head = char_node.next + end + head, new = node.remove(head, char_node) + elseif char_node.id == 29 and u.len(str) == 1 then + char_node.char = string.utfvalue(str) + else + local n + for s in string.utfvalues(str) do + if char_node.id == 7 then + log('Automatic hyphens cannot be replaced, just removed.') + else + n = node.copy(char_base) + end + n.char = s + if q == 1 then + head, new = node.insert_before(head, char_node, n) + word_head = new + else + node.insert_before(head, char_node, n) + end + end + + node.remove(head, char_node) + end &% string length + end &% if char and char.string + end &% for char in match + if changed > 20 then + texio.write('Too many changes. Ignoring the rest.') + elseif changed > 0 then + w, wn, nw = Babel.fetch_word(word_head) + end + + end &% for match + end &% for patterns + word_head = nw + end &% for words + return head + end + + function Babel.capture_func(key, cap) + local ret = "[[" .. cap:gsub('{([0-9])}', "]]..m[%1]..[[") .. "]]" + ret = ret:gsub("%[%[%]%]%.%.", '') + ret = ret:gsub("%.%.%[%[%]%]", '') + return key .. [[=function(m) return ]] .. ret .. [[ end]] + end +} +\catcode`\#=6 +\gdef\babelposthyphenation#1#2#3{&% + \begingroup + \def\babeltempa{\bbl@add@list\babeltempb}&% + \let\babeltempb\@empty + \bbl@foreach{#3}{&% + \bbl@ifsamestring{##1}{remove}&% + {\bbl@add@list\babeltempb{nil}}&% + {\directlua{ + local rep = [[##1]] + rep = rep:gsub( '(no)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub( '(pre)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub( '(post)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) + tex.print([[\string\babeltempa{{]] .. rep .. [[}}]]) + }}}&% + \directlua{ + local lbkr = Babel.linebreaking.replacements + local u = unicode.utf8 + &% Convert pattern: + local patt = string.gsub([[#2]], '%s', '') + if not u.find(patt, '()', nil, true) then + patt = '()' .. patt .. '()' + end + patt = u.gsub(patt, '{(.)}', + function (n) + return '%' .. (tonumber(n) and (tonumber(n)+1) or n) + end) + lbkr[\the\csname l@#1\endcsname] = lbkr[\the\csname l@#1\endcsname] or {} + table.insert(lbkr[\the\csname l@#1\endcsname], + { pattern = patt, replace = { \babeltempb } }) + }&% + \endgroup} +\endgroup \bbl@trace{Redefinitions for bidi layout} \ifx\@eqnnum\@undefined\else \ifx\bbl@attr@dir\@undefined\else diff --git a/Master/texmf-dist/tex/generic/babel/nil.ldf b/Master/texmf-dist/tex/generic/babel/nil.ldf index ebad9980845..22bea26a912 100644 --- a/Master/texmf-dist/tex/generic/babel/nil.ldf +++ b/Master/texmf-dist/tex/generic/babel/nil.ldf @@ -32,7 +32,7 @@ %% extension |.ins|) which are part of the distribution. %% -\ProvidesLanguage{nil}[2019/11/14 3.36 Nil language] +\ProvidesLanguage{nil}[2019/12/08 3.37 Nil language] \LdfInit{nil}{datenil} \ifx\l@nil\@undefined \newlanguage\l@nil diff --git a/Master/texmf-dist/tex/generic/babel/switch.def b/Master/texmf-dist/tex/generic/babel/switch.def index 9cd9ec4abc7..00301e68f37 100644 --- a/Master/texmf-dist/tex/generic/babel/switch.def +++ b/Master/texmf-dist/tex/generic/babel/switch.def @@ -37,7 +37,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{switch.def}[2019/11/14 3.36 Babel switching mechanism] +\ProvidesFile{switch.def}[2019/12/08 3.37 Babel switching mechanism] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi @@ -58,8 +58,8 @@ \countdef\last@language=19 \def\addlanguage{\alloc@9\language\chardef\@cclvi} \fi -\def\bbl@version{3.36} -\def\bbl@date{2019/11/14} +\def\bbl@version{3.37} +\def\bbl@date{2019/12/08} \def\adddialect#1#2{% \global\chardef#1#2\relax \bbl@usehooks{adddialect}{{#1}{#2}}% @@ -133,7 +133,8 @@ Babel.locale_props[\bbl@id@last] = {} }% \fi}% - {}} + {}% + \chardef\localeid\@nameuse{bbl@id@@\languagename}} \expandafter\def\csname selectlanguage \endcsname#1{% \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\tw@\fi \bbl@push@language @@ -204,7 +205,6 @@ \languageshorthands{none}% % set the locale id \bbl@id@assign - \chardef\localeid\@nameuse{bbl@id@@\languagename}% % switch captions, date \ifcase\bbl@select@type \ifhmode @@ -408,6 +408,7 @@ \def\\{^^J(babel) }% \message{\\#1}% \endgroup} + \let\bbl@infowarn\bbl@warning \def\bbl@info#1{% \begingroup \newlinechar=`\^^J @@ -425,6 +426,13 @@ \def\\{\MessageBreak}% \PackageWarning{babel}{#1}% \endgroup} + \def\bbl@infowarn#1{% + \begingroup + \def\\{\MessageBreak}% + \GenericWarning + {(babel) \@spaces\@spaces\@spaces}% + {Package babel Info: #1}% + \endgroup} \def\bbl@info#1{% \begingroup \def\\{\MessageBreak}% @@ -433,6 +441,7 @@ \fi \@ifpackagewith{babel}{silent} {\let\bbl@info\@gobble + \let\bbl@infowarn\@gobble \let\bbl@warning\@gobble} {} \def\bbl@nocaption{\protect\bbl@nocaption@i} diff --git a/Master/texmf-dist/tex/generic/babel/test-hyphen-post-wiki.tex b/Master/texmf-dist/tex/generic/babel/test-hyphen-post-wiki.tex new file mode 100644 index 00000000000..60ecf95fa72 --- /dev/null +++ b/Master/texmf-dist/tex/generic/babel/test-hyphen-post-wiki.tex @@ -0,0 +1,31 @@ +\documentclass{article} + +\usepackage[ngerman]{babel} + +\directlua{ + +Babel.linebreaking.add_after(Babel.post_hyphenate_replace) + +Babel.linebreaking.add_replacement( + 'ngerman', + '([fmtrp])|{1}', + { + nil, + { no = '{1}', pre = '{1}{1}-', post = '', penalty = 150, data = 1 }, + {} + }) + +} + +\begin{document} + +\rightskip5cm + +Auffrisierende Auffrisierendem Auffrisierenden Auffrisierender +Auffrisierendes Auffrisierst Auffrisiert Auffrisierte Auffrisiertem +Auffrisierten Auffrisierter Auffrisiertes Auffrisiertest Auffrisiertet +Auffrisst Auffuhr Aufführbar Aufführbare Aufführbarem Aufführbaren +Aufführbarer Aufführbares Aufführe Auffuhren Aufführen Aufführend +Aufführende Aufführendem Aufführenden Aufführender Aufführendes + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/babel/txtbabel.def b/Master/texmf-dist/tex/generic/babel/txtbabel.def index 6dd43d357d2..88bb8a1f627 100644 --- a/Master/texmf-dist/tex/generic/babel/txtbabel.def +++ b/Master/texmf-dist/tex/generic/babel/txtbabel.def @@ -32,6 +32,7 @@ %% extension |.ins|) which are part of the distribution. %% +\providecommand\bbl@provide@intraspace{} \bbl@trace{Redefinitions for bidi layout} \def\bbl@sspre@caption{% \bbl@exp{\everyhbox{\\\bbl@textdir\bbl@cs{wdir@\bbl@main@language}}}} diff --git a/Master/texmf-dist/tex/generic/babel/xebabel.def b/Master/texmf-dist/tex/generic/babel/xebabel.def index b320a77b07a..9150aadd477 100644 --- a/Master/texmf-dist/tex/generic/babel/xebabel.def +++ b/Master/texmf-dist/tex/generic/babel/xebabel.def @@ -51,6 +51,32 @@ \def\bbl@intrapenalty#1\@@{% \bbl@csarg\gdef{xeipn@\bbl@cs{sbcp@\languagename}}% {\XeTeXlinebreakpenalty #1\relax}} +\def\bbl@provide@intraspace{% + \bbl@xin@{\bbl@cs{sbcp@\languagename}}{Thai,Laoo,Khmr}% + \ifin@ % sea (currently ckj not handled) + \bbl@ifunset{bbl@intsp@\languagename}{}% + {\expandafter\ifx\csname bbl@intsp@\languagename\endcsname\@empty\else + \ifx\bbl@KVP@intraspace\@nil + \bbl@exp{% + \\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}% + \fi + \ifx\bbl@KVP@intrapenalty\@nil + \bbl@intrapenalty0\@@ + \fi + \fi + \ifx\bbl@KVP@intraspace\@nil\else % We may override the ini + \expandafter\bbl@intraspace\bbl@KVP@intraspace\@@ + \fi + \ifx\bbl@KVP@intrapenalty\@nil\else + \expandafter\bbl@intrapenalty\bbl@KVP@intrapenalty\@@ + \fi + \ifx\bbl@ispacesize\@undefined + \AtBeginDocument{% + \expandafter\bbl@add + \csname selectfont \endcsname{\bbl@ispacesize}}% + \def\bbl@ispacesize{\bbl@cs{xeisp@\bbl@cs{sbcp@\languagename}}}% + \fi}% + \fi} \AddBabelHook{xetex}{loadkernel}{% \begingroup % Reset chars "80-"C0 to category "other", no case mapping: @@ -121,7 +147,7 @@ \def\bbl@nostdfont#1{% \bbl@ifunset{bbl@WFF@\f@family}% {\bbl@csarg\gdef{WFF@\f@family}{}% Flag, to avoid dupl warns - \bbl@warning{The current font is not a babel standard family:\\% + \bbl@infowarn{The current font is not a babel standard family:\\% #1% \fontname\font\\% There is nothing intrinsically wrong with this warning, and\\% @@ -178,7 +204,7 @@ \expandafter\xdef\csname ##1default\endcsname{\f@family}}% {}}% \ifx\bbl@tempa\@empty\else - \bbl@warning{The following fonts are not babel standard families:\\% + \bbl@infowarn{The following fonts are not babel standard families:\\% \bbl@tempa There is nothing intrinsically wrong with it, but\\% 'babel' will no set Script and Language. Consider\\% |