aboutsummaryrefslogtreecommitdiff
path: root/arabluatex.lua
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2019-06-26 17:52:38 +0200
committerRobert Alessi <alessi@robertalessi.net>2019-06-26 17:52:38 +0200
commitf4ed7e318a7402d0ac5032635678681bcb2d7b8b (patch)
tree814a37e463c0c9dd555fd2901116fc020eaca183 /arabluatex.lua
parenta60d651a32772dc4df4a0a765dc33316a687b757 (diff)
downloadarabluatex-f4ed7e318a7402d0ac5032635678681bcb2d7b8b.tar.gz
utf8 exporting improved for running Arabic paragraphs
Diffstat (limited to 'arabluatex.lua')
-rw-r--r--arabluatex.lua20
1 files changed, 11 insertions, 9 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index 67e4fc3..a91e211 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -758,15 +758,9 @@ local function processarbtoutf(str)
758 return string.format("%s{\\arb[trans]{\\uc{%s}}}", tag, body) 758 return string.format("%s{\\arb[trans]{\\uc{%s}}}", tag, body)
759 end 759 end
760 end) 760 end)
761 str = string.gsub(str, "(\\begin%s?{arab})(%b[])", function(tag, body) 761 str = string.gsub(str, "(\\begin%s?{arab})(%b[])", "\\bgroup\\arb%2{")
762 if string.find(body, "trans") then 762 str = string.gsub(str, "(\\begin%s?{arab})", "\\bgroup\\arb{")
763 return string.format("\\par\\bgroup\\setLR\\arb%s{", body) 763 str = string.gsub(str, "\\end%s?{arab}", "}\\egroup")
764 else
765 return string.format("\\par\\bgroup\\setRL\\arb%s{", body)
766 end
767 end)
768 str = string.gsub(str, "(\\begin%s?{arab})", "\\par\\bgroup\\arbpardir\\arb{")
769 str = string.gsub(str, "\\end%s?{arab}", "}\\egroup\\par")
770 -- This does not work, while the following two do. Look into this later. 764 -- This does not work, while the following two do. Look into this later.
771 -- str = gsub(str, lpeg.Cs("\\arb") * spcenc * bsqbrackets^-1 * bcbraces, function(tag, opt, body) 765 -- str = gsub(str, lpeg.Cs("\\arb") * spcenc * bsqbrackets^-1 * bcbraces, function(tag, opt, body)
772 -- body = string.sub(body, 2, -2) 766 -- body = string.sub(body, 2, -2)
@@ -851,6 +845,14 @@ function arabluatex.closestream()
851 t = string.gsub(t, "(\\@al@ob)", "{") 845 t = string.gsub(t, "(\\@al@ob)", "{")
852 t = string.gsub(t, "(\\@al@cb@sp)", "} ") 846 t = string.gsub(t, "(\\@al@cb@sp)", "} ")
853 t = string.gsub(t, "(\\@al@cb)(%s?)", "}") 847 t = string.gsub(t, "(\\@al@cb)(%s?)", "}")
848 t = string.gsub(t, "(\\bgroup%s?)(\\txarb%s?)(%b{})(\\egroup%s?)", function(tagio, tag, body, tagic)
849 body = string.sub(body, 2, -2)
850 return string.format("\\begin{txarab}%s\\end{txarab}", body)
851 end)
852 t = string.gsub(t, "(\\bgroup%s?)(\\txtrans%s?)(%b{})(\\egroup%s?)", function(tagio, tag, body, tagic)
853 body = string.sub(body, 2, -2)
854 return string.format("\\begin{txarabtr}%s\\end{txarabtr}", body)
855 end)
854 t = gsub(t, lpeg.Cs("\\begin") * spcenc^-1 * bcbraces * cmdargs, 856 t = gsub(t, lpeg.Cs("\\begin") * spcenc^-1 * bcbraces * cmdargs,
855 "\n%1%2%3\n") 857 "\n%1%2%3\n")
856 t = string.gsub(t, "(\\\\)(%s?)", "%1\n") 858 t = string.gsub(t, "(\\\\)(%s?)", "%1\n")