aboutsummaryrefslogtreecommitdiff
path: root/arabluatex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'arabluatex.lua')
-rw-r--r--arabluatex.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index d76a284..df23ddc 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -108,6 +108,14 @@ local function indnum(str)
108 return str 108 return str
109end 109end
110 110
111local function takeoutcap(str)
112 str = string.gsub(str, "(\\cap.?)(%b{})", function(tag, body)
113 body = string.sub(body, 2, -2)
114 return string.format("%s", body)
115 end)
116 return str
117end
118
111local function voc(str) 119local function voc(str)
112 str = string.gsub(str, "\\arb(%b{})", function(inside) 120 str = string.gsub(str, "\\arb(%b{})", function(inside)
113 inside = string.sub(inside, 2, -2) 121 inside = string.sub(inside, 2, -2)
@@ -270,6 +278,7 @@ end
270 278
271function processvoc(str) 279function processvoc(str)
272 str = "\\arb{".. str.."}" 280 str = "\\arb{".. str.."}"
281 str = takeoutcap(str)
273 str = protectarb(str) 282 str = protectarb(str)
274 str = breakcmd(str) 283 str = breakcmd(str)
275 str = holdcmd(str) 284 str = holdcmd(str)
@@ -280,6 +289,7 @@ end
280 289
281function processfullvoc(str) 290function processfullvoc(str)
282 str = "\\arb{".. str.."}" 291 str = "\\arb{".. str.."}"
292 str = takeoutcap(str)
283 str = protectarb(str) 293 str = protectarb(str)
284 str = breakcmd(str) 294 str = breakcmd(str)
285 str = holdcmd(str) 295 str = holdcmd(str)
@@ -290,6 +300,7 @@ end
290 300
291function processnovoc(str) 301function processnovoc(str)
292 str = "\\arb{".. str.."}" 302 str = "\\arb{".. str.."}"
303 str = takeoutcap(str)
293 str = protectarb(str) 304 str = protectarb(str)
294 str = breakcmd(str) 305 str = breakcmd(str)
295 str = holdcmd(str) 306 str = holdcmd(str)
@@ -312,6 +323,27 @@ function processtrans(str, mode)
312return str 323return str
313end 324end
314 325
326function cap(str)
327 str = string.gsub(str, "(\\txtrans.?)(%b{})", function(tag, body)
328 body = string.sub(body, 2, -2)
329 return string.format("%s", body)
330 end)
331 if string.find(str, "%-['`ʾʿ]") then
332 str = string.gsub(str, "(%-['`])", "%1\\MakeUppercase ")
333 str = string.gsub(str, "(%-ʿ)", "%1\\MakeUppercase ")
334 str = string.gsub(str, "(%-ʾ)", "%1\\MakeUppercase ")
335 elseif string.find(str, "%-[^'`ʾʿ]") then
336 str = string.gsub(str, "(%-)", "%1\\MakeUppercase ")
337 elseif string.find(str, "^['`ʾʿ]") then
338 str = string.gsub(str, "^(['`])", "%1\\MakeUppercase ")
339 str = string.gsub(str, "^(ʿ)", "%1\\MakeUppercase ")
340 str = string.gsub(str, "^(ʾ)", "%1\\MakeUppercase ")
341 else
342 str = "\\MakeUppercase "..str
343 end
344return str
345end
346
315--print(processvoc("'at_A .sadIquN 'il_A ju.hA ya.tlubu min-hu .himAra-hu li-yarkiba-hu fI safraTiN qa.sIraTiN wa-qAla la-hu sawfa 'u`Idu-hu 'ilay-ka fI 'l-masA'i wa-'adfa`u la-ka 'ujraTaN 'at_A .sadIquN 'il_A ju.hA ya.tlubu min-hu .himAra-hu li-yarkiba-hu fI safraTiN qa.sIraTiN wa-qAla la-hu sawfa 'u`Idu-hu 'ilay-ka fI 'l-masA'i wa-'adfa`u la-ka 'ujraTaN")) 347--print(processvoc("'at_A .sadIquN 'il_A ju.hA ya.tlubu min-hu .himAra-hu li-yarkiba-hu fI safraTiN qa.sIraTiN wa-qAla la-hu sawfa 'u`Idu-hu 'ilay-ka fI 'l-masA'i wa-'adfa`u la-ka 'ujraTaN 'at_A .sadIquN 'il_A ju.hA ya.tlubu min-hu .himAra-hu li-yarkiba-hu fI safraTiN qa.sIraTiN wa-qAla la-hu sawfa 'u`Idu-hu 'ilay-ka fI 'l-masA'i wa-'adfa`u la-ka 'ujraTaN"))
316--print(arbnum("bop 0123456789")) 348--print(arbnum("bop 0123456789"))
317--print(processvoc("daxala \\arb[novoc]{mubtasimaN}")) 349--print(processvoc("daxala \\arb[novoc]{mubtasimaN}"))