aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2017-12-30 22:48:45 +0100
committerRobert Alessi <alessi@robertalessi.net>2017-12-30 22:48:45 +0100
commit11c466acc90d9ad3452f0c646a211a6813ebfac1 (patch)
tree9591a02c0a771e8dac5b88d2e4a7e523bf512ae8
parenta11be346f0676235ac7ef2fce518fc38cd4417a7 (diff)
downloadarabluatex-11c466acc90d9ad3452f0c646a211a6813ebfac1.tar.gz
new \cap{} almost works. More tests are needed
-rw-r--r--arabluatex.lua32
1 files changed, 19 insertions, 13 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index 593dc6c..931b239 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -670,27 +670,33 @@ 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 str = string.gsub(str, "(%s)(bn)([uai])", "%1{%2}%3") -- protect bn[uai]
673 if string.find(str, "[^\\]%-['`ʾʿ]") then 674 if string.find(str, "[^\\]%-['`ʾʿ]") then
674 str = string.gsub(str, "([^\\]%-['`])", "%1\\MakeUppercase ") 675 str = string.gsub(str, "([^\\]%-['`])(%a)", "%1\\MakeUppercase{%2}")
675 str = string.gsub(str, "([^\\]%-ʿ)", "%1\\MakeUppercase ") 676 str = string.gsub(str, "([^\\]%-ʿ)(%a)", "%1\\MakeUppercase{%2}")
676 str = string.gsub(str, "([^\\]%-ʾ)", "%1\\MakeUppercase ") 677 str = string.gsub(str, "([^\\]%-ʾ)(%a)", "%1\\MakeUppercase{%2}")
677 end 678 end
678 if string.find(str, "[^\\]a?%-[^'`ʾʿ]") then 679 if string.find(str, "[^\\]%-[^'`ʾʿ]") then
679 str = string.gsub(str, "([^\\]a?%-)", "%1\\MakeUppercase ") 680 str = string.gsub(str, "([^\\]%-)(%a)", "%1\\MakeUppercase{%2}")
680 end 681 end
681 if string.find(str, "^['`ʾʿ]") then 682 if string.find(str, "^['`ʾʿ]") then
682 str = string.gsub(str, "^(['`])", "%1\\MakeUppercase ") 683 str = string.gsub(str, "^(['`])(%a)", "%1\\MakeUppercase{%2}")
683 str = string.gsub(str, "^(ʿ)", "%1\\MakeUppercase ") 684 str = string.gsub(str, "^(ʿ)(%a)", "%1\\MakeUppercase{%2}")
684 str = string.gsub(str, "^(ʾ)", "%1\\MakeUppercase ") 685 str = string.gsub(str, "^(ʾ)(%a)", "%1\\MakeUppercase{%2}")
685 end 686 end
686 if string.find(str, "%s['`ʾʿ]") then 687 if string.find(str, "%s['`ʾʿ]") then
687 str = string.gsub(str, "(%s['`][^%-])", "%1\\MakeUppercase ") 688-- str = string.gsub(str, "(%s['`])(%a)", "%1\\MakeUppercase{%2}")
688 str = string.gsub(str, "(%sʿ)", "%1\\MakeUppercase ") 689 str = string.gsub(str, "(%sʿ)(%a)", "%1\\MakeUppercase{%2}")
689 str = string.gsub(str, "(%sʾ)", "%1\\MakeUppercase ") 690 str = string.gsub(str, "(%sʾ)(%a)", "%1\\MakeUppercase{%2}")
691 end
692 if string.find(str, "%s[btṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwy]") then
693 str = string.gsub(str, "(%s)([btṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwy])", "%1\\MakeUppercase{%2}")
694 end
695 if string.find(str, "^[btṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwy]") then
696 str = string.gsub(str, "^([btṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwy])", "\\MakeUppercase %1")
690 end 697 end
691-- str = string.gsub(str, "(%s[^'`ʾʿ])", "%1\\MakeUppercase ")
692-- else 698-- else
693 str = "\\MakeUppercase "..str 699-- str = "\\MakeUppercase "..str
694-- end 700-- end
695return "\\txtrans{"..str.."}" 701return "\\txtrans{"..str.."}"
696end 702end