From 1b93280683c67010b9bed0327f2b978f2edbf329 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Wed, 22 Aug 2018 12:25:45 +0200 Subject: arabtex2utf: \abjad now works --- arabluatex.lua | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/arabluatex.lua b/arabluatex.lua index cf6cac2..64d3fbc 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -708,6 +708,11 @@ local function processarbtoutf(str) -- body = string.sub(body, 2, -2) -- return string.format("%s%s\\@al@pr@ob%s\\@al@pr@cb", tag, opt, body) -- end) + str = string.gsub(str, "(\\abjad)%s?(%b{})", function(tag, body) + body = string.sub(body, 2, -2) + body = abjadify(body) + return string.format("\\aemph{\\arb[novoc]{%s}}", body) + end) str = string.gsub(str, "(\\arb%s?)(%b[])(%b{})", function(tag, opt, body) body = string.sub(body, 2, -2) return string.format("%s%s\\@al@pr@ob%s\\@al@pr@cb", tag, opt, body) @@ -720,10 +725,6 @@ local function processarbtoutf(str) body = string.sub(body, 2, -2) return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) end) - str = string.gsub(str, "(\\abjad)%s?(%b{})", function(tag, body) - body = string.sub(body, 2, -2) - return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) - end) str = string.gsub(str, "(\\[Uu]c)%s?(%b{})", function(tag, body) body = string.sub(body, 2, -2) return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) @@ -754,11 +755,6 @@ function arbtoutf(str) body = gsub(body, lpeg.Cs("\\arb") * arbargs, "}%1%2\\ArbOutFile{") return string.format("%s{%s}", tag, body) end) - str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) - body = string.sub(body, 2, -2) - body = string.gsub(body, "(\\abjad)%s?(%b{})", "}%1%2\\ArbOutFile{") - return string.format("%s{%s}", tag, body) - end) str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) body = string.sub(body, 2, -2) body = string.gsub(body, "(\\[Uu]c)%s?(%b{})", "}%1%2\\ArbOutFile{") @@ -963,7 +959,6 @@ function processarbmarks(str) end end end --- return str if export_utf == "yes" then tofile = str tooutfile(tofile) @@ -1062,13 +1057,10 @@ function abjadify(n) if n >= 1 then abjadnum = abjadnum .. abjad[1][math.floor(n/1)] end --- return "\\arb[novoc]{"..abjadnum.."}" if export_utf == "yes" then - tofile = "\\arb[novoc]{"..abjadnum.."}" - tooutfile(tofile) + return abjadnum elseif export_utf == "arabverse" then - tofile = "\\arb[novoc]{"..abjadnum.."}" - tooutfile(tofile) + return abjadnum else return "\\arb[novoc]{"..abjadnum.."}" end -- cgit v1.2.3