From 2eeb8fbdce276376dbbae8be0e76d7db5ae7b113 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 29 Feb 2016 21:53:35 +0100
Subject: first implementation of transliteration tables (dmg)

---
 arabluatex.dtx | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

(limited to 'arabluatex.dtx')

diff --git a/arabluatex.dtx b/arabluatex.dtx
index ec2f630..1dbfd3d 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -183,13 +183,15 @@
 %    \end{macrocode}
 %    \begin{macrocode}
 \DeclareOption{voc}{\def\al@mode{voc}}
-\DeclareOption{novoc}{\def\al@mode{novoc}}
 \DeclareOption{fullvoc}{\def\al@mode{fullvoc}}
+\DeclareOption{novoc}{\def\al@mode{novoc}}
+\DeclareOption{trans}{\def\al@mode{trans}}
 \ExecuteOptions{voc}
 \ProcessOptions\relax
 \def\al@mode@voc{voc}
 \def\al@mode@fullvoc{fullvoc}
 \def\al@mode@novoc{novoc}
+\def\al@mode@trans{trans}
 % \newif\ifal@mode@defined
 \RequirePackage{amsmath}
 \RequirePackage{etoolbox}
@@ -220,7 +222,14 @@
 \AtBeginDocument{\ifdef{\aemph}%
   {\RenewDocumentCommand{\aemph}{m}{$\overline{\text{#1}}$}}
   {\NewDocumentCommand{\aemph}{m}{$\overline{\text{#1}}$}}}
-\DeclareDocumentCommand{\txarb}{+m}{\bgroup\textdir TRT\arabicfont#1\egroup}
+\def\al@trans@style{\itshape}%
+\NewDocumentCommand{\SetTranslitStyle}{m}{\def\al@trans@style{#1}}
+\NewDocumentCommand{\SetTranslitConvention}{m}{\def\al@trans@convention{#1}}
+\def\al@trans@convention{dmg}
+\DeclareDocumentCommand{\txarb}{+m}{\bgroup\textdir
+  TRT\arabicfont#1\egroup}
+\DeclareDocumentCommand{\txtrans}{+m}{\bgroup\textdir
+  TLT\rmfamily#1\egroup}
 \DeclareDocumentCommand{\arb}{O{\al@mode} +m}%
 {\edef\@tempa{#1}%
     \ifx\@tempa\al@mode@voc%
@@ -235,7 +244,12 @@
       \bgroup\textdir TRT\arabicfont%
       \luadirect{tex.sprint(processnovoc(\luastringN{#2}))}\egroup%
     \else%
-    \fi\fi\fi}
+    \ifx\@tempa\al@mode@trans%
+      \bgroup\textdir TLT\al@trans@style%
+      \luadirect{tex.sprint(processtrans(\luastringN{#2},
+        \luastringO{\al@trans@convention}))}\egroup%
+    \else%
+    \fi\fi\fi\fi}
 \NewEnviron{arab}[1][\al@mode]%
 {\par\edef\@tempa{#1}%
     \ifx\@tempa\al@mode@voc%
@@ -250,8 +264,12 @@
       \bgroup\pardir TRT\textdir TRT\arabicfont%
       \luadirect{tex.sprint(processnovoc(\luastringO{\BODY}))}\egroup%
     \else
-      \BODY% 
-    \fi\fi\fi}[\par]
+    \ifx\@tempa\al@mode@trans%
+      \bgroup\pardir TLT\textdir TLT\al@trans@style%
+      \luadirect{tex.sprint(processtrans(\luastringO{\BODY},
+        \luastringO{\al@trans@convention}))}\egroup%
+    \else
+    \fi\fi\fi\fi}[\par]
 % \robustify{\textbf}
 % \robustify{\emph}
 % \robustify{\footnote}
-- 
cgit v1.2.3

