aboutsummaryrefslogtreecommitdiff
path: root/arabluatex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'arabluatex.lua')
-rw-r--r--arabluatex.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index 956f796..6e5b042 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -29,6 +29,9 @@ require("arabluatex_trans")
29 29
30local function protectarb(str) 30local function protectarb(str)
31 str = string.gsub(str, "(\\arb.?)(%[.-%])(%b{})", "\\@arb%2%3") 31 str = string.gsub(str, "(\\arb.?)(%[.-%])(%b{})", "\\@arb%2%3")
32 str = string.gsub(str, "(\\begin.?)(%b{})(%b[])", "\\@begin%3%2")
33 str = string.gsub(str, "(\\begin.?)(%b{})", "\\@begin%2")
34 str = string.gsub(str, "(\\end.?)(%b{})", "\\@end%2")
32 str = string.gsub(str, "\\par", "\\p@r{}") 35 str = string.gsub(str, "\\par", "\\p@r{}")
33 str = string.gsub(str, "\\@@par", "\\p@r{}") 36 str = string.gsub(str, "\\@@par", "\\p@r{}")
34return str 37return str
@@ -36,11 +39,21 @@ end
36 39
37local function unprotectarb(str) 40local function unprotectarb(str)
38 str = string.gsub(str, "(\\@arb)(%[.-%])(%b{})", "\\arb%2%3") 41 str = string.gsub(str, "(\\@arb)(%[.-%])(%b{})", "\\arb%2%3")
42 str = string.gsub(str, "(\\@begin)(%b[])(%b{})", "\\begin%3%2")
43 str = string.gsub(str, "(\\@begin)(%b{})", "\\begin%2")
44 str = string.gsub(str, "(\\@end)(%b{})", "\\end%2")
39 str = string.gsub(str, "\\p@r{}", "\\par") 45 str = string.gsub(str, "\\p@r{}", "\\par")
40return str 46return str
41end 47end
42 48
43local function breakcmd(str) 49local function breakcmd(str)
50 -- handle \item[], then \item[]
51 str = string.gsub(str, "\\(item.?)(%b[])",
52 function(tag, body)
53 body = string.sub(body, 2, -2)
54 return string.format("}\\item[\\arb{%s}] \\arb{", body)
55 end)
56 str = string.gsub(str, "(\\item)(%s+)", "%1{}%2")
44 -- \edtext 57 -- \edtext
45 str = string.gsub(str, "\\(edtext.-)(%b{})(%b{})", 58 str = string.gsub(str, "\\(edtext.-)(%b{})(%b{})",
46 function(tag, bodylem, bodyvar) 59 function(tag, bodylem, bodyvar)