From f84ee7e82d37dac9180f352f29c68bac5c0c742a Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Wed, 18 May 2016 20:20:46 +0200 Subject: =?UTF-8?q?first=20implementation=20of=20\arbup=20viz.=20superscri?= =?UTF-8?q?pt=20tanw=C4=ABn=20in=20|dmg|=20=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arabluatex.dtx | 20 ++++++++++++++++++-- arabluatex.lua | 9 +++++---- arabluatex_fullvoc.lua | 4 ++-- arabluatex_trans.lua | 33 +++++++++++++++++---------------- arabluatex_voc.lua | 4 ++-- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/arabluatex.dtx b/arabluatex.dtx index 995be49..2e3dc7e 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx @@ -2144,8 +2144,8 @@ wa-ya.sIru ta.hta 'l-jildi % \end{macro} % \end{macro} % \begin{macro}{\SetTranslitStyle} By default any transliterated -% Arabic text is printed in italics. This can be changed globally in -% the preamble or at any point of the document: +% Arabic text is printed in italics. This can be changed either +% globally in the preamble or at any point of the document: % \begin{macrocode} \def\al@trans@style{\itshape}% \NewDocumentCommand{\SetTranslitStyle}{m}{\def\al@trans@style{#1}} @@ -2159,6 +2159,22 @@ wa-ya.sIru ta.hta 'l-jildi \NewDocumentCommand{\SetTranslitConvention}{m}{\def\al@trans@convention{#1}} % \end{macrocode} % \end{macro} +% \begin{macro}{\arbup} +% \begin{macro}{\SetArbUp} +% By default, \cs{arbup} is set to \cs{textsuperscript}. This is how +% the \arb[trans]{tanwIn} that takes place at the end of a word +% should be displayed in |dmg| mode. \cs{SetArbUp} may be used +% either in the preamble or at any point of the document to change +% the default definition. +% \begin{macrocode} +\NewDocumentCommand{\al@arbup@dflt}{m}{\textsuperscript{\thinspace#1}}% +\NewDocumentCommand{\al@arbup}{m}{\al@arbup@dflt{#1}} +\NewDocumentCommand{\arbup}{m}{\al@arbup{#1}} +\NewDocumentCommand{\ArbUpDflt}{}{\let\al@arbup=\al@arbup@dflt} +\NewDocumentCommand{\NoArbUp}{}{\RenewDocumentCommand{\al@arbup}{m}{##1}} +% \end{macrocode} +% \end{macro} +% \end{macro} % \begin{macro}{\cap} Proper Arabic names or book titles should be % passed to the command \cs{cap} so that they have their first letters % uppercased. \cs{cap} is actually coded in Lua. diff --git a/arabluatex.lua b/arabluatex.lua index 0bb4756..eb0d55c 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -123,11 +123,12 @@ local function takeoutabjad(str) return str end -local function takeoutcap(str) +local function takeoutcapetc(str) str = string.gsub(str, "(\\cap.?)(%b{})", function(tag, body) body = string.sub(body, 2, -2) return string.format("%s", body) end) + str = string.gsub(str, "\\linebreak", "") return str end @@ -421,7 +422,7 @@ end function processvoc(str, rules) str = "\\arb{".. str.."}" - str = takeoutcap(str) + str = takeoutcapetc(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) @@ -436,7 +437,7 @@ end function processfullvoc(str, rules) str = "\\arb{".. str.."}" - str = takeoutcap(str) + str = takeoutcapetc(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) @@ -451,7 +452,7 @@ end function processnovoc(str) str = "\\arb{".. str.."}" - str = takeoutcap(str) + str = takeoutcapetc(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) diff --git a/arabluatex_fullvoc.lua b/arabluatex_fullvoc.lua index a2676e0..577fff7 100644 --- a/arabluatex_fullvoc.lua +++ b/arabluatex_fullvoc.lua @@ -238,7 +238,7 @@ tanwinfv = { {a="(T)(aN)", b="%1ً"}, {a="(ء)(aN)", b="%1ً"}, {a="([^TA])(aN)", b="%1ًا"}, - {a="(iN)", b="ٍ"} + {a="(iNI?)", b="ٍ"} } tanwinfveasy = { -- no assimilations (see below) @@ -273,7 +273,7 @@ tanwinfveasy = { -- no assimilations (see below) {a="(T)(aN)", b="%1ً"}, {a="(ء)(aN)", b="%1ً"}, {a="([^TA])(aN)", b="%1ًا"}, - {a="(iN)", b="ٍ"} + {a="(iNI?)", b="ٍ"} } trigraphsfv = { -- trigraphs or more diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua index c96a9da..fbea94b 100644 --- a/arabluatex_trans.lua +++ b/arabluatex_trans.lua @@ -127,23 +127,24 @@ hamzatrdmg = { } tanwintrdmg = { - {a="uNU", b="un"}, - {a="aNU", b="an"}, - {a="iNU", b="in"}, + {a="uNU", b="\\arbup{un}"}, + {a="aNU", b="\\arbup{an}"}, + {a="iNU", b="\\arbup{in}"}, + {a="iNI", b="i\\arbup{n}"}, -- tanwīn preceding ʾalif conjunctionis - {a="(uN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="uni%2%3"}, - {a="(aN)(_A)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạni%3%4"}, - {a="(aN)(Y)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạni%3%4"}, - {a="(T)(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="tani%3%4"}, - {a="([^TA])(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1ani%3%4"}, - {a="(iN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ini%2%3"}, + {a="(uN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="\\arbup{uni}%2%3"}, + {a="(aN)(_A)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạ\\arbup{ni}%3%4"}, + {a="(aN)(Y)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạ\\arbup{ni}%3%4"}, + {a="(T)(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="t\\arbup{ani}%3%4"}, + {a="([^TA])(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1\\arbup{ani}%3%4"}, + {a="(iN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="\\arbup{ini}%2%3"}, -- - {a="uN", b="un"}, - {a="(aN)(_A)", b="ạn"}, - {a="(aN)(Y)", b="ạn"}, - {a="(T)(\"?aN)", b="tan"}, - {a="([^TA])(\"?aN)", b="%1an"}, - {a="iN", b="in"} + {a="uN", b="\\arbup{un}"}, + {a="(aN)(_A)", b="ạ\\arbup{n}"}, + {a="(aN)(Y)", b="ạ\\arbup{n}"}, + {a="(T)(\"?aN)", b="t\\arbup{an}"}, + {a="([^TA])(\"?aN)", b="%1\\arbup{an}"}, + {a="iN", b="\\arbup{in}"} } trigraphstrdmg = { -- trigraphs or more @@ -198,7 +199,7 @@ trigraphstrdmg = { -- trigraphs or more {a="(_a)U", b="A"}, {a="(_a)I", b="A"}, -- assimilations - {a="(n)(%s)([rlmnwy])", b="%3%2%3"} + {a="(n)(})(%s)([rlmnwy])", b="%4%2%3%4"} } trigraphstrdmgeasy = { -- see the differences below under 'easy' tag diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua index 4f5399f..878f351 100644 --- a/arabluatex_voc.lua +++ b/arabluatex_voc.lua @@ -267,7 +267,7 @@ tanwin = { {a="(T)(aN)", b="%1ً"}, {a="(ء)(aN)", b="%1ً"}, {a="([^TA])(aN)", b="%1ًا"}, - {a="(iN)", b="ٍ"} + {a="(iNI?)", b="ٍ"} } tanwineasy = { -- 'easy' requires some lines to be taken out: @@ -300,7 +300,7 @@ tanwineasy = { -- 'easy' requires some lines to be taken out: {a="(T)(aN)", b="%1ً"}, {a="(ء)(aN)", b="%1ً"}, {a="([^TA])(aN)", b="%1ًا"}, - {a="(iN)", b="ٍ"} + {a="(iNI?)", b="ٍ"} } trigraphs = { -- trigraphs or more -- cgit v1.2.3