aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex.lua48
1 files changed, 13 insertions, 35 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index b8ef9df..c2608c3 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -84,7 +84,6 @@ local albrkcmds = {
84 "Footnote", 84 "Footnote",
85 "Marginpar", 85 "Marginpar",
86 "arbmark", 86 "arbmark",
87 "textcolor",
88 "abjad" 87 "abjad"
89} 88}
90local brkcmds = {} 89local brkcmds = {}
@@ -119,37 +118,25 @@ local function breakcmd(str)
119 end) 118 end)
120 str = string.gsub(str, "(\\item)(%s+)", "%1{}%2") 119 str = string.gsub(str, "(\\item)(%s+)", "%1{}%2")
121 -- \textcolor 120 -- \textcolor
122 -- str = string.gsub(str, "\\(textcolor%s?)(%b{})(%b{})", 121 str = string.gsub(str, "\\(textcolor%s?)(%b{})(%b{})",
123 -- function(tag, bodycolor, bodytext) 122 function(tag, bodycolor, bodytext)
124 -- bodycolor = string.sub(bodycolor, 2, -2) 123 bodycolor = string.sub(bodycolor, 2, -2)
125 -- bodytext = string.sub(bodytext, 2, -2) 124 bodytext = string.sub(bodytext, 2, -2)
126 -- return string.format("\\al@brk{\\%s{%s}{\\arb{%s}}}", tag, bodycolor, bodytext) 125 return string.format("\\al@brk{\\%s{%s}{\\arb{%s}}}", tag, bodycolor, bodytext)
127 -- end) 126 end)
127 -- \arbcolor
128 str = string.gsub(str, "(.)(\\arbcolor%s?)(%b[])(%b{})(.)", 128 str = string.gsub(str, "(.)(\\arbcolor%s?)(%b[])(%b{})(.)",
129 function (li, tag, opt, body, lii) 129 function (li, tag, opt, body, lii)
130 li = string.gsub(li, "%+", "‍") -- ^^^^200d 130 li = string.gsub(li, "%+", "‍") -- ^^^^200d
131 lii = string.gsub(lii, "%+", "‍") -- ^^^^200d 131 lii = string.gsub(lii, "%+", "‍") -- ^^^^200d
132 body = string.sub(body, 2, -2) 132 body = string.sub(body, 2, -2)
133 body = string.gsub(body, "%+", "‍") -- ^^^^200d 133 body = string.gsub(body, "%+", "‍") -- ^^^^200d
134 return string.format("%s%s%s{%s}%s", li, tag, opt, body, lii) 134 return string.format("%s%s%s{%s}%s", li, tag, opt, body, lii)
135 end) 135 end)
136 -- Abjad
137 -- str = string.gsub(str, "\\(abjad%s?)(%b{})",
138 -- function(tag, body)
139 -- body = string.sub(body, 2, -2)
140 -- return string.format("\\al@brk{\\%s{%s}}", tag, body)
141 -- end)
142---[[
143 -- to be taken out of \arb{}, as LR/RL footnotes and the like: 136 -- to be taken out of \arb{}, as LR/RL footnotes and the like:
144 for i = 1,#outofarb do 137 for i = 1,#outofarb do
145 str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, "}%1%2%3\\arb{") 138 str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, "}%1%2%3\\arb{")
146 -- str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * spcenc^-1 * bcbraces,
147 -- function(prefix, tag, body)
148 -- body = string.sub(body, 2, -2)
149 -- return string.format("}%s%s{%s}\\arb{", prefix, tag, body)
150 -- end)
151 end 139 end
152--]]
153 -- commands set by default in albrkcmds 140 -- commands set by default in albrkcmds
154 for i = 1,#albrkcmds do 141 for i = 1,#albrkcmds do
155 str = gsub(str, dblbkslash * lpeg.Cs(albrkcmds[i]) * cmdargs, "\\al@brk{%1%2%3}") 142 str = gsub(str, dblbkslash * lpeg.Cs(albrkcmds[i]) * cmdargs, "\\al@brk{%1%2%3}")
@@ -246,19 +233,10 @@ local function takeoutarb(str)
246 for i = 1,#outofarb do 233 for i = 1,#outofarb do
247 str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, 234 str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs,
248 function(prefix, tag, body) 235 function(prefix, tag, body)
249-- body = string.sub(body, 2, -2)
250 body = gsub(body, lpeg.P("\\arb"), "\\@rb") 236 body = gsub(body, lpeg.P("\\arb"), "\\@rb")
251 return string.format("%s%s%s", prefix, tag, body) 237 return string.format("%s%s%s", prefix, tag, body)
252 end) 238 end)
253 end 239 end
254 -- for i = 1,#outofarb do
255 -- str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * spcenc^-1 * bcbraces,
256 -- function(prefix, tag, body)
257 -- body = string.sub(body, 2, -2)
258 -- body = gsub(body, lpeg.P("\\arb"), "\\@rb")
259 -- return string.format("%s%s{%s}", prefix, tag, body)
260 -- end)
261 -- end
262 str = string.gsub(str, "(\\arb%s?)(%b{})", function(tag, body) 240 str = string.gsub(str, "(\\arb%s?)(%b{})", function(tag, body)
263 body = string.sub(body, 2, -2) 241 body = string.sub(body, 2, -2)
264 return string.format("%s", body) 242 return string.format("%s", body)