diff options
author | Karl Berry <karl@freefriends.org> | 2016-07-05 21:39:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-07-05 21:39:55 +0000 |
commit | b4b6a71b473d050e24fc63a01cf3bc36e4b5582d (patch) | |
tree | 58c8379df6f044d28c711cbd52018757608c8b51 /Master/texmf-dist/tex | |
parent | 2fb347ba645d1206714d176309b4ec87e5164b0a (diff) |
arabluatex (5jul16)
git-svn-id: svn://tug.org/texlive/trunk@41637 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
5 files changed, 147 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua index 3b0ed5e4ef3..b21ee63dee8 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua @@ -456,12 +456,26 @@ local function transloc(str) return str end -function processvoc(str, rules) +local function processbuckw(str) + str = string.gsub(str, "\\arb(%b{})", function(inside) + inside = string.sub(inside, 2, -2) + for i = 1,#buckwalter do + inside = string.gsub(inside, buckwalter[i].a, buckwalter[i].b) + end + return string.format("\\arb{%s}", inside) + end) +return str +end + +function processvoc(str, rules, scheme) str = "\\arb{".. str.."}" str = takeoutcapetc(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) + if scheme == "buckwalter" then + str = processbuckw(str) + else end if rules == "easy" then str = voceasy(str) elseif rules == "dflt" then @@ -471,12 +485,15 @@ function processvoc(str, rules) return str end -function processfullvoc(str, rules) +function processfullvoc(str, rules, scheme) str = "\\arb{".. str.."}" str = takeoutcapetc(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) + if scheme == "buckwalter" then + str = processbuckw(str) + else end if rules == "easy" then str = fullvoceasy(str) elseif rules == "dflt" then @@ -486,12 +503,15 @@ function processfullvoc(str, rules) return str end -function processnovoc(str, rules) +function processnovoc(str, rules, scheme) str = "\\arb{".. str.."}" str = takeoutcapetc(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) + if scheme == "buckwalter" then + str = processbuckw(str) + else end if rules == "easy" then str = novoceasy(str) elseif rules == "dflt" then @@ -501,12 +521,15 @@ function processnovoc(str, rules) return str end -function processtrans(str, mode, rules) +function processtrans(str, mode, rules, scheme) str = "\\arb{".. str.."}" str = takeoutabjad(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) + if scheme == "buckwalter" then + str = processbuckw(str) + else end if mode == "dmg" then if rules == "easy" then str = transdmgeasy(str) @@ -538,7 +561,7 @@ function cap(str) else str = "\\MakeUppercase "..str end -return str +return "\\txtrans{"..str.."}" end -- this function is adapted from an 'obsolete project' of Khaled diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty index 13f2b6e7180..ae362ea5923 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty @@ -41,7 +41,7 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{arabluatex}% -[2016/05/28 v1.3 ArabTeX-like interface for LuaLaTeX] +[2016/07/05 v1.4 ArabTeX-like interface for LuaLaTeX] \RequirePackage{ifluatex} \ifluatex\else \PackageError{arabluatex}{lualatex needed}{% @@ -83,9 +83,13 @@ \AtBeginDocument{\ifdef{\aemph}% {\RenewDocumentCommand{\aemph}{m}{$\overline{\text{#1}}$}} {\NewDocumentCommand{\aemph}{m}{$\overline{\text{#1}}$}}} +\def\al@input@scheme{arabtex} +\NewDocumentCommand{\SetInputScheme}{m}{\def\al@input@scheme{#1}} \def\al@arb@rules{dflt} \NewDocumentCommand{\SetArbEasy}{}{\def\al@arb@rules{easy}} \NewDocumentCommand{\SetArbDflt}{}{\def\al@arb@rules{dflt}} +\def\al@trans@font{\rmfamily}% +\NewDocumentCommand{\SetTranslitFont}{m}{\def\al@trans@font{#1}} \def\al@trans@style{\itshape}% \NewDocumentCommand{\SetTranslitStyle}{m}{\def\al@trans@style{#1}} \def\al@trans@convention{dmg} @@ -101,29 +105,30 @@ \DeclareDocumentCommand{\txarb}{+m}{\bgroup\textdir TRT\arabicfont#1\egroup} \DeclareDocumentCommand{\txtrans}{+m}{\bgroup\textdir - TLT\rmfamily#1\egroup} + TLT\al@trans@font#1\egroup} \DeclareDocumentCommand{\arb}{O{\al@mode} +m}% {\edef\@tempa{#1}% \ifx\@tempa\al@mode@voc% \bgroup\textdir TRT\arabicfont% \luadirect{tex.sprint(processvoc(\luastringN{#2}, - \luastringO{\al@arb@rules}))}\egroup% + \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@fullvoc% \bgroup\textdir TRT\arabicfont% \luadirect{tex.sprint(processfullvoc(\luastringN{#2}, - \luastringO{\al@arb@rules}))}\egroup% + \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@novoc% \bgroup\textdir TRT\arabicfont% \luadirect{tex.sprint(processnovoc(\luastringN{#2}, - \luastringO{\al@arb@rules}))}\egroup% + \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@trans% \bgroup\textdir TLT\al@trans@style% \luadirect{tex.sprint(processtrans(\luastringN{#2}, \luastringO{\al@trans@convention}, - \luastringO{\al@arb@rules}))}\egroup% + \luastringO{\al@arb@rules}, + \luastringO{\al@input@scheme}))}\egroup% \else% \fi\fi\fi\fi} \NewEnviron{arab}[1][\al@mode]% @@ -131,22 +136,23 @@ \ifx\@tempa\al@mode@voc% \bgroup\pardir TRT\textdir TRT\arabicfont% \luadirect{tex.sprint(processvoc(\luastringO{\BODY}, - \luastringO{\al@arb@rules}))}\egroup% + \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@fullvoc% \bgroup\pardir TRT\textdir TRT\arabicfont% \luadirect{tex.sprint(processfullvoc(\luastringO{\BODY}, - \luastringO{\al@arb@rules}))}\egroup% + \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@novoc% \bgroup\pardir TRT\textdir TRT\arabicfont% \luadirect{tex.sprint(processnovoc(\luastringO{\BODY}, - \luastringO{\al@arb@rules}))}\egroup% + \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else \ifx\@tempa\al@mode@trans% \bgroup\pardir TLT\textdir TLT\al@trans@style% \luadirect{tex.sprint(processtrans(\luastringO{\BODY}, \luastringO{\al@trans@convention}, - \luastringO{\al@arb@rules}))}\egroup% + \luastringO{\al@arb@rules}, + \luastringO{\al@input@scheme}))}\egroup% \else \fi\fi\fi\fi}[\par] \AtBeginDocument{% \ifdefined\abjad% diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_fullvoc.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_fullvoc.lua index ea7df9f69b5..e0ffbce92a4 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_fullvoc.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_fullvoc.lua @@ -45,6 +45,8 @@ hamzafv = { {a="''([Uu])", b="ؤؤ%1"}, {a="''([Aa])", b="أأ%1"}, {a="''([Ii])", b="ئئ%1"}, + -- inseparable adverbial particle 'a- + 'a + {a="\'(a)%-\'(a)", b="أ%1اأ%2"}, -- initial long u and i (for a, see below) {a="%'%_U", b="أU"}, {a="%'%_I", b="إI"}, @@ -141,6 +143,8 @@ hamzafveasy = { -- differences marked below with 'easy' {a="''([Uu])", b="ؤؤ%1"}, {a="''([Aa])", b="أأ%1"}, {a="''([Ii])", b="ئئ%1"}, + -- inseparable adverbial particle 'a- + 'a + {a="\'(a)%-\'(a)", b="أ%1اأ%2"}, -- initial long u and i (for a, see below) {a="%'%_U", b="أU"}, {a="%'%_I", b="إI"}, @@ -464,10 +468,12 @@ digraphsfv = { {a="([%_%^%.]?[Bbtjghxdrzs%`fqklmnwy])([%s])", b="%1ْ%2"}, {a="([%_%^%.]?[Bbtjghxdrzs%`fqklmnwy])([%_]?[^%_uaiUAIYًٌٍ])", b="%1ْ%2"}, -- take out sukūn in cases of assimilation - {a="(n)(ْ)(%s)([روي])", b="%1%3%4"}, - {a="(n)(ْ)(%s)([ل])", b="%1%3%4"}, - {a="(n)(ْ)(%s)([م])", b="%1%3%4"}, - {a="(n)(ْ)(%s)([ن])", b="%1%3%4"}, + {a="(n)(ْ)(%s)(ر)", b="%1%3%4"}, + {a="(n)(ْ)(%s)(و)", b="%1%3%4"}, + {a="(n)(ْ)(%s)(ي)", b="%1%3%4"}, + {a="(n)(ْ)(%s)(ل)", b="%1%3%4"}, + {a="(n)(ْ)(%s)(م)", b="%1%3%4"}, + {a="(n)(ْ)(%s)(ن)", b="%1%3%4"}, {a="ْ\"", b="\""}, -- sukūn end {a="_t", b="ث"}, diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua index b98647d852d..2fdb94ab768 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua @@ -147,11 +147,12 @@ tanwintrdmg = { {a="%-?(iN)(%s)(i)", b="\\arbup{ini}%2%'"}, -- -- {a="uN", b="\\arbup{un}"}, (now included in the last line of this table) + {a="%-?(\"?At)%-?([ui])N", b="\\arbup{%1%2n}"}, {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="(%-?)(\"?A?t?)(%-?)([ui])(N)", b="\\arbup{%2%4n}"} + {a="%-?([ui])N", b="\\arbup{%1n}"} } trigraphstrdmg = { -- trigraphs or more @@ -439,12 +440,12 @@ tanwintrloc = { {a="%-?uNU", b="un"}, {a="%-?aNU", b="an"}, {a="%-?iNU", b="in"}, - {a="%-?uN", b="un"}, --- {a="%-?(aN)(_A)", b="an"}, (now included in last line in this table) + {a="%-?(\"?At)%-?([ui])N", b="%1%2n"}, + {a="%-?([ui])N", b="%1n"}, + {a="%-?(aN)(_A)", b="an"}, {a="%-?(aN)(Y)", b="an"}, {a="(T)%-?(\"?aN)", b="tan"}, - {a="([^TA])%-?(\"?aN)", b="%1an"}, - {a="(%-?)(\"?A?t?)(%-?)([ui])(N)", b="%2%4n"}, + {a="([^TA])%-?(\"?aN)", b="%1an"} } trigraphstrloc = { -- trigraphs or more diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_voc.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_voc.lua index 0e5cfc671e8..39da99ec563 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_voc.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_voc.lua @@ -71,6 +71,88 @@ raw = { {a="i", b="ِ"} } +buckwalter = { + --- hard coded madda: hold it for now + {a="%|", b="@"}, + -- prevent any unwanted šadda from being generated + {a="bb", b="b|b"}, + {a="tt", b="t|t"}, + {a="vv", b="v|v"}, + {a="jj", b="j|j"}, + {a="HH", b="H|H"}, + {a="xx", b="x|x"}, + {a="dd", b="d|d"}, + {a="%*|%*", b="*|*"}, + {a="rr", b="r|r"}, + {a="ss", b="s|s"}, + {a="%$%$", b="$|$"}, + {a="SS", b="S|S"}, + {a="DD", b="D|D"}, + {a="TT", b="T|T"}, + {a="ZZ", b="Z|Z"}, + {a="EE", b="E|E"}, + {a="gg", b="g|g"}, + {a="ff", b="f|f"}, + {a="qq", b="q|q"}, + {a="kk", b="k|k"}, + {a="ll", b="l|l"}, + {a="mm", b="m|m"}, + {a="nn", b="n|n"}, + {a="hh", b="h|h"}, + {a="ww", b="w|w"}, + {a="yy", b="y|y"}, + -- hamza begin + -- look into this later on: +-- {a="%>a?A", b="@@@"}, -- hold this (madda) +-- {a="%>a\'([^uai])", b="@@@%1"}, -- hold this (madda) + {a="a?A\'", b="@@"}, -- hold this (classic madda) + {a="\'", b="|\"\'"}, + {a="%>", b="a\"\'"}, + {a="%&", b="w\"\'"}, + {a="%<", b="i\"\'"}, + {a="%]", b="y\"\'"}, + -- hamza end + -- trigraphs + {a="^Aal%-?", b="al-"}, + {a="(%W)Aal%-?", b="%1al-"}, + {a="(%s)Aal%-?", b="%1al-"}, + {a="([%-%s])Al%-?", b="%1\'l-"}, + {a="^A", b="a"}, + {a="(%W)A", b="%1a"}, + {a="(%s)A", b="%1a"}, + {a="(al%-[%g])(%~)", b="%1"}, + {a="(\'l%-[%g])(%~)", b="%1"}, + -- digraphs begin + {a="aA", b="A"}, + {a="uw([^%~])", b="U%1"}, + {a="iy([^%~])", b="I%1"}, + -- digraphs end + -- madda: get it back now +-- {a="%@%@%@", b="\'A"}, + {a="%@%@", b="A\'"}, -- give back classic madda + {a="%@", b="A\"\'"}, -- hard coded madda + -- šadda: + {a="([%g])(%~)", b="%1%1"}, + {a="%`", b="_a"}, + {a="v", b="_t"}, + {a="H", b=".h"}, + {a="%*", b="_d"}, + {a="%$", b="^s"}, + {a="S", b=".s"}, + {a="D", b=".d"}, + {a="T", b=".t"}, + {a="Z", b=".z"}, + {a="E", b="`"}, + {a="g", b=".g"}, + {a="p", b="T"}, + {a="N", b="uN"}, + {a="F", b="aN"}, + {a="K", b="iN"}, + {a="o", b="\""}, + -- hard-coded connective alif + {a="%[", b="ٱ"} +} + hamza = { -- next line for ʾiʿrāb hyphen {a="(')(%-)([uaiUAI])", b="%1%3"}, @@ -85,6 +167,8 @@ hamza = { {a="''([Uu])", b="ؤؤ%1"}, {a="''([Aa])", b="أأ%1"}, {a="''([Ii])", b="ئئ%1"}, + -- inseparable adverbial particle 'a- + 'a + {a="\'(a)%-\'(a)", b="أ%1اأ%2"}, -- initial long u and i (for a, see below) {a="%'%_U", b="أU"}, {a="%'%_I", b="إI"}, @@ -172,6 +256,8 @@ hamzaeasy = { -- differences marked below with 'easy' {a="''([Uu])", b="ؤؤ%1"}, {a="''([Aa])", b="أأ%1"}, {a="''([Ii])", b="ئئ%1"}, + -- inseparable adverbial particle 'a- + 'a + {a="\'(a)%-\'(a)", b="أ%1اأ%2"}, -- initial long u and i (for a, see below) {a="%'%_U", b="أU"}, {a="%'%_I", b="إI"}, @@ -570,7 +656,7 @@ punctuation = { {a="%)", b="-@("}, {a="%+%@%(", b=")"}, {a="%-%@%(", b="("}, - {a="%.", b="۔"}, + {a="%.", b="."}, {a="([^0-9])%,", b="%1،"}, {a="%?", b="؟"}, {a="%;", b="؛"}, |