aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2016-12-21 15:34:21 +0100
committerRobert Alessi <alessi@robertalessi.net>2016-12-21 15:34:21 +0100
commit7f5715d693dc4563c2c24be534069d4263c253bc (patch)
tree17af6b90a0a37acc296257025fe49d0af7cfc6f6
parentc500441328f7e1e2fea9d6a7760376a0578409fb (diff)
downloadarabluatex-7f5715d693dc4563c2c24be534069d4263c253bc.tar.gz
starting to work on \arbnull to put back on contextual analysis in case it is broken by TeX commands
-rw-r--r--arabluatex.lua16
-rw-r--r--arabluatex_trans.lua12
-rw-r--r--arabluatex_voc.lua1
3 files changed, 26 insertions, 3 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index 07968c0..527be3b 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -128,6 +128,21 @@ local function indnum(str)
128 return str 128 return str
129end 129end
130 130
131local function processarbnull(str, scheme)
132 if scheme == "buckwalter" then
133 str = string.gsub(str, "(\\arbnull.?)(%b{})", function(tag, body)
134 body = string.sub(body, 2, -2)
135 return string.format("P%sP", body)
136 end)
137 else
138 str = string.gsub(str, "(\\arbnull.?)(%b{})", function(tag, body)
139 body = string.sub(body, 2, -2)
140 return string.format("o%so", body)
141 end)
142 end
143 return str
144end
145
131local function takeoutabjad(str) 146local function takeoutabjad(str)
132 str = string.gsub(str, "(\\abjad.?)(%b{})", function(tag, body) 147 str = string.gsub(str, "(\\abjad.?)(%b{})", function(tag, body)
133 body = string.sub(body, 2, -2) 148 body = string.sub(body, 2, -2)
@@ -543,6 +558,7 @@ end
543 558
544function processtrans(str, mode, rules, scheme) 559function processtrans(str, mode, rules, scheme)
545 str = "\\arb{".. str.."}" 560 str = "\\arb{".. str.."}"
561 str = processarbnull(str, scheme)
546 str = takeoutabjad(str) 562 str = takeoutabjad(str)
547 str = protectarb(str) 563 str = protectarb(str)
548 str = breakcmd(str) 564 str = breakcmd(str)
diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua
index ef55a2b..bc44229 100644
--- a/arabluatex_trans.lua
+++ b/arabluatex_trans.lua
@@ -30,7 +30,8 @@ punctuationtr = {
30} 30}
31 31
32nulltr = { 32nulltr = {
33 {a="%|", b=""} 33 {a="%|", b=""},
34 {a="o.-o", b=""}
34} 35}
35 36
36-- cap 37-- cap
@@ -95,7 +96,11 @@ hamzatrdmg = {
95 {a="(A)(')(i)", b="%1ʾ%3"}, -- historic madda 96 {a="(A)(')(i)", b="%1ʾ%3"}, -- historic madda
96 {a="(A)(')", b="%1ʾ"}, -- historic madda 97 {a="(A)(')", b="%1ʾ"}, -- historic madda
97 -- initial (needs both ^ and %W patterns) 98 -- initial (needs both ^ and %W patterns)
98 -- 'aw: the diphthong is to be resoved into 'awi' (next 4 lines) 99 -- 'aw: the diphthong is to be resolved into 'awi' (next 8 lines)
100 {a="^('aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)(.-o)", b="%1i"},
101 {a="(%W)('aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)(.-o)", b="%1%2i"},
102 {a="^('aw)(o)([%(%[%|%<]?\"?[uai])(.-o)", b="%1i"},
103 {a="(%W)('aw)(o)([%(%[%|%<]?\"?[uai])(.-o)", b="%1%2i"},
99 {a="^('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"}, 104 {a="^('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"},
100 {a="(%W)('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1%2i%3%4"}, 105 {a="(%W)('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1%2i%3%4"},
101 {a="^('aw)(%s)([%(%[%|%<]?\"?[uai])", b="%1i%2%3"}, 106 {a="^('aw)(%s)([%(%[%|%<]?\"?[uai])", b="%1i%2%3"},
@@ -229,7 +234,8 @@ trigraphstrdmg = { -- trigraphs or more
229 234
230idghamtrdmg = { 235idghamtrdmg = {
231 -- assimilations 236 -- assimilations
232 {a="(n)(}?)(%s)([rlmnwy])", b="%4%2%3%4"} 237 {a="(n)(}?)(%s)([rlmnwy])", b="%4%2%3%4"},
238 {a="(n)(o)([rlmnwy])(.-o)", b="%3"}
233} 239}
234 240
235digraphstrdmg = { 241digraphstrdmg = {
diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua
index 02c3feb..c856818 100644
--- a/arabluatex_voc.lua
+++ b/arabluatex_voc.lua
@@ -161,6 +161,7 @@ buckwalter = {
161 {a="F", b="aN"}, 161 {a="F", b="aN"},
162 {a="K", b="iN"}, 162 {a="K", b="iN"},
163 {a="o", b="\""}, 163 {a="o", b="\""},
164 {a="P", b="o"}, -- pass on to \arbnull
164 -- hard-coded connective alif 165 -- hard-coded connective alif
165 {a="%[", b="ٱ"}, 166 {a="%[", b="ٱ"},
166 {a="L", b="ٱ"} -- BW safe 167 {a="L", b="ٱ"} -- BW safe