diff options
author | Robert Alessi <alessi@robertalessi.net> | 2018-06-16 13:29:57 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2018-06-16 13:29:57 +0200 |
commit | b92f35ef29f872cc17e2718dd0fb63d0a2d5db24 (patch) | |
tree | 813c7f114c2354bf51a80db7523727166edc67f1 | |
parent | dfc06e1002a8c0ff40f2d7471c6d1b463a98a86e (diff) | |
download | arabluatex-b92f35ef29f872cc17e2718dd0fb63d0a2d5db24.tar.gz |
\arbcolor[]{} is now able to colorize everything, down to the diacritics!
-rw-r--r-- | arabluatex.dtx | 8 | ||||
-rw-r--r-- | arabluatex.lua | 36 | ||||
-rw-r--r-- | arabluatex_voc.lua | 3 |
3 files changed, 27 insertions, 20 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx index 3b74ab6..7f7a29b 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx | |||
@@ -2561,11 +2561,9 @@ word that \cs{arbnull} is applied to. | |||
2561 | % \fi | 2561 | % \fi |
2562 | % | 2562 | % |
2563 | % \paragraph{Color}\NEWfeature{v1.12} this: | 2563 | % \paragraph{Color}\NEWfeature{v1.12} this: |
2564 | % \begingroup \newfontfamily\arabicfont{FreeSerif}[Script=Arabic] | 2564 | % \begin{arab}[trans] |
2565 | % \arb{da_hal"+\arbcolor[red]{+t\arbcolor[blue]{+u}} | 2565 | % daxal\arbcolor[red]{tu} mub\arbcolor[blue]{ta}si\arbcolor[green]{maN} |
2566 | % mub"t+\arbcolor[brown]{+a}s+\arbcolor[blue]{+i\arbcolor[brown]{+maN}}} | 2566 | % \end{arab} |
2567 | % \endgroup | ||
2568 | % | ||
2569 | % \section{Transliteration} | 2567 | % \section{Transliteration} |
2570 | % \label{sec:transliteration} | 2568 | % \label{sec:transliteration} |
2571 | % It may be more appropriate to speak of \enquote{romanization} than | 2569 | % It may be more appropriate to speak of \enquote{romanization} than |
diff --git a/arabluatex.lua b/arabluatex.lua index 11a91c3..84562be 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -128,15 +128,15 @@ local function breakcmd(str) | |||
128 | bodytext = string.sub(bodytext, 2, -2) | 128 | bodytext = string.sub(bodytext, 2, -2) |
129 | return string.format("\\al@brk{\\%s{%s}{\\arb{%s}}}", tag, bodycolor, bodytext) | 129 | return string.format("\\al@brk{\\%s{%s}{\\arb{%s}}}", tag, bodycolor, bodytext) |
130 | end) | 130 | end) |
131 | -- \arbcolor | 131 | -- -- \arbcolor |
132 | str = string.gsub(str, "(.)(\\arbcolor%s?)(%b[])(%b{})(.)", | 132 | -- str = string.gsub(str, "(.)(\\arbcolor%s?)(%b[])(%b{})(.)", |
133 | function (li, tag, opt, body, lii) | 133 | -- function (li, tag, opt, body, lii) |
134 | li = string.gsub(li, "%+", "") -- ^^^^200d | 134 | -- li = string.gsub(li, "%+", "") -- ^^^^200d |
135 | lii = string.gsub(lii, "%+", "") -- ^^^^200d | 135 | -- lii = string.gsub(lii, "%+", "") -- ^^^^200d |
136 | body = string.sub(body, 2, -2) | 136 | -- body = string.sub(body, 2, -2) |
137 | body = string.gsub(body, "%+", "") -- ^^^^200d | 137 | -- body = string.gsub(body, "%+", "") -- ^^^^200d |
138 | return string.format("%s%s%s{%s}%s", li, tag, opt, body, lii) | 138 | -- return string.format("%s%s%s{%s}%s", li, tag, opt, body, lii) |
139 | end) | 139 | -- end) |
140 | -- commands set by default in outofarb | 140 | -- commands set by default in outofarb |
141 | for i = 1,#outofarb do | 141 | for i = 1,#outofarb do |
142 | str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, "}%1%2%3\\arb{") | 142 | str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, "}%1%2%3\\arb{") |
@@ -308,7 +308,8 @@ local function voc(str, rules) | |||
308 | inside = string.gsub(inside, null[i].a, null[i].b) | 308 | inside = string.gsub(inside, null[i].a, null[i].b) |
309 | end | 309 | end |
310 | inside = indnum(inside) | 310 | inside = indnum(inside) |
311 | return string.format("\\txarb{%s}", inside) | 311 | -- return string.format("\\txarb{%s}", inside) |
312 | return string.format("%s", inside) | ||
312 | end) | 313 | end) |
313 | return str | 314 | return str |
314 | end | 315 | end |
@@ -344,7 +345,8 @@ local function voceasy(str) | |||
344 | inside = string.gsub(inside, null[i].a, null[i].b) | 345 | inside = string.gsub(inside, null[i].a, null[i].b) |
345 | end | 346 | end |
346 | inside = indnum(inside) | 347 | inside = indnum(inside) |
347 | return string.format("\\txarb{%s}", inside) | 348 | -- return string.format("\\txarb{%s}", inside) |
349 | return string.format("%s", inside) | ||
348 | end) | 350 | end) |
349 | return str | 351 | return str |
350 | end | 352 | end |
@@ -397,7 +399,8 @@ local function fullvoc(str, rules) | |||
397 | inside = string.gsub(inside, null[i].a, null[i].b) | 399 | inside = string.gsub(inside, null[i].a, null[i].b) |
398 | end | 400 | end |
399 | inside = indnum(inside) | 401 | inside = indnum(inside) |
400 | return string.format("\\txarb{%s}", inside) | 402 | -- return string.format("\\txarb{%s}", inside) |
403 | return string.format("%s", inside) | ||
401 | end) | 404 | end) |
402 | return str | 405 | return str |
403 | end | 406 | end |
@@ -445,7 +448,8 @@ local function fullvoceasy(str, rules) | |||
445 | inside = string.gsub(inside, null[i].a, null[i].b) | 448 | inside = string.gsub(inside, null[i].a, null[i].b) |
446 | end | 449 | end |
447 | inside = indnum(inside) | 450 | inside = indnum(inside) |
448 | return string.format("\\txarb{%s}", inside) | 451 | -- return string.format("\\txarb{%s}", inside) |
452 | return string.format("%s", inside) | ||
449 | end) | 453 | end) |
450 | return str | 454 | return str |
451 | end | 455 | end |
@@ -481,7 +485,8 @@ local function novoc(str) | |||
481 | inside = string.gsub(inside, null[i].a, null[i].b) | 485 | inside = string.gsub(inside, null[i].a, null[i].b) |
482 | end | 486 | end |
483 | inside = indnum(inside) | 487 | inside = indnum(inside) |
484 | return string.format("\\txarb{%s}", inside) | 488 | -- return string.format("\\txarb{%s}", inside) |
489 | return string.format("%s", inside) | ||
485 | end) | 490 | end) |
486 | return str | 491 | return str |
487 | end | 492 | end |
@@ -517,7 +522,8 @@ local function novoceasy(str) | |||
517 | inside = string.gsub(inside, null[i].a, null[i].b) | 522 | inside = string.gsub(inside, null[i].a, null[i].b) |
518 | end | 523 | end |
519 | inside = indnum(inside) | 524 | inside = indnum(inside) |
520 | return string.format("\\txarb{%s}", inside) | 525 | -- return string.format("\\txarb{%s}", inside) |
526 | return string.format("%s", inside) | ||
521 | end) | 527 | end) |
522 | return str | 528 | return str |
523 | end | 529 | end |
diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua index 919a81d..c9d0334 100644 --- a/arabluatex_voc.lua +++ b/arabluatex_voc.lua | |||
@@ -836,6 +836,9 @@ shortv = { | |||
836 | {a="\"u", b=""}, | 836 | {a="\"u", b=""}, |
837 | {a="\"a", b=""}, | 837 | {a="\"a", b=""}, |
838 | {a="\"i", b=""}, | 838 | {a="\"i", b=""}, |
839 | {a="%.u", b="ُ"}, | ||
840 | {a="%.a", b="َ"}, | ||
841 | {a="%.i", b="ِ"}, | ||
839 | {a="u", b="ُ"}, | 842 | {a="u", b="ُ"}, |
840 | {a="a", b="َ"}, | 843 | {a="a", b="َ"}, |
841 | {a="i", b="ِ"} | 844 | {a="i", b="ِ"} |