From 42a1cf54a5537eedef0b33a6b8ee762fa10f7145 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Tue, 13 Dec 2016 19:29:08 +0100
Subject: verse: done implementing 'arabverse' and \bayt

---
 arabluatex.dtx | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

(limited to 'arabluatex.dtx')

diff --git a/arabluatex.dtx b/arabluatex.dtx
index f728dc4..e1a5d29 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -2968,9 +2968,10 @@ wa-ya.sIru ta.hta 'l-jild-i
 % \end{environment}
 % \begin{environment}{arabverse}
 %   \changes{v1.6}{2016/11/30}{New environment \texttt{arabverse} for
-%   typesetting Arabic poetry} The environment |arabverse| may receive
-%   different options: |width|, |metre|, |utf| and |mode|; all of them
-%   are defined here just before the environment |arabverse|:
+%   typesetting Arabic poetry} The |arabverse| environment may receive
+%   different options: |width|, |tadwirwidth|, |metre|, |utf| and
+%   |mode|; all of them are defined here just before the |arabverse|
+%   environment:
 %    \begin{macrocode}
 \newlength{\al@bayt@width}
 \newlength{\al@tadwir@width}
@@ -2980,10 +2981,11 @@ wa-ya.sIru ta.hta 'l-jild-i
 \define@key[al]{verse}{tadwirwidth}{\setlength{\al@tadwir@width}{#1}}
 \define@key[al]{verse}{metre}{\arb{#1}}
 \define@boolkey[al]{verse}{utf}[true]{}
+\define@boolkey[al]{verse}{delim}[true]{}
 \define@choicekey[al]{verse}{mode}{fullvoc, voc, novoc,
   trans}{\def\al@mode{#1}}
-\presetkeys[al]{verse}{metre=\LR{\vskip -\baselineskip}}{}
-\presetkeys[al]{verse}{utf=false}{}
+\presetkeys[al]{verse}{metre=\LR{\vskip -\baselineskip}, utf=false,
+  delim=false}{}
 %    \end{macrocode}
 % Then follows the environment itself:
 %    \begin{macrocode}
@@ -3014,15 +3016,20 @@ wa-ya.sIru ta.hta 'l-jild-i
 %   the document to change this default setting.
 % \end{macro}
 %    \begin{macrocode}
+\NewDocumentCommand{\arb@utf}{m}{%
+  \ifal@verse@utf\txarb{#1}\else\arb{#1}\fi}
 \def\al@hemistich@delim{*}
 \NewDocumentCommand{\SetHemistichDelim}{m}{\def\al@hemistich@delim{#1}}
 \def\al@verse@stroke{\leavevmode\xleaders\hbox{\arb{--}}\hfill\kern0pt}
 \NewDocumentCommand{\bayt}{m o m}{%
   \ifdefined\savenotes\savenotes\else\fi%
   \edef\al@tatweel{--}%
-  \adjustbox{width=\al@bayt@width, height=\Height}{\arb{#1}}%
+  \adjustbox{width=\al@bayt@width, height=\Height}{\arb@utf{#1}}%
   \IfNoValueTF{#2}{%
+    \ifal@verse@delim\makebox[\al@tadwir@width][c]{\al@hemistich@delim}%
+    \else%
     \hspace{\al@tadwir@width}%
+    \fi
   }{%
     \edef\@tempa{#2}%
     \ifx\@tempa\al@tatweel%
@@ -3032,9 +3039,9 @@ wa-ya.sIru ta.hta 'l-jild-i
     \makebox[\al@tadwir@width][s]{\al@verse@stroke}%
     \fi%
     \else%
-    \adjustbox{center=\al@tadwir@width, height=\Height}{\arb{#2}}
+    \adjustbox{center=\al@tadwir@width, height=\Height}{\arb@utf{#2}}%
     \fi}%
-  \adjustbox{width=\al@bayt@width, height=\Height}{\arb{#3}}%
+  \adjustbox{width=\al@bayt@width, height=\Height}{\arb@utf{#3}}%
   \ifdefined\spewnotes\spewnotes\else\fi%
 }
 %    \end{macrocode}
-- 
cgit v1.2.3

