diff options
author | Robert Alessi <alessi@robertalessi.net> | 2018-11-05 16:58:45 +0100 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2018-11-05 16:58:45 +0100 |
commit | 24ee8b967d423d9aeebd31fd9c4f9486ee3584fb (patch) | |
tree | 4da6c40b3eec92287466762096cb3afed58c648d | |
parent | 71bb7b1ec3a78225955c85b93a7011e1ba315e58 (diff) | |
download | arabluatex-24ee8b967d423d9aeebd31fd9c4f9486ee3584fb.tar.gz |
better exporting of transliterated Arabic
-rw-r--r-- | arabluatex.dtx | 25 | ||||
-rw-r--r-- | arabluatex.lua | 28 |
2 files changed, 29 insertions, 24 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx index 854fd98..5ccf530 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx | |||
@@ -261,7 +261,7 @@ | |||
261 | %</driver> | 261 | %</driver> |
262 | % \fi | 262 | % \fi |
263 | % | 263 | % |
264 | % \CheckSum{899} | 264 | % \CheckSum{0} |
265 | % | 265 | % |
266 | % \CharacterTable | 266 | % \CharacterTable |
267 | % {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 | 267 | % {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 |
@@ -4643,7 +4643,7 @@ wa-ya.sIru ta.hta 'l-jild-i | |||
4643 | \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% | 4643 | \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% |
4644 | \else% | 4644 | \else% |
4645 | \ifx\@tempa\al@mode@trans% | 4645 | \ifx\@tempa\al@mode@trans% |
4646 | \bgroup\textdir TLT\al@trans@style% | 4646 | \bgroup\textdir TLT\al@trans@font\al@trans@style% |
4647 | \luadirect{tex.sprint(processtrans(\luastringN{#2}, | 4647 | \luadirect{tex.sprint(processtrans(\luastringN{#2}, |
4648 | \luastringO{\al@trans@convention}, | 4648 | \luastringO{\al@trans@convention}, |
4649 | \luastringO{\al@arb@rules}, | 4649 | \luastringO{\al@arb@rules}, |
@@ -4707,7 +4707,7 @@ wa-ya.sIru ta.hta 'l-jild-i | |||
4707 | \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% | 4707 | \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% |
4708 | \else% | 4708 | \else% |
4709 | \ifx\@tempa\al@mode@trans% | 4709 | \ifx\@tempa\al@mode@trans% |
4710 | \bgroup\pardir TLT\textdir TLT\al@trans@style% | 4710 | \bgroup\pardir TLT\textdir TLT\al@trans@font\al@trans@style% |
4711 | \luadirect{tex.sprint(processtrans(\luastringO{\BODY}, | 4711 | \luadirect{tex.sprint(processtrans(\luastringO{\BODY}, |
4712 | \luastringO{\al@trans@convention}, | 4712 | \luastringO{\al@trans@convention}, |
4713 | \luastringO{\al@arb@rules}, | 4713 | \luastringO{\al@arb@rules}, |
@@ -4748,18 +4748,23 @@ wa-ya.sIru ta.hta 'l-jild-i | |||
4748 | metre]{#1}% | 4748 | metre]{#1}% |
4749 | \if@pkg@export\ifal@verse@export% | 4749 | \if@pkg@export\ifal@verse@export% |
4750 | \ArbOutFile{\begin{arabverse}}% | 4750 | \ArbOutFile{\begin{arabverse}}% |
4751 | \ifx\al@mode\al@mode@trans% | 4751 | % \ifx\al@mode\al@mode@trans% |
4752 | \luadirect{tooutfile(\luastringN{[#1]})}% | 4752 | % \luadirect{tooutfile(\luastringN{[#1]})}% |
4753 | \else% | 4753 | % \else% |
4754 | \IfSubStr[1]{#1}{utf}% | 4754 | \IfSubStr[1]{#1}{utf}% |
4755 | {\luadirect{tooutfile(\luastringN{[#1]})}}% | 4755 | {\luadirect{tooutfile(\luastringN{[#1]})}}% |
4756 | {\luadirect{tooutfile(\luastringN{[#1, utf]})}}% | 4756 | {\luadirect{tooutfile(\luastringN{[#1, utf]})}}% |
4757 | \fi | 4757 | % \fi |
4758 | \else\fi\else\fi\egroup% | 4758 | \else\fi\else\fi\egroup% |
4759 | \par\centering\noindent\bgroup\setkeys[al]{verse}[metre]{#1}% | 4759 | \par\centering\noindent\bgroup\setkeys[al]{verse}[metre]{#1}% |
4760 | \ifx\al@mode\al@mode@trans% | 4760 | % \ifx\al@mode\al@mode@trans% |
4761 | \ifal@verse@utf\setRL\else\setLR\fi% | 4761 | % \ifal@verse@utf\setRL\else\setLR\fi% |
4762 | \else\setRL\fi% | 4762 | % \else\setRL\fi% |
4763 | \ifal@verse@utf% | ||
4764 | \ifx\al@mode\al@mode@trans\setLR\else\setRL\fi% | ||
4765 | \else% | ||
4766 | \ifx\al@mode\al@mode@trans\setLR\else\setRL\fi% | ||
4767 | \fi% | ||
4763 | \arab@v@export{#1} | 4768 | \arab@v@export{#1} |
4764 | }% | 4769 | }% |
4765 | {\endarab@v@export | 4770 | {\endarab@v@export |
diff --git a/arabluatex.lua b/arabluatex.lua index 09c1acb..2c8dc77 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -487,7 +487,7 @@ local function novoc(str) | |||
487 | inside = indnum(inside) | 487 | inside = indnum(inside) |
488 | return string.format("\\arabicfont{}%s", inside) | 488 | return string.format("\\arabicfont{}%s", inside) |
489 | end) | 489 | end) |
490 | return str | 490 | return str |
491 | end | 491 | end |
492 | 492 | ||
493 | local function novoceasy(str) | 493 | local function novoceasy(str) |
@@ -523,7 +523,7 @@ local function novoceasy(str) | |||
523 | inside = indnum(inside) | 523 | inside = indnum(inside) |
524 | return string.format("\\arabicfont{}%s", inside) | 524 | return string.format("\\arabicfont{}%s", inside) |
525 | end) | 525 | end) |
526 | return str | 526 | return str |
527 | end | 527 | end |
528 | 528 | ||
529 | local function transdmg(str, rules) | 529 | local function transdmg(str, rules) |
@@ -561,9 +561,9 @@ local function transdmg(str, rules) | |||
561 | for i = 1,#nulltr do | 561 | for i = 1,#nulltr do |
562 | inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) | 562 | inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) |
563 | end | 563 | end |
564 | return string.format("\\txtrans{%s}", inside) | 564 | return string.format("%s", inside) |
565 | end) | 565 | end) |
566 | return str | 566 | return str |
567 | end | 567 | end |
568 | 568 | ||
569 | local function transloc(str) | 569 | local function transloc(str) |
@@ -599,9 +599,9 @@ local function transloc(str) | |||
599 | for i = 1,#nulltr do | 599 | for i = 1,#nulltr do |
600 | inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) | 600 | inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) |
601 | end | 601 | end |
602 | return string.format("\\txtrans{%s}", inside) | 602 | return string.format("%s", inside) |
603 | end) | 603 | end) |
604 | return str | 604 | return str |
605 | end | 605 | end |
606 | 606 | ||
607 | local function transarabica(str) | 607 | local function transarabica(str) |
@@ -634,9 +634,9 @@ local function transarabica(str) | |||
634 | for i = 1,#nulltr do | 634 | for i = 1,#nulltr do |
635 | inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) | 635 | inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) |
636 | end | 636 | end |
637 | return string.format("\\txtrans{%s}", inside) | 637 | return string.format("%s", inside) |
638 | end) | 638 | end) |
639 | return str | 639 | return str |
640 | end | 640 | end |
641 | 641 | ||
642 | local function processbuckw(str) | 642 | local function processbuckw(str) |
@@ -647,7 +647,7 @@ local function processbuckw(str) | |||
647 | end | 647 | end |
648 | return string.format("\\arb{%s}", inside) | 648 | return string.format("\\arb{%s}", inside) |
649 | end) | 649 | end) |
650 | return str | 650 | return str |
651 | end | 651 | end |
652 | 652 | ||
653 | -- The following functions produce a copy of the original .tex source | 653 | -- The following functions produce a copy of the original .tex source |
@@ -985,10 +985,10 @@ function processtrans(str, mode, rules, scheme) | |||
985 | end | 985 | end |
986 | str = unprotectarb(str) | 986 | str = unprotectarb(str) |
987 | if export_utf == "yes" then | 987 | if export_utf == "yes" then |
988 | tofile = str | 988 | tofile = "\\txtrans{"..str.."}" |
989 | tooutfile(tofile) | 989 | tooutfile(tofile) |
990 | elseif export_utf == "arabverse" then | 990 | elseif export_utf == "arabverse" then |
991 | tofile = str | 991 | tofile = "\\txtrans{"..str.."}" |
992 | tooutfile(tofile) | 992 | tooutfile(tofile) |
993 | else | 993 | else |
994 | return str | 994 | return str |
@@ -1100,13 +1100,13 @@ function uc(str) | |||
1100 | str = string.gsub(str, "(%s[%(%<%[]?)"..lcuc[i].a, "%1"..lcuc[i].b) | 1100 | str = string.gsub(str, "(%s[%(%<%[]?)"..lcuc[i].a, "%1"..lcuc[i].b) |
1101 | end | 1101 | end |
1102 | if export_utf == "yes" then | 1102 | if export_utf == "yes" then |
1103 | tofile = "\\txtrans{"..str.."}" | 1103 | tofile = str |
1104 | tooutfile(tofile) | 1104 | tooutfile(tofile) |
1105 | elseif export_utf == "arabverse" then | 1105 | elseif export_utf == "arabverse" then |
1106 | tofile = "\\txtrans{"..str.."}" | 1106 | tofile = str |
1107 | tooutfile(tofile) | 1107 | tooutfile(tofile) |
1108 | else | 1108 | else |
1109 | return "\\txtrans{"..str.."}" | 1109 | return str |
1110 | end | 1110 | end |
1111 | return "" | 1111 | return "" |
1112 | end | 1112 | end |