diff options
author | Robert Alessi <alessi@robertalessi.net> | 2016-05-18 20:20:46 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2016-05-18 20:20:46 +0200 |
commit | f84ee7e82d37dac9180f352f29c68bac5c0c742a (patch) | |
tree | b7d60a5de4b77c3f0679b8fb2fdf441c38a97dcf | |
parent | 9de240830b64aa93f0d2b66382a48c754afbd639 (diff) | |
download | arabluatex-f84ee7e82d37dac9180f352f29c68bac5c0c742a.tar.gz |
first implementation of \arbup viz. superscript tanwīn in |dmg| mode
-rw-r--r-- | arabluatex.dtx | 20 | ||||
-rw-r--r-- | arabluatex.lua | 9 | ||||
-rw-r--r-- | arabluatex_fullvoc.lua | 4 | ||||
-rw-r--r-- | arabluatex_trans.lua | 33 | ||||
-rw-r--r-- | arabluatex_voc.lua | 4 |
5 files changed, 44 insertions, 26 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx index 995be49..2e3dc7e 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx | |||
@@ -2144,8 +2144,8 @@ wa-ya.sIru ta.hta 'l-jildi | |||
2144 | % \end{macro} | 2144 | % \end{macro} |
2145 | % \end{macro} | 2145 | % \end{macro} |
2146 | % \begin{macro}{\SetTranslitStyle} By default any transliterated | 2146 | % \begin{macro}{\SetTranslitStyle} By default any transliterated |
2147 | % Arabic text is printed in italics. This can be changed globally in | 2147 | % Arabic text is printed in italics. This can be changed either |
2148 | % the preamble or at any point of the document: | 2148 | % globally in the preamble or at any point of the document: |
2149 | % \begin{macrocode} | 2149 | % \begin{macrocode} |
2150 | \def\al@trans@style{\itshape}% | 2150 | \def\al@trans@style{\itshape}% |
2151 | \NewDocumentCommand{\SetTranslitStyle}{m}{\def\al@trans@style{#1}} | 2151 | \NewDocumentCommand{\SetTranslitStyle}{m}{\def\al@trans@style{#1}} |
@@ -2159,6 +2159,22 @@ wa-ya.sIru ta.hta 'l-jildi | |||
2159 | \NewDocumentCommand{\SetTranslitConvention}{m}{\def\al@trans@convention{#1}} | 2159 | \NewDocumentCommand{\SetTranslitConvention}{m}{\def\al@trans@convention{#1}} |
2160 | % \end{macrocode} | 2160 | % \end{macrocode} |
2161 | % \end{macro} | 2161 | % \end{macro} |
2162 | % \begin{macro}{\arbup} | ||
2163 | % \begin{macro}{\SetArbUp} | ||
2164 | % By default, \cs{arbup} is set to \cs{textsuperscript}. This is how | ||
2165 | % the \arb[trans]{tanwIn} that takes place at the end of a word | ||
2166 | % should be displayed in |dmg| mode. \cs{SetArbUp} may be used | ||
2167 | % either in the preamble or at any point of the document to change | ||
2168 | % the default definition. | ||
2169 | % \begin{macrocode} | ||
2170 | \NewDocumentCommand{\al@arbup@dflt}{m}{\textsuperscript{\thinspace#1}}% | ||
2171 | \NewDocumentCommand{\al@arbup}{m}{\al@arbup@dflt{#1}} | ||
2172 | \NewDocumentCommand{\arbup}{m}{\al@arbup{#1}} | ||
2173 | \NewDocumentCommand{\ArbUpDflt}{}{\let\al@arbup=\al@arbup@dflt} | ||
2174 | \NewDocumentCommand{\NoArbUp}{}{\RenewDocumentCommand{\al@arbup}{m}{##1}} | ||
2175 | % \end{macrocode} | ||
2176 | % \end{macro} | ||
2177 | % \end{macro} | ||
2162 | % \begin{macro}{\cap} Proper Arabic names or book titles should be | 2178 | % \begin{macro}{\cap} Proper Arabic names or book titles should be |
2163 | % passed to the command \cs{cap} so that they have their first letters | 2179 | % passed to the command \cs{cap} so that they have their first letters |
2164 | % uppercased. \cs{cap} is actually coded in Lua. | 2180 | % uppercased. \cs{cap} is actually coded in Lua. |
diff --git a/arabluatex.lua b/arabluatex.lua index 0bb4756..eb0d55c 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -123,11 +123,12 @@ local function takeoutabjad(str) | |||
123 | return str | 123 | return str |
124 | end | 124 | end |
125 | 125 | ||
126 | local function takeoutcap(str) | 126 | local function takeoutcapetc(str) |
127 | str = string.gsub(str, "(\\cap.?)(%b{})", function(tag, body) | 127 | str = string.gsub(str, "(\\cap.?)(%b{})", function(tag, body) |
128 | body = string.sub(body, 2, -2) | 128 | body = string.sub(body, 2, -2) |
129 | return string.format("%s", body) | 129 | return string.format("%s", body) |
130 | end) | 130 | end) |
131 | str = string.gsub(str, "\\linebreak", "") | ||
131 | return str | 132 | return str |
132 | end | 133 | end |
133 | 134 | ||
@@ -421,7 +422,7 @@ end | |||
421 | 422 | ||
422 | function processvoc(str, rules) | 423 | function processvoc(str, rules) |
423 | str = "\\arb{".. str.."}" | 424 | str = "\\arb{".. str.."}" |
424 | str = takeoutcap(str) | 425 | str = takeoutcapetc(str) |
425 | str = protectarb(str) | 426 | str = protectarb(str) |
426 | str = breakcmd(str) | 427 | str = breakcmd(str) |
427 | str = holdcmd(str) | 428 | str = holdcmd(str) |
@@ -436,7 +437,7 @@ end | |||
436 | 437 | ||
437 | function processfullvoc(str, rules) | 438 | function processfullvoc(str, rules) |
438 | str = "\\arb{".. str.."}" | 439 | str = "\\arb{".. str.."}" |
439 | str = takeoutcap(str) | 440 | str = takeoutcapetc(str) |
440 | str = protectarb(str) | 441 | str = protectarb(str) |
441 | str = breakcmd(str) | 442 | str = breakcmd(str) |
442 | str = holdcmd(str) | 443 | str = holdcmd(str) |
@@ -451,7 +452,7 @@ end | |||
451 | 452 | ||
452 | function processnovoc(str) | 453 | function processnovoc(str) |
453 | str = "\\arb{".. str.."}" | 454 | str = "\\arb{".. str.."}" |
454 | str = takeoutcap(str) | 455 | str = takeoutcapetc(str) |
455 | str = protectarb(str) | 456 | str = protectarb(str) |
456 | str = breakcmd(str) | 457 | str = breakcmd(str) |
457 | str = holdcmd(str) | 458 | str = holdcmd(str) |
diff --git a/arabluatex_fullvoc.lua b/arabluatex_fullvoc.lua index a2676e0..577fff7 100644 --- a/arabluatex_fullvoc.lua +++ b/arabluatex_fullvoc.lua | |||
@@ -238,7 +238,7 @@ tanwinfv = { | |||
238 | {a="(T)(aN)", b="%1ً"}, | 238 | {a="(T)(aN)", b="%1ً"}, |
239 | {a="(ء)(aN)", b="%1ً"}, | 239 | {a="(ء)(aN)", b="%1ً"}, |
240 | {a="([^TA])(aN)", b="%1ًا"}, | 240 | {a="([^TA])(aN)", b="%1ًا"}, |
241 | {a="(iN)", b="ٍ"} | 241 | {a="(iNI?)", b="ٍ"} |
242 | } | 242 | } |
243 | 243 | ||
244 | tanwinfveasy = { -- no assimilations (see below) | 244 | tanwinfveasy = { -- no assimilations (see below) |
@@ -273,7 +273,7 @@ tanwinfveasy = { -- no assimilations (see below) | |||
273 | {a="(T)(aN)", b="%1ً"}, | 273 | {a="(T)(aN)", b="%1ً"}, |
274 | {a="(ء)(aN)", b="%1ً"}, | 274 | {a="(ء)(aN)", b="%1ً"}, |
275 | {a="([^TA])(aN)", b="%1ًا"}, | 275 | {a="([^TA])(aN)", b="%1ًا"}, |
276 | {a="(iN)", b="ٍ"} | 276 | {a="(iNI?)", b="ٍ"} |
277 | } | 277 | } |
278 | 278 | ||
279 | trigraphsfv = { -- trigraphs or more | 279 | trigraphsfv = { -- trigraphs or more |
diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua index c96a9da..fbea94b 100644 --- a/arabluatex_trans.lua +++ b/arabluatex_trans.lua | |||
@@ -127,23 +127,24 @@ hamzatrdmg = { | |||
127 | } | 127 | } |
128 | 128 | ||
129 | tanwintrdmg = { | 129 | tanwintrdmg = { |
130 | {a="uNU", b="un"}, | 130 | {a="uNU", b="\\arbup{un}"}, |
131 | {a="aNU", b="an"}, | 131 | {a="aNU", b="\\arbup{an}"}, |
132 | {a="iNU", b="in"}, | 132 | {a="iNU", b="\\arbup{in}"}, |
133 | {a="iNI", b="i\\arbup{n}"}, | ||
133 | -- tanwīn preceding ʾalif conjunctionis | 134 | -- tanwīn preceding ʾalif conjunctionis |
134 | {a="(uN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="uni%2%3"}, | 135 | {a="(uN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="\\arbup{uni}%2%3"}, |
135 | {a="(aN)(_A)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạni%3%4"}, | 136 | {a="(aN)(_A)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạ\\arbup{ni}%3%4"}, |
136 | {a="(aN)(Y)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạni%3%4"}, | 137 | {a="(aN)(Y)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạ\\arbup{ni}%3%4"}, |
137 | {a="(T)(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="tani%3%4"}, | 138 | {a="(T)(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="t\\arbup{ani}%3%4"}, |
138 | {a="([^TA])(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1ani%3%4"}, | 139 | {a="([^TA])(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1\\arbup{ani}%3%4"}, |
139 | {a="(iN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ini%2%3"}, | 140 | {a="(iN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="\\arbup{ini}%2%3"}, |
140 | -- | 141 | -- |
141 | {a="uN", b="un"}, | 142 | {a="uN", b="\\arbup{un}"}, |
142 | {a="(aN)(_A)", b="ạn"}, | 143 | {a="(aN)(_A)", b="ạ\\arbup{n}"}, |
143 | {a="(aN)(Y)", b="ạn"}, | 144 | {a="(aN)(Y)", b="ạ\\arbup{n}"}, |
144 | {a="(T)(\"?aN)", b="tan"}, | 145 | {a="(T)(\"?aN)", b="t\\arbup{an}"}, |
145 | {a="([^TA])(\"?aN)", b="%1an"}, | 146 | {a="([^TA])(\"?aN)", b="%1\\arbup{an}"}, |
146 | {a="iN", b="in"} | 147 | {a="iN", b="\\arbup{in}"} |
147 | } | 148 | } |
148 | 149 | ||
149 | trigraphstrdmg = { -- trigraphs or more | 150 | trigraphstrdmg = { -- trigraphs or more |
@@ -198,7 +199,7 @@ trigraphstrdmg = { -- trigraphs or more | |||
198 | {a="(_a)U", b="A"}, | 199 | {a="(_a)U", b="A"}, |
199 | {a="(_a)I", b="A"}, | 200 | {a="(_a)I", b="A"}, |
200 | -- assimilations | 201 | -- assimilations |
201 | {a="(n)(%s)([rlmnwy])", b="%3%2%3"} | 202 | {a="(n)(})(%s)([rlmnwy])", b="%4%2%3%4"} |
202 | } | 203 | } |
203 | 204 | ||
204 | trigraphstrdmgeasy = { -- see the differences below under 'easy' tag | 205 | trigraphstrdmgeasy = { -- see the differences below under 'easy' tag |
diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua index 4f5399f..878f351 100644 --- a/arabluatex_voc.lua +++ b/arabluatex_voc.lua | |||
@@ -267,7 +267,7 @@ tanwin = { | |||
267 | {a="(T)(aN)", b="%1ً"}, | 267 | {a="(T)(aN)", b="%1ً"}, |
268 | {a="(ء)(aN)", b="%1ً"}, | 268 | {a="(ء)(aN)", b="%1ً"}, |
269 | {a="([^TA])(aN)", b="%1ًا"}, | 269 | {a="([^TA])(aN)", b="%1ًا"}, |
270 | {a="(iN)", b="ٍ"} | 270 | {a="(iNI?)", b="ٍ"} |
271 | } | 271 | } |
272 | 272 | ||
273 | tanwineasy = { -- 'easy' requires some lines to be taken out: | 273 | tanwineasy = { -- 'easy' requires some lines to be taken out: |
@@ -300,7 +300,7 @@ tanwineasy = { -- 'easy' requires some lines to be taken out: | |||
300 | {a="(T)(aN)", b="%1ً"}, | 300 | {a="(T)(aN)", b="%1ً"}, |
301 | {a="(ء)(aN)", b="%1ً"}, | 301 | {a="(ء)(aN)", b="%1ً"}, |
302 | {a="([^TA])(aN)", b="%1ًا"}, | 302 | {a="([^TA])(aN)", b="%1ًا"}, |
303 | {a="(iN)", b="ٍ"} | 303 | {a="(iNI?)", b="ٍ"} |
304 | } | 304 | } |
305 | 305 | ||
306 | trigraphs = { -- trigraphs or more | 306 | trigraphs = { -- trigraphs or more |