diff options
author | Karl Berry <karl@freefriends.org> | 2017-07-05 21:09:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-07-05 21:09:03 +0000 |
commit | ef1531fb8bdf4a1e28e97cc10e3aacd9228e7d0c (patch) | |
tree | ffb320f47bca9a18c20a5f9436dc0c73f737ad64 /Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua | |
parent | 1481c02c171fb8ab30680dc4f3fbc5b872f2de16 (diff) |
arabluatex (5jul17)
git-svn-id: svn://tug.org/texlive/trunk@44754 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua index 86445887daf..48e59871033 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua @@ -46,7 +46,33 @@ local function unprotectarb(str) return str end +brkcmds = {} + +function mkarbbreak(str) + str = str .."," + str = string.gsub(str, "%s+", "") + local fieldstart = 1 + repeat + local nexti = string.find(str, "%,", fieldstart) + table.insert(brkcmds, string.sub(str, fieldstart, nexti-1)) + fieldstart = nexti +1 + until fieldstart > string.len(str) + return brkcmds +end + local function breakcmd(str) + -- user commands + if next(brkcmds) == nil then + -- nothing to do + else + for i = 1,#brkcmds do + str = string.gsub(str, "\\"..brkcmds[i].."%s?(%b{})", + function(body) + body = string.sub(body, 2, -2) + return string.format("}\\"..brkcmds[i].."{%s}\\arb{", body) + end) + end + end -- process \item[], then \item[] str = string.gsub(str, "\\(item.?)(%b[])", function(tag, body) @@ -73,6 +99,13 @@ local function breakcmd(str) body = string.sub(body, 2, -2) return string.format("}\\%s{%s}\\arb{", tag, body) end) + -- \textcolor + str = string.gsub(str, "\\(textcolor.?)(%b{})(%b{})", + function(tag, bodycolor, bodytext) + bodycolor = string.sub(bodycolor, 2, -2) + bodytext = string.sub(bodytext, 2, -2) + return string.format("}\\%s{%s}{\\arb{%s}}\\arb{", tag, bodycolor, bodytext) + end) -- Footnote str = string.gsub(str, "\\(Footnote.-)(%b{})", function(tag, body) @@ -328,8 +361,14 @@ local function fullvoceasy(str, rules) inside = string.gsub(inside, digraphsfv[i].a, digraphsfv[i].b) end end - for i = 1,#singlefveasy do - inside = string.gsub(inside, singlefveasy[i].a, singlefveasy[i].b) + if rules == "nosukun" then + for i = 1,#singlefveasy do + inside = string.gsub(inside, singlefveasy[i].a, singlefveasy[i].b) + end + else + for i = 1,#singlefv do + inside = string.gsub(inside, singlefv[i].a, singlefv[i].b) + end end for i = 1,#longv do inside = string.gsub(inside, longv[i].a, longv[i].b) |