aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex.dtx27
-rw-r--r--arabluatex.lua16
-rw-r--r--arabluatex_voc.lua9
3 files changed, 43 insertions, 9 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index 8554fc3..d7a4adb 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -2262,17 +2262,29 @@ wa-ya.sIru ta.hta 'l-jild-i
2262 {\RenewDocumentCommand{\aemph}{m}{$\overline{\text{#1}}$}} 2262 {\RenewDocumentCommand{\aemph}{m}{$\overline{\text{#1}}$}}
2263 {\NewDocumentCommand{\aemph}{m}{$\overline{\text{#1}}$}}} 2263 {\NewDocumentCommand{\aemph}{m}{$\overline{\text{#1}}$}}}
2264% \end{macrocode} 2264% \end{macrocode}
2265% \begin{macro}{\SetInputScheme}
2266% \changes{v1.4}{2016/06/30}{\cs{SetInputScheme} may be used to
2267% process other input schemes such as \enquote*{Buckwalter}}
2268% \package{arabluatex} is designed for processing Arab\TeX\ input
2269% notation. \cs{SetInputScheme} may be used in the preamble or at
2270% any point of the document should the user wish to use a different
2271% notation such as the \enquote*{Buckwalter scheme}.
2272% \begin{macrocode}
2273\def\al@input@scheme{arabtex}
2274\NewDocumentCommand{\SetInputScheme}{m}{\def\al@input@scheme{#1}}
2275% \end{macrocode}
2276% \end{macro}
2265% \end{macro} 2277% \end{macro}
2266% \begin{macro}{\SetArbEasy} 2278% \begin{macro}{\SetArbEasy}
2267% \changes{v1.2}{2016/05/09}{New \cs{SetArbEasy}/\cs{SetArbDflt} for 2279% \changes{v1.2}{2016/05/09}{New \cs{SetArbEasy}/\cs{SetArbDflt} for
2268% \enquote*{modern} or \enquote*{classic} Arabic styles.} 2280% \enquote*{modern} or \enquote*{classic} Arabic styles.}
2269% \begin{macro}{\SetArbDflt} 2281% \begin{macro}{\SetArbDflt}
2270% By default, \package{arabluatex} applies complex rules to generate 2282% By default, \package{arabluatex} applies complex rules to generate
2271% euphonic \arb[trans]{ta^sdId}, \arb[trans]{'alif mamdUdaT} 2283% euphonic \arb[trans]{ta^sdId}, \arb[trans]{'alif mamdUdaT} and
2272% \linebreak and \arb[trans]{sukUn} depending on the modes which are 2284% \arb[trans]{sukUn} depending on the modes which are selected,
2273% selected, either |voc|, |fullvoc| or |trans|. Such refinements can 2285% either |voc|, |fullvoc| or |trans|. Such refinements can be
2274% be discarded with \cs{SetArbEasy}, either globally in the preamble 2286% discarded with \cs{SetArbEasy}, either globally in the preamble or
2275% or at any point of the document. Default complex rules can be set 2287% at any point of the document. Default complex rules can be set
2276% back at any point of the document with \cs{SetArbDflt}. 2288% back at any point of the document with \cs{SetArbDflt}.
2277% \begin{macrocode} 2289% \begin{macrocode}
2278\def\al@arb@rules{dflt} 2290\def\al@arb@rules{dflt}
@@ -2289,7 +2301,6 @@ wa-ya.sIru ta.hta 'l-jild-i
2289\def\al@trans@font{\rmfamily}% 2301\def\al@trans@font{\rmfamily}%
2290\NewDocumentCommand{\SetTranslitFont}{m}{\def\al@trans@font{#1}} 2302\NewDocumentCommand{\SetTranslitFont}{m}{\def\al@trans@font{#1}}
2291% \end{macrocode} 2303% \end{macrocode}
2292%
2293% \end{macro} 2304% \end{macro}
2294% \end{macro} 2305% \end{macro}
2295% \begin{macro}{\SetTranslitStyle} By default any transliterated 2306% \begin{macro}{\SetTranslitStyle} By default any transliterated
@@ -2369,7 +2380,7 @@ wa-ya.sIru ta.hta 'l-jild-i
2369 \ifx\@tempa\al@mode@voc% 2380 \ifx\@tempa\al@mode@voc%
2370 \bgroup\textdir TRT\arabicfont% 2381 \bgroup\textdir TRT\arabicfont%
2371 \luadirect{tex.sprint(processvoc(\luastringN{#2}, 2382 \luadirect{tex.sprint(processvoc(\luastringN{#2},
2372 \luastringO{\al@arb@rules}))}\egroup% 2383 \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
2373 \else% 2384 \else%
2374 \ifx\@tempa\al@mode@fullvoc% 2385 \ifx\@tempa\al@mode@fullvoc%
2375 \bgroup\textdir TRT\arabicfont% 2386 \bgroup\textdir TRT\arabicfont%
@@ -2399,7 +2410,7 @@ wa-ya.sIru ta.hta 'l-jild-i
2399 \ifx\@tempa\al@mode@voc% 2410 \ifx\@tempa\al@mode@voc%
2400 \bgroup\pardir TRT\textdir TRT\arabicfont% 2411 \bgroup\pardir TRT\textdir TRT\arabicfont%
2401 \luadirect{tex.sprint(processvoc(\luastringO{\BODY}, 2412 \luadirect{tex.sprint(processvoc(\luastringO{\BODY},
2402 \luastringO{\al@arb@rules}))}\egroup% 2413 \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
2403 \else% 2414 \else%
2404 \ifx\@tempa\al@mode@fullvoc% 2415 \ifx\@tempa\al@mode@fullvoc%
2405 \bgroup\pardir TRT\textdir TRT\arabicfont% 2416 \bgroup\pardir TRT\textdir TRT\arabicfont%
diff --git a/arabluatex.lua b/arabluatex.lua
index 3e574cf..9134ce5 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -456,12 +456,26 @@ local function transloc(str)
456return str 456return str
457end 457end
458 458
459function processvoc(str, rules) 459local function processbuckw(str)
460 str = string.gsub(str, "\\arb(%b{})", function(inside)
461 inside = string.sub(inside, 2, -2)
462 for i = 1,#buckwalter do
463 inside = string.gsub(inside, buckwalter[i].a, buckwalter[i].b)
464 end
465 return string.format("\\arb{%s}", inside)
466 end)
467return str
468end
469
470function processvoc(str, rules, scheme)
460 str = "\\arb{".. str.."}" 471 str = "\\arb{".. str.."}"
461 str = takeoutcapetc(str) 472 str = takeoutcapetc(str)
462 str = protectarb(str) 473 str = protectarb(str)
463 str = breakcmd(str) 474 str = breakcmd(str)
464 str = holdcmd(str) 475 str = holdcmd(str)
476 if scheme == "buckwalter" then
477 str = processbuckw(str)
478 else end
465 if rules == "easy" then 479 if rules == "easy" then
466 str = voceasy(str) 480 str = voceasy(str)
467 elseif rules == "dflt" then 481 elseif rules == "dflt" then
diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua
index e47ef96..1a64109 100644
--- a/arabluatex_voc.lua
+++ b/arabluatex_voc.lua
@@ -71,6 +71,15 @@ raw = {
71 {a="i", b="ِ"} 71 {a="i", b="ِ"}
72} 72}
73 73
74buckwalter = {
75-- {a="\'", b="|\"\'"},
76 {a="%>", b="a\"\'"},
77 {a="%&", b="w\"\'"},
78 {a="%<", b="i\"\'"},
79 {a="%}", b="y\"\'"},
80 {a="p", b="T"}
81}
82
74hamza = { 83hamza = {
75 -- next line for ʾiʿrāb hyphen 84 -- next line for ʾiʿrāb hyphen
76 {a="(')(%-)([uaiUAI])", b="%1%3"}, 85 {a="(')(%-)([uaiUAI])", b="%1%3"},