aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex.dtx39
-rw-r--r--arabluatex.lua22
2 files changed, 45 insertions, 16 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index ff52e80..2d6eb13 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -198,7 +198,7 @@
198%</driver> 198%</driver>
199% \fi 199% \fi
200% 200%
201% \CheckSum{376} 201% \CheckSum{0}
202% 202%
203% \CharacterTable 203% \CharacterTable
204% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z 204% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -510,12 +510,16 @@
510% \item In |fullvoc| mode, the \arb[trans]{sukUn} is expressed. 510% \item In |fullvoc| mode, the \arb[trans]{sukUn} is expressed.
511% \end{compactitem} 511% \end{compactitem}
512% 512%
513% \DescribeMacro{\SetArbEasy} \DescribeMacro{\SetArbDflt} Such 513% \DescribeMacro{\SetArbEasy} \NEWfeature{v1.4.4}
514% \DescribeMacro{\SetArbEasy*} \DescribeMacro{\SetArbDflt} Such
514% refinements may be discarded by the command \cs{SetArbEasy}, either 515% refinements may be discarded by the command \cs{SetArbEasy}, either
515% globally in the preamble or locally at any point of the 516% globally in the preamble or locally at any point of the
516% document. Default \enquote*{classic} rules may be set back at any 517% document. The difference between \cs{SetArbEasy} and its
517% point of the document with the command \cs{SetArbDflt}. Examples 518% \enquote*{starred} version \cs{SetArbEasy*} is that the former keeps
518% follow:--- 519% the \arb[trans]{sukUn} that is generated by the |fullvoc| mode,
520% while the latter further takes it away. Default \enquote*{classic}
521% rules may be set back at any point of the document with the command
522% \cs{SetArbDflt}. Examples follow:---
519% \begin{compactenum}[(a)] 523% \begin{compactenum}[(a)]
520% \item \cs{SetArbDflt}: 524% \item \cs{SetArbDflt}:
521% \begin{compactenum}[i.] 525% \begin{compactenum}[i.]
@@ -535,6 +539,15 @@
535% \item |trans| \arb[trans]{wa-mAta istisqA'aN qabla 'an yutimma 539% \item |trans| \arb[trans]{wa-mAta istisqA'aN qabla 'an yutimma
536% kitAba-hu fI nujUm-i 'l-samA'-i}\SetArbDflt 540% kitAba-hu fI nujUm-i 'l-samA'-i}\SetArbDflt
537% \end{compactenum} 541% \end{compactenum}
542% \item \cs{SetArbEasy*}:
543% \begin{compactenum}[i.]\SetArbEasy*
544% \item |voc| \arb[voc]{wa-mAta istisqA'aN qabla 'an yutimma
545% kitAba-hu fI nujUm-i 'l-samA'-i}
546% \item |fullvoc| \arb[fullvoc]{wa-mAta istisqA'aN qabla 'an yutimma
547% kitAba-hu fI nujUm-i 'l-samA'-i}
548% \item |trans| \arb[trans]{wa-mAta istisqA'aN qabla 'an yutimma
549% kitAba-hu fI nujUm-i 'l-samA'-i}\SetArbDflt
550% \end{compactenum}
538% \end{compactenum} 551% \end{compactenum}
539% 552%
540% \iffalse 553% \iffalse
@@ -2494,20 +2507,29 @@ wa-ya.sIru ta.hta 'l-jild-i
2494% \begin{macro}{\SetArbEasy} 2507% \begin{macro}{\SetArbEasy}
2495% \changes{v1.2}{2016/05/09}{New \cs{SetArbEasy}/\cs{SetArbDflt} for 2508% \changes{v1.2}{2016/05/09}{New \cs{SetArbEasy}/\cs{SetArbDflt} for
2496% \enquote*{modern} or \enquote*{classic} Arabic styles.} 2509% \enquote*{modern} or \enquote*{classic} Arabic styles.}
2510% \begin{macro}{\SetArbEasy*}
2511% \changes{v1.4.4}{2016/09/28}{this starred version discards the
2512% \arb[trans]{sukUn} in addition to what is already discarded by
2513% \cs{SetArbEasy}.}
2497% \begin{macro}{\SetArbDflt} 2514% \begin{macro}{\SetArbDflt}
2498% By default, \package{arabluatex} applies complex rules to generate 2515% By default, \package{arabluatex} applies complex rules to generate
2499% euphonic \arb[trans]{ta^sdId}, \arb[trans]{'alif mamdUdaT} and 2516% euphonic \arb[trans]{ta^sdId}, \arb[trans]{'alif mamdUdaT} and
2500% \arb[trans]{sukUn} depending on the modes which are selected, 2517% \arb[trans]{sukUn} depending on the modes which are selected,
2501% either |voc|, |fullvoc| or |trans|. Such refinements can be 2518% either |voc|, |fullvoc| or |trans|. Such refinements can be
2502% discarded with \cs{SetArbEasy}, either globally in the preamble or 2519% discarded with \cs{SetArbEasy}, either globally in the preamble or
2503% at any point of the document. Default complex rules can be set 2520% at any point of the document. Note that \cs{SetArbEasy} keeps the
2521% \arb[trans]{sukUn} that is generated, while the starred version
2522% \cs{SetArbEasy*} takes it away. Default complex rules can be set
2504% back at any point of the document with \cs{SetArbDflt}. 2523% back at any point of the document with \cs{SetArbDflt}.
2505% \begin{macrocode} 2524% \begin{macrocode}
2506\def\al@arb@rules{dflt} 2525\def\al@arb@rules{dflt} \NewDocumentCommand{\SetArbEasy}{s}{%
2507\NewDocumentCommand{\SetArbEasy}{}{\def\al@arb@rules{easy}} 2526 \IfBooleanTF{#1} {\def\al@arb@rules{easynosukun}}
2527 {\def\al@arb@rules{easy}}}
2508\NewDocumentCommand{\SetArbDflt}{}{\def\al@arb@rules{dflt}} 2528\NewDocumentCommand{\SetArbDflt}{}{\def\al@arb@rules{dflt}}
2509% \end{macrocode} 2529% \end{macrocode}
2510% \end{macro} 2530% \end{macro}
2531% \end{macro}
2532% \end{macro}
2511% \begin{macro}{\SetTranslitFont} 2533% \begin{macro}{\SetTranslitFont}
2512% \changes{v1.4}{2016/07/05}{For selecting a specific font for 2534% \changes{v1.4}{2016/07/05}{For selecting a specific font for
2513% transliterated texts} By default, the font that is used for 2535% transliterated texts} By default, the font that is used for
@@ -2519,7 +2541,6 @@ wa-ya.sIru ta.hta 'l-jild-i
2519\NewDocumentCommand{\SetTranslitFont}{m}{\def\al@trans@font{#1}} 2541\NewDocumentCommand{\SetTranslitFont}{m}{\def\al@trans@font{#1}}
2520% \end{macrocode} 2542% \end{macrocode}
2521% \end{macro} 2543% \end{macro}
2522% \end{macro}
2523% \begin{macro}{\SetTranslitStyle} By default any transliterated 2544% \begin{macro}{\SetTranslitStyle} By default any transliterated
2524% Arabic text is printed in italics. This can be changed either 2545% Arabic text is printed in italics. This can be changed either
2525% globally in the preamble or at any point of the document: 2546% globally in the preamble or at any point of the document:
diff --git a/arabluatex.lua b/arabluatex.lua
index 35dccff..956f796 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -241,7 +241,7 @@ local function fullvoc(str)
241return str 241return str
242end 242end
243 243
244local function fullvoceasy(str) 244local function fullvoceasy(str, opt)
245 str = string.gsub(str, "\\arb(%b{})", function(inside) 245 str = string.gsub(str, "\\arb(%b{})", function(inside)
246 inside = string.sub(inside, 2, -2) 246 inside = string.sub(inside, 2, -2)
247 for i = 1,#hamzafveasy do 247 for i = 1,#hamzafveasy do
@@ -253,8 +253,14 @@ local function fullvoceasy(str)
253 for i = 1,#trigraphsfveasy do 253 for i = 1,#trigraphsfveasy do
254 inside = string.gsub(inside, trigraphsfveasy[i].a, trigraphsfveasy[i].b) 254 inside = string.gsub(inside, trigraphsfveasy[i].a, trigraphsfveasy[i].b)
255 end 255 end
256 for i = 1,#digraphsfveasy do 256 if opt == "nosukun" then
257 inside = string.gsub(inside, digraphsfveasy[i].a, digraphsfveasy[i].b) 257 for i = 1,#digraphsfveasy do
258 inside = string.gsub(inside, digraphsfveasy[i].a, digraphsfveasy[i].b)
259 end
260 else
261 for i = 1,#digraphsfv do
262 inside = string.gsub(inside, digraphsfv[i].a, digraphsfv[i].b)
263 end
258 end 264 end
259 for i = 1,#singlefveasy do 265 for i = 1,#singlefveasy do
260 inside = string.gsub(inside, singlefveasy[i].a, singlefveasy[i].b) 266 inside = string.gsub(inside, singlefveasy[i].a, singlefveasy[i].b)
@@ -477,7 +483,7 @@ function processvoc(str, rules, scheme)
477 if scheme == "buckwalter" then 483 if scheme == "buckwalter" then
478 str = processbuckw(str) 484 str = processbuckw(str)
479 else end 485 else end
480 if rules == "easy" then 486 if rules == "easy" or rules == "easynosukun" then
481 str = voceasy(str) 487 str = voceasy(str)
482 elseif rules == "dflt" then 488 elseif rules == "dflt" then
483 str = voc(str) 489 str = voc(str)
@@ -496,7 +502,9 @@ function processfullvoc(str, rules, scheme)
496 str = processbuckw(str) 502 str = processbuckw(str)
497 else end 503 else end
498 if rules == "easy" then 504 if rules == "easy" then
499 str = fullvoceasy(str) 505 str = fullvoceasy(str, "sukun")
506 elseif rules == "easynosukun" then
507 str = fullvoceasy(str, "nosukun")
500 elseif rules == "dflt" then 508 elseif rules == "dflt" then
501 str = fullvoc(str) 509 str = fullvoc(str)
502 else end 510 else end
@@ -513,7 +521,7 @@ function processnovoc(str, rules, scheme)
513 if scheme == "buckwalter" then 521 if scheme == "buckwalter" then
514 str = processbuckw(str) 522 str = processbuckw(str)
515 else end 523 else end
516 if rules == "easy" then 524 if rules == "easy" or rules == "easynosukun" then
517 str = novoceasy(str) 525 str = novoceasy(str)
518 elseif rules == "dflt" then 526 elseif rules == "dflt" then
519 str = novoc(str) 527 str = novoc(str)
@@ -532,7 +540,7 @@ function processtrans(str, mode, rules, scheme)
532 str = processbuckw(str) 540 str = processbuckw(str)
533 else end 541 else end
534 if mode == "dmg" then 542 if mode == "dmg" then
535 if rules == "easy" then 543 if rules == "easy" or rules == "easynosukun" then
536 str = transdmgeasy(str) 544 str = transdmgeasy(str)
537 elseif rules == "dflt" then 545 elseif rules == "dflt" then
538 str = transdmg(str) 546 str = transdmg(str)