diff options
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua | 435 |
1 files changed, 277 insertions, 158 deletions
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua index 719e1e0856c..0bb475640ca 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua @@ -134,202 +134,317 @@ end local function voc(str) str = string.gsub(str, "\\arb(%b{})", function(inside) inside = string.sub(inside, 2, -2) - for i = 1,#hamza do - inside = string.gsub(inside, hamza[i].a, hamza[i].b) - end - for i = 1,#tanwin do - inside = string.gsub(inside, tanwin[i].a, tanwin[i].b) - end - for i = 1,#trigraphs do - inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b) - end - for i = 1,#digraphs do - inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) - end - for i = 1,#single do - inside = string.gsub(inside, single[i].a, single[i].b) - end - for i = 1,#longv do - inside = string.gsub(inside, longv[i].a, longv[i].b) - end - for i = 1,#shortv do - inside = string.gsub(inside, shortv[i].a, shortv[i].b) - end - for i = 1,#punctuation do - inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) - end - for i = 1,#null do - inside = string.gsub(inside, null[i].a, null[i].b) - end - inside = indnum(inside) - return string.format("\\txarb{%s}", inside) - end) + for i = 1,#hamza do + inside = string.gsub(inside, hamza[i].a, hamza[i].b) + end + for i = 1,#tanwin do + inside = string.gsub(inside, tanwin[i].a, tanwin[i].b) + end + for i = 1,#trigraphs do + inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b) + end + for i = 1,#digraphs do + inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) + end + for i = 1,#single do + inside = string.gsub(inside, single[i].a, single[i].b) + end + for i = 1,#longv do + inside = string.gsub(inside, longv[i].a, longv[i].b) + end + for i = 1,#shortv do + inside = string.gsub(inside, shortv[i].a, shortv[i].b) + end + for i = 1,#punctuation do + inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) + end + for i = 1,#null do + inside = string.gsub(inside, null[i].a, null[i].b) + end + inside = indnum(inside) + return string.format("\\txarb{%s}", inside) + end) +return str +end + +local function voceasy(str) + str = string.gsub(str, "\\arb(%b{})", function(inside) + inside = string.sub(inside, 2, -2) + for i = 1,#hamzaeasy do + inside = string.gsub(inside, hamzaeasy[i].a, hamzaeasy[i].b) + end + for i = 1,#tanwineasy do + inside = string.gsub(inside, tanwineasy[i].a, tanwineasy[i].b) + end + for i = 1,#trigraphseasy do + inside = string.gsub(inside, trigraphseasy[i].a, trigraphseasy[i].b) + end + for i = 1,#digraphs do + inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) + end + for i = 1,#single do + inside = string.gsub(inside, single[i].a, single[i].b) + end + for i = 1,#longv do + inside = string.gsub(inside, longv[i].a, longv[i].b) + end + for i = 1,#shortv do + inside = string.gsub(inside, shortv[i].a, shortv[i].b) + end + for i = 1,#punctuation do + inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) + end + for i = 1,#null do + inside = string.gsub(inside, null[i].a, null[i].b) + end + inside = indnum(inside) + return string.format("\\txarb{%s}", inside) + end) return str end local function fullvoc(str) str = string.gsub(str, "\\arb(%b{})", function(inside) inside = string.sub(inside, 2, -2) - for i = 1,#hamzafv do - inside = string.gsub(inside, hamzafv[i].a, hamzafv[i].b) - end - for i = 1,#tanwinfv do - inside = string.gsub(inside, tanwinfv[i].a, tanwinfv[i].b) - end - for i = 1,#trigraphsfv do - inside = string.gsub(inside, trigraphsfv[i].a, trigraphsfv[i].b) - end - for i = 1,#digraphsfv do - inside = string.gsub(inside, digraphsfv[i].a, digraphsfv[i].b) - end - for i = 1,#singlefv do - inside = string.gsub(inside, singlefv[i].a, singlefv[i].b) - end - for i = 1,#longv do - inside = string.gsub(inside, longv[i].a, longv[i].b) - end - for i = 1,#shortv do - inside = string.gsub(inside, shortv[i].a, shortv[i].b) - end - for i = 1,#punctuation do - inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) - end - for i = 1,#null do - inside = string.gsub(inside, null[i].a, null[i].b) - end - inside = indnum(inside) - return string.format("\\txarb{%s}", inside) - end) + for i = 1,#hamzafv do + inside = string.gsub(inside, hamzafv[i].a, hamzafv[i].b) + end + for i = 1,#tanwinfv do + inside = string.gsub(inside, tanwinfv[i].a, tanwinfv[i].b) + end + for i = 1,#trigraphsfv do + inside = string.gsub(inside, trigraphsfv[i].a, trigraphsfv[i].b) + end + for i = 1,#digraphsfv do + inside = string.gsub(inside, digraphsfv[i].a, digraphsfv[i].b) + end + for i = 1,#singlefv do + inside = string.gsub(inside, singlefv[i].a, singlefv[i].b) + end + for i = 1,#longv do + inside = string.gsub(inside, longv[i].a, longv[i].b) + end + for i = 1,#shortv do + inside = string.gsub(inside, shortv[i].a, shortv[i].b) + end + for i = 1,#punctuation do + inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) + end + for i = 1,#null do + inside = string.gsub(inside, null[i].a, null[i].b) + end + inside = indnum(inside) + return string.format("\\txarb{%s}", inside) + end) +return str +end + +local function fullvoceasy(str) + str = string.gsub(str, "\\arb(%b{})", function(inside) + inside = string.sub(inside, 2, -2) + for i = 1,#hamzafveasy do + inside = string.gsub(inside, hamzafveasy[i].a, hamzafveasy[i].b) + end + for i = 1,#tanwinfveasy do + inside = string.gsub(inside, tanwinfveasy[i].a, tanwinfveasy[i].b) + end + for i = 1,#trigraphsfveasy do + inside = string.gsub(inside, trigraphsfveasy[i].a, trigraphsfveasy[i].b) + end + for i = 1,#digraphsfveasy do + inside = string.gsub(inside, digraphsfveasy[i].a, digraphsfveasy[i].b) + end + for i = 1,#singlefveasy do + inside = string.gsub(inside, singlefveasy[i].a, singlefveasy[i].b) + end + for i = 1,#longv do + inside = string.gsub(inside, longv[i].a, longv[i].b) + end + for i = 1,#shortv do + inside = string.gsub(inside, shortv[i].a, shortv[i].b) + end + for i = 1,#punctuation do + inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) + end + for i = 1,#null do + inside = string.gsub(inside, null[i].a, null[i].b) + end + inside = indnum(inside) + return string.format("\\txarb{%s}", inside) + end) return str end local function novoc(str) str = string.gsub(str, "\\arb(%b{})", function(inside) inside = string.sub(inside, 2, -2) - for i = 1,#hamza do - inside = string.gsub(inside, hamza[i].a, hamza[i].b) - end - for i = 1,#tanwinnv do - inside = string.gsub(inside, tanwinnv[i].a, tanwinnv[i].b) - end - for i = 1,#trigraphsnv do - inside = string.gsub(inside, trigraphsnv[i].a, trigraphsnv[i].b) - end - for i = 1,#digraphs do - inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) - end - for i = 1,#single do - inside = string.gsub(inside, single[i].a, single[i].b) - end - for i = 1,#longvnv do - inside = string.gsub(inside, longvnv[i].a, longvnv[i].b) - end - for i = 1,#shortvnv do - inside = string.gsub(inside, shortvnv[i].a, shortvnv[i].b) - end - for i = 1,#punctuation do - inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) - end - for i = 1,#null do - inside = string.gsub(inside, null[i].a, null[i].b) - end - inside = indnum(inside) - return string.format("\\txarb{%s}", inside) - end) + for i = 1,#hamza do + inside = string.gsub(inside, hamza[i].a, hamza[i].b) + end + for i = 1,#tanwinnv do + inside = string.gsub(inside, tanwinnv[i].a, tanwinnv[i].b) + end + for i = 1,#trigraphsnv do + inside = string.gsub(inside, trigraphsnv[i].a, trigraphsnv[i].b) + end + for i = 1,#digraphs do + inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) + end + for i = 1,#single do + inside = string.gsub(inside, single[i].a, single[i].b) + end + for i = 1,#longvnv do + inside = string.gsub(inside, longvnv[i].a, longvnv[i].b) + end + for i = 1,#shortvnv do + inside = string.gsub(inside, shortvnv[i].a, shortvnv[i].b) + end + for i = 1,#punctuation do + inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) + end + for i = 1,#null do + inside = string.gsub(inside, null[i].a, null[i].b) + end + inside = indnum(inside) + return string.format("\\txarb{%s}", inside) + end) return str end local function transdmg(str) str = string.gsub(str, "\\arb(%b{})", function(inside) inside = string.sub(inside, 2, -2) - for i = 1,#hamzatrdmg do - inside = string.gsub(inside, hamzatrdmg[i].a, hamzatrdmg[i].b) - end - for i = 1,#tanwintrdmg do - inside = string.gsub(inside, tanwintrdmg[i].a, tanwintrdmg[i].b) - end - for i = 1,#trigraphstrdmg do - inside = string.gsub(inside, trigraphstrdmg[i].a, trigraphstrdmg[i].b) - end - for i = 1,#digraphstrdmg do - inside = string.gsub(inside, digraphstrdmg[i].a, digraphstrdmg[i].b) - end - for i = 1,#singletrdmg do - inside = string.gsub(inside, singletrdmg[i].a, singletrdmg[i].b) - end - for i = 1,#longvtrdmg do - inside = string.gsub(inside, longvtrdmg[i].a, longvtrdmg[i].b) - end - for i = 1,#shortvtrdmg do - inside = string.gsub(inside, shortvtrdmg[i].a, shortvtrdmg[i].b) - end - for i = 1,#punctuationtr do - inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) - end - for i = 1,#nulltr do - inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) - end - return string.format("\\txtrans{%s}", inside) - end) + for i = 1,#hamzatrdmg do + inside = string.gsub(inside, hamzatrdmg[i].a, hamzatrdmg[i].b) + end + for i = 1,#tanwintrdmg do + inside = string.gsub(inside, tanwintrdmg[i].a, tanwintrdmg[i].b) + end + for i = 1,#trigraphstrdmg do + inside = string.gsub(inside, trigraphstrdmg[i].a, trigraphstrdmg[i].b) + end + for i = 1,#digraphstrdmg do + inside = string.gsub(inside, digraphstrdmg[i].a, digraphstrdmg[i].b) + end + for i = 1,#singletrdmg do + inside = string.gsub(inside, singletrdmg[i].a, singletrdmg[i].b) + end + for i = 1,#longvtrdmg do + inside = string.gsub(inside, longvtrdmg[i].a, longvtrdmg[i].b) + end + for i = 1,#shortvtrdmg do + inside = string.gsub(inside, shortvtrdmg[i].a, shortvtrdmg[i].b) + end + for i = 1,#punctuationtr do + inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) + end + for i = 1,#nulltr do + inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) + end + return string.format("\\txtrans{%s}", inside) + end) +return str +end + +local function transdmgeasy(str) + str = string.gsub(str, "\\arb(%b{})", function(inside) + inside = string.sub(inside, 2, -2) + for i = 1,#hamzatrdmg do + inside = string.gsub(inside, hamzatrdmg[i].a, hamzatrdmg[i].b) + end + for i = 1,#tanwintrdmg do + inside = string.gsub(inside, tanwintrdmg[i].a, tanwintrdmg[i].b) + end + for i = 1,#trigraphstrdmgeasy do + inside = string.gsub(inside, trigraphstrdmgeasy[i].a, trigraphstrdmgeasy[i].b) + end + for i = 1,#digraphstrdmg do + inside = string.gsub(inside, digraphstrdmg[i].a, digraphstrdmg[i].b) + end + for i = 1,#singletrdmg do + inside = string.gsub(inside, singletrdmg[i].a, singletrdmg[i].b) + end + for i = 1,#longvtrdmg do + inside = string.gsub(inside, longvtrdmg[i].a, longvtrdmg[i].b) + end + for i = 1,#shortvtrdmg do + inside = string.gsub(inside, shortvtrdmg[i].a, shortvtrdmg[i].b) + end + for i = 1,#punctuationtr do + inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) + end + for i = 1,#nulltr do + inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) + end + return string.format("\\txtrans{%s}", inside) + end) return str end local function transloc(str) str = string.gsub(str, "\\arb(%b{})", function(inside) inside = string.sub(inside, 2, -2) - for i = 1,#hamzatrloc do - inside = string.gsub(inside, hamzatrloc[i].a, hamzatrloc[i].b) - end - for i = 1,#tanwintrloc do - inside = string.gsub(inside, tanwintrloc[i].a, tanwintrloc[i].b) - end - for i = 1,#trigraphstrloc do - inside = string.gsub(inside, trigraphstrloc[i].a, trigraphstrloc[i].b) - end - for i = 1,#digraphstrloc do - inside = string.gsub(inside, digraphstrloc[i].a, digraphstrloc[i].b) - end - for i = 1,#singletrloc do - inside = string.gsub(inside, singletrloc[i].a, singletrloc[i].b) - end - for i = 1,#longvtrloc do - inside = string.gsub(inside, longvtrloc[i].a, longvtrloc[i].b) - end - for i = 1,#shortvtrloc do - inside = string.gsub(inside, shortvtrloc[i].a, shortvtrloc[i].b) - end - for i = 1,#finaltrloc do - inside = string.gsub(inside, finaltrloc[i].a, finaltrloc[i].b) - end - for i = 1,#punctuationtr do - inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) - end - for i = 1,#nulltr do - inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) - end - return string.format("\\txtrans{%s}", inside) - end) + for i = 1,#hamzatrloc do + inside = string.gsub(inside, hamzatrloc[i].a, hamzatrloc[i].b) + end + for i = 1,#tanwintrloc do + inside = string.gsub(inside, tanwintrloc[i].a, tanwintrloc[i].b) + end + for i = 1,#trigraphstrloc do + inside = string.gsub(inside, trigraphstrloc[i].a, trigraphstrloc[i].b) + end + for i = 1,#digraphstrloc do + inside = string.gsub(inside, digraphstrloc[i].a, digraphstrloc[i].b) + end + for i = 1,#singletrloc do + inside = string.gsub(inside, singletrloc[i].a, singletrloc[i].b) + end + for i = 1,#longvtrloc do + inside = string.gsub(inside, longvtrloc[i].a, longvtrloc[i].b) + end + for i = 1,#shortvtrloc do + inside = string.gsub(inside, shortvtrloc[i].a, shortvtrloc[i].b) + end + for i = 1,#finaltrloc do + inside = string.gsub(inside, finaltrloc[i].a, finaltrloc[i].b) + end + for i = 1,#punctuationtr do + inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) + end + for i = 1,#nulltr do + inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) + end + return string.format("\\txtrans{%s}", inside) + end) return str end -function processvoc(str) +function processvoc(str, rules) str = "\\arb{".. str.."}" str = takeoutcap(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) - str = voc(str) + if rules == "easy" then + str = voceasy(str) + elseif rules == "dflt" then + str = voc(str) + else end str = unprotectarb(str) return str end -function processfullvoc(str) +function processfullvoc(str, rules) str = "\\arb{".. str.."}" str = takeoutcap(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) - str = fullvoc(str) + if rules == "easy" then + str = fullvoceasy(str) + elseif rules == "dflt" then + str = fullvoc(str) + else end str = unprotectarb(str) return str end @@ -345,14 +460,18 @@ function processnovoc(str) return str end -function processtrans(str, mode) +function processtrans(str, mode, rules) str = "\\arb{".. str.."}" str = takeoutabjad(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) if mode == "dmg" then - str = transdmg(str) + if rules == "easy" then + str = transdmgeasy(str) + elseif rules == "dflt" then + str = transdmg(str) + else end elseif mode == "loc" then str = transloc(str) else end @@ -403,5 +522,5 @@ function abjadify(n) if n >= 1 then abjadnum = abjadnum .. abjad[1][math.floor(n/1)] end - return "\\arb{"..abjadnum.."}" + return "\\arb[novoc]{"..abjadnum.."}" end |