aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2016-03-04 20:19:39 +0100
committerRobert Alessi <alessi@robertalessi.net>2016-03-04 20:19:39 +0100
commit80a1abe75f85faa204866af06047888dba32a7cc (patch)
tree2f256251dbf6dac0df5f7edc08425d9dac0557ec
parentc14faed02c1789d4bc8d4a0af460c69fd6c863ad (diff)
downloadarabluatex-80a1abe75f85faa204866af06047888dba32a7cc.tar.gz
implementation of basic Arabic punctuation
-rw-r--r--arabluatex.lua15
-rw-r--r--arabluatex_trans.lua5
-rw-r--r--arabluatex_voc.lua13
3 files changed, 33 insertions, 0 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index 80b7aa5..158282d 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -147,6 +147,9 @@ local function voc(str)
147 for i = 1,#shortv do 147 for i = 1,#shortv do
148 inside = string.gsub(inside, shortv[i].a, shortv[i].b) 148 inside = string.gsub(inside, shortv[i].a, shortv[i].b)
149 end 149 end
150 for i = 1,#punctuation do
151 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b)
152 end
150 for i = 1,#null do 153 for i = 1,#null do
151 inside = string.gsub(inside, null[i].a, null[i].b) 154 inside = string.gsub(inside, null[i].a, null[i].b)
152 end 155 end
@@ -180,6 +183,9 @@ local function fullvoc(str)
180 for i = 1,#shortv do 183 for i = 1,#shortv do
181 inside = string.gsub(inside, shortv[i].a, shortv[i].b) 184 inside = string.gsub(inside, shortv[i].a, shortv[i].b)
182 end 185 end
186 for i = 1,#punctuation do
187 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b)
188 end
183 for i = 1,#null do 189 for i = 1,#null do
184 inside = string.gsub(inside, null[i].a, null[i].b) 190 inside = string.gsub(inside, null[i].a, null[i].b)
185 end 191 end
@@ -213,6 +219,9 @@ local function novoc(str)
213 for i = 1,#shortvnv do 219 for i = 1,#shortvnv do
214 inside = string.gsub(inside, shortvnv[i].a, shortvnv[i].b) 220 inside = string.gsub(inside, shortvnv[i].a, shortvnv[i].b)
215 end 221 end
222 for i = 1,#punctuation do
223 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b)
224 end
216 for i = 1,#null do 225 for i = 1,#null do
217 inside = string.gsub(inside, null[i].a, null[i].b) 226 inside = string.gsub(inside, null[i].a, null[i].b)
218 end 227 end
@@ -246,6 +255,9 @@ local function transdmg(str)
246 for i = 1,#shortvtrdmg do 255 for i = 1,#shortvtrdmg do
247 inside = string.gsub(inside, shortvtrdmg[i].a, shortvtrdmg[i].b) 256 inside = string.gsub(inside, shortvtrdmg[i].a, shortvtrdmg[i].b)
248 end 257 end
258 for i = 1,#punctuationtr do
259 inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b)
260 end
249 for i = 1,#nulltr do 261 for i = 1,#nulltr do
250 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) 262 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b)
251 end 263 end
@@ -281,6 +293,9 @@ local function transloc(str)
281 for i = 1,#finaltrloc do 293 for i = 1,#finaltrloc do
282 inside = string.gsub(inside, finaltrloc[i].a, finaltrloc[i].b) 294 inside = string.gsub(inside, finaltrloc[i].a, finaltrloc[i].b)
283 end 295 end
296 for i = 1,#punctuationtr do
297 inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b)
298 end
284 for i = 1,#nulltr do 299 for i = 1,#nulltr do
285 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) 300 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b)
286 end 301 end
diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua
index d253269..fa7c38e 100644
--- a/arabluatex_trans.lua
+++ b/arabluatex_trans.lua
@@ -24,6 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 24
25-- common 25-- common
26 26
27punctuationtr = {
28 {a="%(%(", b="("},
29 {a="%)%)", b=")"}
30}
31
27nulltr = { 32nulltr = {
28 {a="%|", b=""} 33 {a="%|", b=""}
29} 34}
diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua
index 06d266f..f9f251c 100644
--- a/arabluatex_voc.lua
+++ b/arabluatex_voc.lua
@@ -287,6 +287,19 @@ shortv = {
287 {a="i", b="ِ"} 287 {a="i", b="ِ"}
288} 288}
289 289
290punctuation = {
291 {a="%(%(", b="﴿"},
292 {a="%)%)", b="﴾"},
293 {a="%(", b="+@("},
294 {a="%)", b="-@("},
295 {a="%+%@%(", b=")"},
296 {a="%-%@%(", b="("},
297 {a="%.", b="۔"},
298 {a="%,", b="،"},
299 {a="%?", b="؟"},
300 {a="%;", b="؛"},
301}
302
290null = { 303null = {
291 {a="%|", b=""}, 304 {a="%|", b=""},
292 {a="([^0-9])(%-)([^0-9])", b="%1%3"} 305 {a="([^0-9])(%-)([^0-9])", b="%1%3"}