From 7f5715d693dc4563c2c24be534069d4263c253bc Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Wed, 21 Dec 2016 15:34:21 +0100 Subject: starting to work on \arbnull to put back on contextual analysis in case it is broken by TeX commands --- arabluatex.lua | 16 ++++++++++++++++ arabluatex_trans.lua | 12 +++++++++--- arabluatex_voc.lua | 1 + 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/arabluatex.lua b/arabluatex.lua index 07968c0..527be3b 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -128,6 +128,21 @@ local function indnum(str) return str end +local function processarbnull(str, scheme) + if scheme == "buckwalter" then + str = string.gsub(str, "(\\arbnull.?)(%b{})", function(tag, body) + body = string.sub(body, 2, -2) + return string.format("P%sP", body) + end) + else + str = string.gsub(str, "(\\arbnull.?)(%b{})", function(tag, body) + body = string.sub(body, 2, -2) + return string.format("o%so", body) + end) + end + return str +end + local function takeoutabjad(str) str = string.gsub(str, "(\\abjad.?)(%b{})", function(tag, body) body = string.sub(body, 2, -2) @@ -543,6 +558,7 @@ end function processtrans(str, mode, rules, scheme) str = "\\arb{".. str.."}" + str = processarbnull(str, scheme) str = takeoutabjad(str) str = protectarb(str) str = breakcmd(str) diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua index ef55a2b..bc44229 100644 --- a/arabluatex_trans.lua +++ b/arabluatex_trans.lua @@ -30,7 +30,8 @@ punctuationtr = { } nulltr = { - {a="%|", b=""} + {a="%|", b=""}, + {a="o.-o", b=""} } -- cap @@ -95,7 +96,11 @@ hamzatrdmg = { {a="(A)(')(i)", b="%1ʾ%3"}, -- historic madda {a="(A)(')", b="%1ʾ"}, -- historic madda -- initial (needs both ^ and %W patterns) - -- 'aw: the diphthong is to be resoved into 'awi' (next 4 lines) + -- 'aw: the diphthong is to be resolved into 'awi' (next 8 lines) + {a="^('aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)(.-o)", b="%1i"}, + {a="(%W)('aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)(.-o)", b="%1%2i"}, + {a="^('aw)(o)([%(%[%|%<]?\"?[uai])(.-o)", b="%1i"}, + {a="(%W)('aw)(o)([%(%[%|%<]?\"?[uai])(.-o)", b="%1%2i"}, {a="^('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"}, {a="(%W)('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1%2i%3%4"}, {a="^('aw)(%s)([%(%[%|%<]?\"?[uai])", b="%1i%2%3"}, @@ -229,7 +234,8 @@ trigraphstrdmg = { -- trigraphs or more idghamtrdmg = { -- assimilations - {a="(n)(}?)(%s)([rlmnwy])", b="%4%2%3%4"} + {a="(n)(}?)(%s)([rlmnwy])", b="%4%2%3%4"}, + {a="(n)(o)([rlmnwy])(.-o)", b="%3"} } digraphstrdmg = { diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua index 02c3feb..c856818 100644 --- a/arabluatex_voc.lua +++ b/arabluatex_voc.lua @@ -161,6 +161,7 @@ buckwalter = { {a="F", b="aN"}, {a="K", b="iN"}, {a="o", b="\""}, + {a="P", b="o"}, -- pass on to \arbnull -- hard-coded connective alif {a="%[", b="ٱ"}, {a="L", b="ٱ"} -- BW safe -- cgit v1.2.3