aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2018-01-01 13:17:35 +0100
committerRobert Alessi <alessi@robertalessi.net>2018-01-01 13:17:35 +0100
commitc2f93750b7bf2650d9ce8b826e601ce169838285 (patch)
treea757d7fe335b1fb1bb003a384ff20741b077a5ef
parent78614c74f28565a3478a37a2fc594c6538ed13b5 (diff)
downloadarabluatex-c2f93750b7bf2650d9ce8b826e601ce169838285.tar.gz
done rewriting \cap
-rw-r--r--arabluatex.lua48
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
705return "\\txtrans{"..str.."}"
706end 688end
707 689
708-- this function is adapted from an 'obsolete project' of Khaled 690-- this function is adapted from an 'obsolete project' of Khaled