aboutsummaryrefslogtreecommitdiff
path: root/arabluatex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'arabluatex.lua')
-rw-r--r--arabluatex.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index b716bea..d76a284 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -236,6 +236,38 @@ local function transdmg(str)
236return str 236return str
237end 237end
238 238
239local function transloc(str)
240 str = string.gsub(str, "\\arb(%b{})", function(inside)
241 inside = string.sub(inside, 2, -2)
242 for i = 1,#hamzatrloc do
243 inside = string.gsub(inside, hamzatrloc[i].a, hamzatrloc[i].b)
244 end
245 for i = 1,#tanwintrloc do
246 inside = string.gsub(inside, tanwintrloc[i].a, tanwintrloc[i].b)
247 end
248 for i = 1,#trigraphstrloc do
249 inside = string.gsub(inside, trigraphstrloc[i].a, trigraphstrloc[i].b)
250 end
251 for i = 1,#digraphstrloc do
252 inside = string.gsub(inside, digraphstrloc[i].a, digraphstrloc[i].b)
253 end
254 for i = 1,#singletrloc do
255 inside = string.gsub(inside, singletrloc[i].a, singletrloc[i].b)
256 end
257 for i = 1,#longvtrloc do
258 inside = string.gsub(inside, longvtrloc[i].a, longvtrloc[i].b)
259 end
260 for i = 1,#shortvtrloc do
261 inside = string.gsub(inside, shortvtrloc[i].a, shortvtrloc[i].b)
262 end
263 for i = 1,#finaltrloc do
264 inside = string.gsub(inside, finaltrloc[i].a, finaltrloc[i].b)
265 end
266 return string.format("\\txtrans{%s}", inside)
267 end)
268return str
269end
270
239function processvoc(str) 271function processvoc(str)
240 str = "\\arb{".. str.."}" 272 str = "\\arb{".. str.."}"
241 str = protectarb(str) 273 str = protectarb(str)
@@ -273,6 +305,8 @@ function processtrans(str, mode)
273 str = holdcmd(str) 305 str = holdcmd(str)
274 if mode == "dmg" then 306 if mode == "dmg" then
275 str = transdmg(str) 307 str = transdmg(str)
308 elseif mode == "loc" then
309 str = transloc(str)
276 else end 310 else end
277 str = unprotectarb(str) 311 str = unprotectarb(str)
278return str 312return str