diff options
author | Robert Alessi <alessi@robertalessi.net> | 2018-08-22 11:38:56 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2018-08-22 11:38:56 +0200 |
commit | 1ef40807d6c01d959e5f0898e9b2dcd0520879cf (patch) | |
tree | 50602bc0b3f056a0d8b5be621261d52d32058ce6 | |
parent | 61d5a915f7f5d50b12aae803e75f388bda71fcba (diff) | |
download | arabluatex-1ef40807d6c01d959e5f0898e9b2dcd0520879cf.tar.gz |
tidy up. \abjad needs more work
-rw-r--r-- | arabluatex.lua | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/arabluatex.lua b/arabluatex.lua index 6f62f91..cf6cac2 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -721,12 +721,12 @@ local function processarbtoutf(str) | |||
721 | return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) | 721 | return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) |
722 | end) | 722 | end) |
723 | str = string.gsub(str, "(\\abjad)%s?(%b{})", function(tag, body) | 723 | str = string.gsub(str, "(\\abjad)%s?(%b{})", function(tag, body) |
724 | body = string.sub(body, 2, -2) | 724 | body = string.sub(body, 2, -2) |
725 | return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) | 725 | return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) |
726 | end) | 726 | end) |
727 | str = string.gsub(str, "(\\[Uu]c)%s?(%b{})", function(tag, body) | 727 | str = string.gsub(str, "(\\[Uu]c)%s?(%b{})", function(tag, body) |
728 | body = string.sub(body, 2, -2) | 728 | body = string.sub(body, 2, -2) |
729 | return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) | 729 | return string.format("%s\\@al@pr@ob%s\\@al@pr@cb", tag, body) |
730 | end) | 730 | end) |
731 | str = string.gsub(str, "{", "\\@al@ob") | 731 | str = string.gsub(str, "{", "\\@al@ob") |
732 | str = string.gsub(str, "} ", "\\@al@cb@sp") | 732 | str = string.gsub(str, "} ", "\\@al@cb@sp") |
@@ -755,14 +755,14 @@ function arbtoutf(str) | |||
755 | return string.format("%s{%s}", tag, body) | 755 | return string.format("%s{%s}", tag, body) |
756 | end) | 756 | end) |
757 | str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) | 757 | str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) |
758 | body = string.sub(body, 2, -2) | 758 | body = string.sub(body, 2, -2) |
759 | body = string.gsub(body, "(\\abjad)%s?(%b{})", "}%1%2\\ArbOutFile{") | 759 | body = string.gsub(body, "(\\abjad)%s?(%b{})", "}%1%2\\ArbOutFile{") |
760 | return string.format("%s{%s}", tag, body) | 760 | return string.format("%s{%s}", tag, body) |
761 | end) | 761 | end) |
762 | str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) | 762 | str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) |
763 | body = string.sub(body, 2, -2) | 763 | body = string.sub(body, 2, -2) |
764 | body = string.gsub(body, "(\\[Uu]c)%s?(%b{})", "}%1%2\\ArbOutFile{") | 764 | body = string.gsub(body, "(\\[Uu]c)%s?(%b{})", "}%1%2\\ArbOutFile{") |
765 | return string.format("%s{%s}", tag, body) | 765 | return string.format("%s{%s}", tag, body) |
766 | end) | 766 | end) |
767 | str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) | 767 | str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body) |
768 | body = string.sub(body, 2, -2) | 768 | body = string.sub(body, 2, -2) |
@@ -836,9 +836,8 @@ function processvoc(str, rules, scheme) | |||
836 | tofile = "\\txarb{"..str.."}" | 836 | tofile = "\\txarb{"..str.."}" |
837 | tooutfile(tofile) | 837 | tooutfile(tofile) |
838 | elseif export_utf == "arabverse" then | 838 | elseif export_utf == "arabverse" then |
839 | tofile = str | 839 | tofile = "\\txarb{"..str.."}" |
840 | tooutfile(tofile) | 840 | tooutfile(tofile) |
841 | -- return str | ||
842 | else | 841 | else |
843 | return str | 842 | return str |
844 | end | 843 | end |
@@ -867,9 +866,8 @@ function processfullvoc(str, rules, scheme) | |||
867 | tofile = "\\txarb{"..str.."}" | 866 | tofile = "\\txarb{"..str.."}" |
868 | tooutfile(tofile) | 867 | tooutfile(tofile) |
869 | elseif export_utf == "arabverse" then | 868 | elseif export_utf == "arabverse" then |
870 | tofile = str | 869 | tofile = "\\txarb{"..str.."}" |
871 | tooutfile(tofile) | 870 | tooutfile(tofile) |
872 | -- return str | ||
873 | else | 871 | else |
874 | return str | 872 | return str |
875 | end | 873 | end |
@@ -896,9 +894,8 @@ function processnovoc(str, rules, scheme) | |||
896 | tofile = "\\txarb{"..str.."}" | 894 | tofile = "\\txarb{"..str.."}" |
897 | tooutfile(tofile) | 895 | tooutfile(tofile) |
898 | elseif export_utf == "arabverse" then | 896 | elseif export_utf == "arabverse" then |
899 | tofile = str | 897 | tofile = "\\txarb{"..str.."}" |
900 | tooutfile(tofile) | 898 | tooutfile(tofile) |
901 | -- return str | ||
902 | else | 899 | else |
903 | return str | 900 | return str |
904 | end | 901 | end |
@@ -928,9 +925,8 @@ function processtrans(str, mode, rules, scheme) | |||
928 | tofile = str | 925 | tofile = str |
929 | tooutfile(tofile) | 926 | tooutfile(tofile) |
930 | elseif export_utf == "arabverse" then | 927 | elseif export_utf == "arabverse" then |
931 | tofile = str | 928 | tofile = "\\txarb{"..str.."}" |
932 | tooutfile(tofile) | 929 | tooutfile(tofile) |
933 | -- return str | ||
934 | else | 930 | else |
935 | return str | 931 | return str |
936 | end | 932 | end |
@@ -972,9 +968,8 @@ function processarbmarks(str) | |||
972 | tofile = str | 968 | tofile = str |
973 | tooutfile(tofile) | 969 | tooutfile(tofile) |
974 | elseif export_utf == "arabverse" then | 970 | elseif export_utf == "arabverse" then |
975 | tofile = str | 971 | tofile = "\\txarb{"..str.."}" |
976 | tooutfile(tofile) | 972 | tooutfile(tofile) |
977 | -- return str | ||
978 | else | 973 | else |
979 | return str | 974 | return str |
980 | end | 975 | end |
@@ -1032,15 +1027,12 @@ function uc(str) | |||
1032 | for i = 1,#lcuc do | 1027 | for i = 1,#lcuc do |
1033 | str = string.gsub(str, "(%s[%(%<%[]?)"..lcuc[i].a, "%1"..lcuc[i].b) | 1028 | str = string.gsub(str, "(%s[%(%<%[]?)"..lcuc[i].a, "%1"..lcuc[i].b) |
1034 | end | 1029 | end |
1035 | -- return "\\txtrans{"..str.."}" | ||
1036 | -- | ||
1037 | if export_utf == "yes" then | 1030 | if export_utf == "yes" then |
1038 | tofile = "\\txtrans{"..str.."}" | 1031 | tofile = "\\txtrans{"..str.."}" |
1039 | tooutfile(tofile) | 1032 | tooutfile(tofile) |
1040 | elseif export_utf == "arabverse" then | 1033 | elseif export_utf == "arabverse" then |
1041 | tofile = "\\txtrans{"..str.."}" | 1034 | tofile = "\\txtrans{"..str.."}" |
1042 | tooutfile(tofile) | 1035 | tooutfile(tofile) |
1043 | -- return "\\txtrans{"..str.."}" | ||
1044 | else | 1036 | else |
1045 | return "\\txtrans{"..str.."}" | 1037 | return "\\txtrans{"..str.."}" |
1046 | end | 1038 | end |
@@ -1070,7 +1062,17 @@ function abjadify(n) | |||
1070 | if n >= 1 then | 1062 | if n >= 1 then |
1071 | abjadnum = abjadnum .. abjad[1][math.floor(n/1)] | 1063 | abjadnum = abjadnum .. abjad[1][math.floor(n/1)] |
1072 | end | 1064 | end |
1073 | return "\\arb[novoc]{"..abjadnum.."}" | 1065 | -- return "\\arb[novoc]{"..abjadnum.."}" |
1066 | if export_utf == "yes" then | ||
1067 | tofile = "\\arb[novoc]{"..abjadnum.."}" | ||
1068 | tooutfile(tofile) | ||
1069 | elseif export_utf == "arabverse" then | ||
1070 | tofile = "\\arb[novoc]{"..abjadnum.."}" | ||
1071 | tooutfile(tofile) | ||
1072 | else | ||
1073 | return "\\arb[novoc]{"..abjadnum.."}" | ||
1074 | end | ||
1075 | return "" | ||
1074 | end | 1076 | end |
1075 | 1077 | ||
1076 | function abraces(str) | 1078 | function abraces(str) |