From 11c466acc90d9ad3452f0c646a211a6813ebfac1 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sat, 30 Dec 2017 22:48:45 +0100 Subject: new \cap{} almost works. More tests are needed --- arabluatex.lua | 32 +++++++++++++++++++------------- 1 file 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) body = string.sub(body, 2, -2) return string.format("%s", body) end) + str = string.gsub(str, "(%s)(bn)([uai])", "%1{%2}%3") -- protect bn[uai] if string.find(str, "[^\\]%-['`ʾʿ]") then - str = string.gsub(str, "([^\\]%-['`])", "%1\\MakeUppercase ") - str = string.gsub(str, "([^\\]%-ʿ)", "%1\\MakeUppercase ") - str = string.gsub(str, "([^\\]%-ʾ)", "%1\\MakeUppercase ") + str = string.gsub(str, "([^\\]%-['`])(%a)", "%1\\MakeUppercase{%2}") + str = string.gsub(str, "([^\\]%-ʿ)(%a)", "%1\\MakeUppercase{%2}") + str = string.gsub(str, "([^\\]%-ʾ)(%a)", "%1\\MakeUppercase{%2}") end - if string.find(str, "[^\\]a?%-[^'`ʾʿ]") then - str = string.gsub(str, "([^\\]a?%-)", "%1\\MakeUppercase ") + if string.find(str, "[^\\]%-[^'`ʾʿ]") then + str = string.gsub(str, "([^\\]%-)(%a)", "%1\\MakeUppercase{%2}") end if string.find(str, "^['`ʾʿ]") then - str = string.gsub(str, "^(['`])", "%1\\MakeUppercase ") - str = string.gsub(str, "^(ʿ)", "%1\\MakeUppercase ") - str = string.gsub(str, "^(ʾ)", "%1\\MakeUppercase ") + str = string.gsub(str, "^(['`])(%a)", "%1\\MakeUppercase{%2}") + str = string.gsub(str, "^(ʿ)(%a)", "%1\\MakeUppercase{%2}") + str = string.gsub(str, "^(ʾ)(%a)", "%1\\MakeUppercase{%2}") end if string.find(str, "%s['`ʾʿ]") then - str = string.gsub(str, "(%s['`][^%-])", "%1\\MakeUppercase ") - str = string.gsub(str, "(%sʿ)", "%1\\MakeUppercase ") - str = string.gsub(str, "(%sʾ)", "%1\\MakeUppercase ") +-- str = string.gsub(str, "(%s['`])(%a)", "%1\\MakeUppercase{%2}") + str = string.gsub(str, "(%sʿ)(%a)", "%1\\MakeUppercase{%2}") + str = string.gsub(str, "(%sʾ)(%a)", "%1\\MakeUppercase{%2}") + end + if string.find(str, "%s[btṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwy]") then + str = string.gsub(str, "(%s)([btṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwy])", "%1\\MakeUppercase{%2}") + end + if string.find(str, "^[btṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwy]") then + str = string.gsub(str, "^([btṯjgḥḫdḏrzsšṣḍṭẓġfqklmnhwy])", "\\MakeUppercase %1") end --- str = string.gsub(str, "(%s[^'`ʾʿ])", "%1\\MakeUppercase ") -- else - str = "\\MakeUppercase "..str +-- str = "\\MakeUppercase "..str -- end return "\\txtrans{"..str.."}" end -- cgit v1.2.3