diff options
Diffstat (limited to 'arabluatex.lua')
-rw-r--r-- | arabluatex.lua | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/arabluatex.lua b/arabluatex.lua index 087ee82..76d61b3 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |||
23 | --]] | 23 | --]] |
24 | 24 | ||
25 | require("arabluatex_voc") | 25 | require("arabluatex_voc") |
26 | require("arabluatex_fullvoc") | ||
26 | require("arabluatex_novoc") | 27 | require("arabluatex_novoc") |
27 | 28 | ||
28 | local function protectarb(str) | 29 | local function protectarb(str) |
@@ -133,14 +134,47 @@ local function voc(str) | |||
133 | return str | 134 | return str |
134 | end | 135 | end |
135 | 136 | ||
137 | local function fullvoc(str) | ||
138 | str = string.gsub(str, "\\arb(%b{})", function(inside) | ||
139 | inside = string.sub(inside, 2, -2) | ||
140 | for i = 1,#hamzafv do | ||
141 | inside = string.gsub(inside, hamzafv[i].a, hamzafv[i].b) | ||
142 | end | ||
143 | for i = 1,#tanwin do | ||
144 | inside = string.gsub(inside, tanwin[i].a, tanwin[i].b) | ||
145 | end | ||
146 | for i = 1,#trigraphs do | ||
147 | inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b) | ||
148 | end | ||
149 | for i = 1,#digraphsfv do | ||
150 | inside = string.gsub(inside, digraphsfv[i].a, digraphsfv[i].b) | ||
151 | end | ||
152 | for i = 1,#single do | ||
153 | inside = string.gsub(inside, single[i].a, single[i].b) | ||
154 | end | ||
155 | for i = 1,#longv do | ||
156 | inside = string.gsub(inside, longv[i].a, longv[i].b) | ||
157 | end | ||
158 | for i = 1,#shortv do | ||
159 | inside = string.gsub(inside, shortv[i].a, shortv[i].b) | ||
160 | end | ||
161 | for i = 1,#null do | ||
162 | inside = string.gsub(inside, null[i].a, null[i].b) | ||
163 | end | ||
164 | inside = indnum(inside) | ||
165 | return string.format("\\txarb{%s}", inside) | ||
166 | end) | ||
167 | return str | ||
168 | end | ||
169 | |||
136 | local function novoc(str) | 170 | local function novoc(str) |
137 | str = string.gsub(str, "\\arb(%b{})", function(inside) | 171 | str = string.gsub(str, "\\arb(%b{})", function(inside) |
138 | inside = string.sub(inside, 2, -2) | 172 | inside = string.sub(inside, 2, -2) |
139 | for i = 1,#hamza do | 173 | for i = 1,#hamza do |
140 | inside = string.gsub(inside, hamza[i].a, hamza[i].b) | 174 | inside = string.gsub(inside, hamza[i].a, hamza[i].b) |
141 | end | 175 | end |
142 | for i = 1,#tanwinnovoc do | 176 | for i = 1,#tanwinnv do |
143 | inside = string.gsub(inside, tanwinnovoc[i].a, tanwinnovoc[i].b) | 177 | inside = string.gsub(inside, tanwinnv[i].a, tanwinnv[i].b) |
144 | end | 178 | end |
145 | for i = 1,#trigraphs do | 179 | for i = 1,#trigraphs do |
146 | inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b) | 180 | inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b) |
@@ -151,11 +185,11 @@ local function novoc(str) | |||
151 | for i = 1,#single do | 185 | for i = 1,#single do |
152 | inside = string.gsub(inside, single[i].a, single[i].b) | 186 | inside = string.gsub(inside, single[i].a, single[i].b) |
153 | end | 187 | end |
154 | for i = 1,#longvnovoc do | 188 | for i = 1,#longvnv do |
155 | inside = string.gsub(inside, longvnovoc[i].a, longvnovoc[i].b) | 189 | inside = string.gsub(inside, longvnv[i].a, longvnv[i].b) |
156 | end | 190 | end |
157 | for i = 1,#shortvnovoc do | 191 | for i = 1,#shortvnv do |
158 | inside = string.gsub(inside, shortvnovoc[i].a, shortvnovoc[i].b) | 192 | inside = string.gsub(inside, shortvnv[i].a, shortvnv[i].b) |
159 | end | 193 | end |
160 | for i = 1,#null do | 194 | for i = 1,#null do |
161 | inside = string.gsub(inside, null[i].a, null[i].b) | 195 | inside = string.gsub(inside, null[i].a, null[i].b) |
@@ -176,6 +210,16 @@ function processvoc(str) | |||
176 | return str | 210 | return str |
177 | end | 211 | end |
178 | 212 | ||
213 | function processfullvoc(str) | ||
214 | str = "\\arb{".. str.."}" | ||
215 | str = protectarb(str) | ||
216 | str = breakcmd(str) | ||
217 | str = holdcmd(str) | ||
218 | str = fullvoc(str) | ||
219 | str = unprotectarb(str) | ||
220 | return str | ||
221 | end | ||
222 | |||
179 | function processnovoc(str) | 223 | function processnovoc(str) |
180 | str = "\\arb{".. str.."}" | 224 | str = "\\arb{".. str.."}" |
181 | str = protectarb(str) | 225 | str = protectarb(str) |