From 1ef40807d6c01d959e5f0898e9b2dcd0520879cf Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Wed, 22 Aug 2018 11:38:56 +0200 Subject: tidy up. \abjad needs more work --- arabluatex.lua | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/arabluatex.lua b/arabluatex.lua index 6f62f91..cf6cac2 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -721,12 +721,12 @@ local function processarbtoutf(str) 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) + 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) + body = string.sub(body, 2, -2) + return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) end) str = string.gsub(str, "{", "\\@al@ob") str = string.gsub(str, "} ", "\\@al@cb@sp") @@ -755,14 +755,14 @@ function arbtoutf(str) 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) + 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{") - return string.format("%s{%s}", tag, body) + body = string.sub(body, 2, -2) + body = string.gsub(body, "(\\[Uu]c)%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) @@ -836,9 +836,8 @@ function processvoc(str, rules, scheme) tofile = "\\txarb{"..str.."}" tooutfile(tofile) elseif export_utf == "arabverse" then - tofile = str + tofile = "\\txarb{"..str.."}" tooutfile(tofile) --- return str else return str end @@ -867,9 +866,8 @@ function processfullvoc(str, rules, scheme) tofile = "\\txarb{"..str.."}" tooutfile(tofile) elseif export_utf == "arabverse" then - tofile = str + tofile = "\\txarb{"..str.."}" tooutfile(tofile) --- return str else return str end @@ -896,9 +894,8 @@ function processnovoc(str, rules, scheme) tofile = "\\txarb{"..str.."}" tooutfile(tofile) elseif export_utf == "arabverse" then - tofile = str + tofile = "\\txarb{"..str.."}" tooutfile(tofile) --- return str else return str end @@ -928,9 +925,8 @@ function processtrans(str, mode, rules, scheme) tofile = str tooutfile(tofile) elseif export_utf == "arabverse" then - tofile = str + tofile = "\\txarb{"..str.."}" tooutfile(tofile) --- return str else return str end @@ -972,9 +968,8 @@ function processarbmarks(str) tofile = str tooutfile(tofile) elseif export_utf == "arabverse" then - tofile = str + tofile = "\\txarb{"..str.."}" tooutfile(tofile) --- return str else return str end @@ -1032,15 +1027,12 @@ function uc(str) for i = 1,#lcuc do str = string.gsub(str, "(%s[%(%<%[]?)"..lcuc[i].a, "%1"..lcuc[i].b) end --- return "\\txtrans{"..str.."}" --- if export_utf == "yes" then tofile = "\\txtrans{"..str.."}" tooutfile(tofile) elseif export_utf == "arabverse" then tofile = "\\txtrans{"..str.."}" tooutfile(tofile) --- return "\\txtrans{"..str.."}" else return "\\txtrans{"..str.."}" end @@ -1070,7 +1062,17 @@ function abjadify(n) if n >= 1 then abjadnum = abjadnum .. abjad[1][math.floor(n/1)] end - return "\\arb[novoc]{"..abjadnum.."}" +-- return "\\arb[novoc]{"..abjadnum.."}" + if export_utf == "yes" then + tofile = "\\arb[novoc]{"..abjadnum.."}" + tooutfile(tofile) + elseif export_utf == "arabverse" then + tofile = "\\arb[novoc]{"..abjadnum.."}" + tooutfile(tofile) + else + return "\\arb[novoc]{"..abjadnum.."}" + end + return "" end function abraces(str) -- cgit v1.2.3