diff options
-rw-r--r-- | arabluatex.lua | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/arabluatex.lua b/arabluatex.lua index 2cf249a..5c167e8 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -670,39 +670,21 @@ function cap(str) | |||
670 | body = string.sub(body, 2, -2) | 670 | body = string.sub(body, 2, -2) |
671 | return string.format("%s", body) | 671 | return string.format("%s", body) |
672 | end) | 672 | end) |
673 | -- protect bn[uai] (next line): | 673 | for i = 1,#lcuc do |
674 | str = string.gsub(str, "(%s)(%'?bn)", "%1{%2}") | 674 | str = string.gsub(str, "^([%S]-%-)"..lcuc[i].a, "{%1"..lcuc[i].b.."}") |
675 | if string.find(str, "[^\\]%-['`ʾʿ]") then | 675 | str = string.gsub(str, "(%s)([%S]-%-)"..lcuc[i].a, "%1{%2"..lcuc[i].b.."}") |
676 | str = string.gsub(str, "([^\\]%-['`])(%a)", "%1\\MakeUppercase{%2}") | 676 | str = string.gsub(str, "^([%S]-%-ʿ)"..lcuc[i].a, "{%1"..lcuc[i].b.."}") |
677 | str = string.gsub(str, "([^\\]%-ʿ)(%a)", "%1\\MakeUppercase{%2}") | 677 | str = string.gsub(str, "(%s)([%S]-%-ʿ)"..lcuc[i].a, "%1{%2"..lcuc[i].b.."}") |
678 | str = string.gsub(str, "([^\\]%-ʾ)(%a)", "%1\\MakeUppercase{%2}") | 678 | str = string.gsub(str, "^([%S]-%-ʾ)"..lcuc[i].a, "{%1"..lcuc[i].b.."}") |
679 | end | 679 | str = string.gsub(str, "(%s)([%S]-%-ʾ)"..lcuc[i].a, "%1{%2"..lcuc[i].b.."}") |
680 | if string.find(str, "[^\\]%-[^'`ʾʿ]") then | 680 | str = string.gsub(str, "^(ʾ)"..lcuc[i].a, "{%1"..lcuc[i].b.."}") |
681 | str = string.gsub(str, "([^\\]%-)(%a)", "%1\\MakeUppercase{%2}") | 681 | str = string.gsub(str, "(%s)(ʾ)"..lcuc[i].a, "%1{%2"..lcuc[i].b.."}") |
682 | end | 682 | str = string.gsub(str, "^(ʿ)"..lcuc[i].a, "{%1"..lcuc[i].b.."}") |
683 | if string.find(str, "^['`ʾʿ]") then | 683 | str = string.gsub(str, "(%s)(ʿ)"..lcuc[i].a, "%1{%2"..lcuc[i].b.."}") |
684 | str = string.gsub(str, "^(['`])(%a)$", "%1\\MakeUppercase{%2}") | 684 | str = string.gsub(str, "^"..lcuc[i].a, "{%1"..lcuc[i].b.."}") |
685 | str = string.gsub(str, "^(ʿ)(%a)$", "%1\\MakeUppercase{%2}") | 685 | str = string.gsub(str, "(%s)"..lcuc[i].a, "%1{%2"..lcuc[i].b.."}") |
686 | str = string.gsub(str, "^(ʾ)(%a)$", "%1\\MakeUppercase{%2}") | 686 | end |
687 | str = string.gsub(str, "^(['`])(%a)([^%-])", "%1\\MakeUppercase{%2}%3") | 687 | return "\\txtrans{"..str.."}" |
688 | str = string.gsub(str, "^(ʿ)(%a)([^%-])", "%1\\MakeUppercase{%2}%3") | ||
689 | str = string.gsub(str, "^(ʾ)(%a)([^%-])", "%1\\MakeUppercase{%2}%3") | ||
690 | end | ||
691 | if string.find(str, "%s['`ʾʿ]") then | ||
692 | str = string.gsub(str, "(%s['`])(%a)$", "%1\\MakeUppercase{%2}") | ||
693 | str = string.gsub(str, "(%sʿ)(%a)$", "%1\\MakeUppercase{%2}") | ||
694 | str = string.gsub(str, "(%sʾ)(%a)$", "%1\\MakeUppercase{%2}") | ||
695 | str = string.gsub(str, "(%s['`])(%a)([^%-])", "%1\\MakeUppercase{%2}%3") | ||
696 | str = string.gsub(str, "(%sʿ)(%a)([^%-])", "%1\\MakeUppercase{%2}%3") | ||
697 | str = string.gsub(str, "(%sʾ)(%a)([^%-])", "%1\\MakeUppercase{%2}%3") | ||
698 | end | ||
699 | if string.find(str, "%s[ibtṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwyč]") then | ||
700 | str = string.gsub(str, "(%s)([ibtṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwyč])", "%1\\MakeUppercase %2") | ||
701 | end | ||
702 | if string.find(str, "^[ibtṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwyč]") then | ||
703 | str = string.gsub(str, "^([ibtṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwyč])", "\\MakeUppercase %1") | ||
704 | end | ||
705 | return "\\txtrans{"..str.."}" | ||
706 | end | 688 | end |
707 | 689 | ||
708 | -- this function is adapted from an 'obsolete project' of Khaled | 690 | -- this function is adapted from an 'obsolete project' of Khaled |