aboutsummaryrefslogtreecommitdiff
path: root/arabluatex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'arabluatex.lua')
-rw-r--r--arabluatex.lua33
1 files changed, 29 insertions, 4 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index b87f2dc..13db492 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -676,7 +676,7 @@ local function processarbtoutf(str)
676 str = string.gsub(str, "(\\prname)%s?(%b{})", function(tag, body) 676 str = string.gsub(str, "(\\prname)%s?(%b{})", function(tag, body)
677 body = string.sub(body, 2, -2) 677 body = string.sub(body, 2, -2)
678 if string.find(body, "\\uc%s?%b{}") then 678 if string.find(body, "\\uc%s?%b{}") then
679 return string.format("%s{%s}", tag, body) 679 return string.format("%s*{%s}", tag, body)
680 else 680 else
681 return string.format("%s{\\arb[trans]{\\uc{%s}}}", tag, body) 681 return string.format("%s{\\arb[trans]{\\uc{%s}}}", tag, body)
682 end 682 end
@@ -711,6 +711,10 @@ local function processarbtoutf(str)
711 body = string.sub(body, 2, -2) 711 body = string.sub(body, 2, -2)
712 return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) 712 return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body)
713 end) 713 end)
714 str = string.gsub(str, "(\\[Uu]c)%s?(%b{})", function(tag, body)
715 body = string.sub(body, 2, -2)
716 return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body)
717 end)
714 str = string.gsub(str, "{", "\\@al@ob") 718 str = string.gsub(str, "{", "\\@al@ob")
715 str = string.gsub(str, "} ", "\\@al@cb@sp") 719 str = string.gsub(str, "} ", "\\@al@cb@sp")
716 str = string.gsub(str, "}", "\\@al@cb") 720 str = string.gsub(str, "}", "\\@al@cb")
@@ -742,6 +746,11 @@ function arbtoutf(str)
742 end) 746 end)
743 str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) 747 str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body)
744 body = string.sub(body, 2, -2) 748 body = string.sub(body, 2, -2)
749 body = string.gsub(body, "(\\[Uu]c)%s?(%b{})", "}%1%2\\ArbOutFile{")
750 return string.format("%s{%s}", tag, body)
751 end)
752 str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body)
753 body = string.sub(body, 2, -2)
745 body = string.gsub(body, "(\\arbmark)%s?(%b{})", "}%1%2\\ArbOutFile{") 754 body = string.gsub(body, "(\\arbmark)%s?(%b{})", "}%1%2\\ArbOutFile{")
746 return string.format("%s{%s}", tag, body) 755 return string.format("%s{%s}", tag, body)
747 end) 756 end)
@@ -899,7 +908,7 @@ function processtrans(str, mode, rules, scheme)
899 str = unprotectarb(str) 908 str = unprotectarb(str)
900 if export_utf == "yes" then 909 if export_utf == "yes" then
901 tofile = str 910 tofile = str
902 tooutfile(str) 911 tooutfile(tofile)
903 elseif export_utf == "arabverse" then 912 elseif export_utf == "arabverse" then
904 tofile = str 913 tofile = str
905 tooutfile(tofile) 914 tooutfile(tofile)
@@ -943,7 +952,11 @@ function processarbmarks(str)
943-- return str 952-- return str
944 if export_utf == "yes" then 953 if export_utf == "yes" then
945 tofile = str 954 tofile = str
946 tooutfile(str) 955 tooutfile(tofile)
956 elseif export_utf == "arabverse" then
957 tofile = str
958 tooutfile(tofile)
959 return str
947 else 960 else
948 return str 961 return str
949 end 962 end
@@ -1001,7 +1014,19 @@ function uc(str)
1001 for i = 1,#lcuc do 1014 for i = 1,#lcuc do
1002 str = string.gsub(str, "(%s[%(%<%[]?)"..lcuc[i].a, "%1"..lcuc[i].b) 1015 str = string.gsub(str, "(%s[%(%<%[]?)"..lcuc[i].a, "%1"..lcuc[i].b)
1003 end 1016 end
1004 return "\\txtrans{"..str.."}" 1017-- return "\\txtrans{"..str.."}"
1018--
1019 if export_utf == "yes" then
1020 tofile = "\\txtrans{"..str.."}"
1021 tooutfile(tofile)
1022 elseif export_utf == "arabverse" then
1023 tofile = "\\txtrans{"..str.."}"
1024 tooutfile(tofile)
1025 return "\\txtrans{"..str.."}"
1026 else
1027 return "\\txtrans{"..str.."}"
1028 end
1029 return ""
1005end 1030end
1006 1031
1007-- this function is adapted from an 'obsolete project' of Khaled 1032-- this function is adapted from an 'obsolete project' of Khaled