diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-27 22:52:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-27 22:52:36 +0000 |
commit | ccdb21bb02bbdc081efdabf33246e6b0de6a5be6 (patch) | |
tree | 3e1d9b2e91e15634bb1064d717280d49b8a75d2f /Master/texmf-dist/tex/lualatex | |
parent | 4ca0e50699e2f4fc4dbe8b1dc4fe528a51b5429d (diff) |
arabluatex (27apr16)
git-svn-id: svn://tug.org/texlive/trunk@40788 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
6 files changed, 183 insertions, 120 deletions
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua index f6597e8abb0..719e1e0856c 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua @@ -1,25 +1,25 @@ --[[ This file is part of the `arabluatex' package +ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX Copyright (C) 2016 Robert Alessi -Please send error reports and suggestions for improvements to -Robert Alessi <alessi@robertalessi.net> +Please send error reports and suggestions for improvements to Robert +Alessi <alessi@robertalessi.net> -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program. If not, see +<http://www.gnu.org/licenses/>. --]] require("arabluatex_voc") @@ -72,11 +72,11 @@ local function breakcmd(str) body = string.sub(body, 2, -2) return string.format("}\\%s{%s}\\arb{", tag, body) end) - -- Abjad (Needs polyglossia) + -- Abjad str = string.gsub(str, "\\(abjad.-)(%b{})", function(tag, body) body = string.sub(body, 2, -2) - return string.format("}\\aemph{\\txarb{\\%s{%s}}}\\arb{", tag, body) + return string.format("}\\aemph{\\%s{%s}}\\arb{", tag, body) end) return str end @@ -115,6 +115,14 @@ local function indnum(str) return str end +local function takeoutabjad(str) + str = string.gsub(str, "(\\abjad.?)(%b{})", function(tag, body) + body = string.sub(body, 2, -2) + return string.format("%s", body) + end) + return str +end + local function takeoutcap(str) str = string.gsub(str, "(\\cap.?)(%b{})", function(tag, body) body = string.sub(body, 2, -2) @@ -339,6 +347,7 @@ end function processtrans(str, mode) str = "\\arb{".. str.."}" + str = takeoutabjad(str) str = protectarb(str) str = breakcmd(str) str = holdcmd(str) @@ -371,3 +380,28 @@ function cap(str) end return str end + +-- this function is adapted from an 'obsolete project' of Khaled +-- Hosny's that dates back to 2010. Thanks to him. +-- See https://github.com/khaledhosny/lualatex-arabic +function abjadify(n) + local abjadnum = "" + if n >= 1000 then + for i=1,math.floor(n/1000) do + abjadnum = abjadnum .. abjad[4][1] + end + n = math.fmod(n,1000) + end + if n >= 100 then + abjadnum = abjadnum .. abjad[3][math.floor(n/100)] + n = math.fmod(n, 100) + end + if n >= 10 then + abjadnum = abjadnum .. abjad[2][math.floor(n/10)] + n = math.fmod(n, 10) + end + if n >= 1 then + abjadnum = abjadnum .. abjad[1][math.floor(n/1)] + end + return "\\arb{"..abjadnum.."}" +end diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty index 376e47952b5..91c59c02461 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty @@ -8,25 +8,27 @@ %% %% This is a generated file. %% +%% This file is part of the `arabluatex' package +%% +%% ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX %% Copyright (C) 2016 Robert Alessi %% -%% Please send error reports and suggestions for improvements to -%% Robert Alessi <alessi@robertalessi.net> +%% Please send error reports and suggestions for improvements to Robert +%% Alessi <alessi@robertalessi.net> %% -%% This program is free software; you can redistribute it and/or -%% modify it under the terms of the GNU General Public License -%% as published by the Free Software Foundation; either version 2 -%% of the License, or (at your option) any later version. +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% (at your option) any later version. %% -%% This program is distributed in the hope that it will be useful, -%% but WITHOUT ANY WARRANTY; without even the implied warranty of -%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%% GNU General Public License for more details. +%% This program is distributed in the hope that it will be useful, but +%% WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%% General Public License for more details. %% %% You should have received a copy of the GNU General Public License -%% along with this program; if not, write to the Free Software -%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -%% USA. +%% along with this program. If not, see +%% <http://www.gnu.org/licenses/>. %% %% This release of 'arabluatex' consists of the following source files: %% - arabluatex.ins @@ -36,11 +38,10 @@ %% - arabluatex_fullvoc.lua %% - arabluatex_novoc.lua %% - arabluatex_trans.lua -%% - arabluatex.bib %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{arabluatex}% -[2016/03/31 v1.0.1 ArabTeX-like interface for LuaLaTeX] +[2016/04/27 v1.1.1 ArabTeX-like interface for LuaLaTeX] \RequirePackage{ifluatex} \ifluatex\else \PackageError{arabluatex}{lualatex needed}{% @@ -130,6 +131,8 @@ \luadirect{tex.sprint(processtrans(\luastringO{\BODY}, \luastringO{\al@trans@convention}))}\egroup% \else \fi\fi\fi\fi}[\par] +\NewDocumentCommand{\abjad}{m}% + {\luadirect{tex.sprint(abjadify(#1))}} \DeclareDocumentCommand{\LRmarginpar}{m}{\marginpar{\textdir TLT #1}} \DeclareDocumentCommand{\LRfootnote}{m}{\bgroup\pardir TLT\LR{\footnote{#1}}\egroup} diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_fullvoc.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_fullvoc.lua index f66ed872fd0..8263734863b 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_fullvoc.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_fullvoc.lua @@ -1,25 +1,25 @@ --[[ This file is part of the `arabluatex' package +ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX Copyright (C) 2016 Robert Alessi -Please send error reports and suggestions for improvements to -Robert Alessi <alessi@robertalessi.net> +Please send error reports and suggestions for improvements to Robert +Alessi <alessi@robertalessi.net> -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program. If not, see +<http://www.gnu.org/licenses/>. --]] -- this is new @@ -44,8 +44,12 @@ hamzafv = { {a="''([Uu])", b="ؤؤ%1"}, {a="''([Aa])", b="أأ%1"}, {a="''([Ii])", b="ئئ%1"}, - -- initial long u + -- initial long u and i (for a, see below) {a="%'%_U", b="أU"}, + {a="%'%_I", b="إI"}, + -- taḫfīfu 'l-hamza + {a="'u'([^uaiUAI])", b="أU%1"}, + {a="'i'([^uaiUAI])", b="إI%1"}, -- madda (historic writing below) {a="'a'([^uaiUAI])", b="آ%1"}, {a="'a?A([%_%^%.]?[%`%'btjghdrzsfqklmnywAY])", b="آ%1"}, diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_novoc.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_novoc.lua index deb5d3ef0eb..16f3b5115e4 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_novoc.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_novoc.lua @@ -1,25 +1,25 @@ --[[ This file is part of the `arabluatex' package +ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX Copyright (C) 2016 Robert Alessi -Please send error reports and suggestions for improvements to -Robert Alessi <alessi@robertalessi.net> +Please send error reports and suggestions for improvements to Robert +Alessi <alessi@robertalessi.net> -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program. If not, see +<http://www.gnu.org/licenses/>. --]] tanwinnv = { diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua index b61c6db7373..6b3f1bc092c 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_trans.lua @@ -1,25 +1,25 @@ --[[ This file is part of the `arabluatex' package +ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX Copyright (C) 2016 Robert Alessi -Please send error reports and suggestions for improvements to -Robert Alessi <alessi@robertalessi.net> +Please send error reports and suggestions for improvements to Robert +Alessi <alessi@robertalessi.net> -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program. If not, see +<http://www.gnu.org/licenses/>. --]] -- common @@ -81,8 +81,12 @@ hamzatrdmg = { {a="''([Uu])", b="ʾʾ%1"}, {a="''([Aa])", b="ʾʾ%1"}, {a="''([Ii])", b="ʾʾ%1"}, - -- initial long u + -- initial long u and i (for a, see below) {a="%'%_U", b="ʾU"}, + {a="%'%_I", b="ʾI"}, + -- taḫfīfu 'l-hamza + {a="'u'([^uaiUAI])", b="ʾU%1"}, + {a="'i'([^uaiUAI])", b="ʾI%1"}, -- madda (historic writing below) {a="'a'([^uaiUAI])", b="ʾA%1"}, {a="'a?A", b="ʾA"}, @@ -128,15 +132,15 @@ tanwintrdmg = { {a="iNU", b="in"}, -- tanwīn preceding ʾalif conjunctionis {a="(uN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="uni%2%3"}, - {a="(aN)(_A)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ani%3%4"}, - {a="(aN)(Y)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ani%3%4"}, + {a="(aN)(_A)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạni%3%4"}, + {a="(aN)(Y)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạni%3%4"}, {a="(T)(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="tani%3%4"}, {a="([^TA])(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1ani%3%4"}, {a="(iN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ini%2%3"}, -- {a="uN", b="un"}, - {a="(aN)(_A)", b="an"}, - {a="(aN)(Y)", b="an"}, + {a="(aN)(_A)", b="ạn"}, + {a="(aN)(Y)", b="ạn"}, {a="(T)(\"?aN)", b="tan"}, {a="([^TA])(\"?aN)", b="%1an"}, {a="iN", b="in"} @@ -231,7 +235,7 @@ digraphstrdmg = { -- {a="(U)(A)", b="ū"}, {a="WA", b="w"}, {a="(a)W", b="%1w"}, - {a="_A", b="ā"}, + {a="_A", b="ạ̄"}, {a="_u", b="ū"}, {a="_a", b="ā"}, {a="_i", b="ī"}, @@ -271,7 +275,7 @@ longvtrdmg = { {a="A", b="ā"}, {a="U", b="ū"}, {a="I", b="ī"}, - {a="Y", b="ā"} + {a="Y", b="ạ̄"} } shortvtrdmg = { @@ -294,12 +298,19 @@ hamzatrloc = { {a="''([Uu])", b="ʾʾ%1"}, {a="''([Aa])", b="ʾʾ%1"}, {a="''([Ii])", b="ʾʾ%1"}, - -- initial long u + -- initial long u and i (for a, see below) {a="%'%_U", b="U"}, + {a="%'%_I", b="I"}, + -- taḫfīfu 'l-hamza + {a="^'u'([^uaiUAI])", b="U%1"}, + {a="(%W)'u'([^uaiUAI])", b="%1U%2"}, + {a="'u'([^uaiUAI])", b="ʾU"}, + {a="^'i'([^uaiUAI])", b="I%1"}, + {a="(%W)'i'([^uaiUAI])", b="%1I%2"}, + {a="'i'([^uaiUAI])", b="ʾI"}, -- madda (historic writing below) {a="^(')(A)", b="%2"}, - {a="(%W)(')(A)", b="%1%3"}, - + {a="(%W)(')(A)", b="%1%3"}, {a="^'a'([^uaiUAI])", b="A%1"}, {a="(%W)'a'([^uaiUAI])", b="%1A%2"}, {a="'a'([^uaiUAI])", b="A%1"}, diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_voc.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_voc.lua index 97249012661..5eafca5e1d3 100644 --- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_voc.lua +++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex_voc.lua @@ -1,27 +1,34 @@ --[[ This file is part of the `arabluatex' package +ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX Copyright (C) 2016 Robert Alessi -Please send error reports and suggestions for improvements to -Robert Alessi <alessi@robertalessi.net> +Please send error reports and suggestions for improvements to Robert +Alessi <alessi@robertalessi.net> -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program. If not, see +<http://www.gnu.org/licenses/>. --]] +abjad = { +{"a\"'", "b", "j", "d", "h", "w", "z", ".h", ".t"}, +{"y", "k", "l", "m", "n", "s", "`", "f", ".s", }, +{"q", "r", "^s", "t", "_t", "x", "_d", ".d", ".z", }, +{".g"} +} + numbers = { {a="0", b="٠"}, {a="1", b="١"}, @@ -36,32 +43,32 @@ numbers = { } raw = { - {a="A", b="َا"}, - {a="U", b="ُو"}, - {a="I", b="ِي"}, - {a="b", b="ب"}, - {a="t", b="ت"}, - {a="j", b="ج"}, - {a="x", b="خ"}, - {a="d", b="د"}, - {a="r", b="ر"}, - {a="z", b="ز"}, - {a="s", b="س"}, - {a="f", b="ف"}, - {a="`", b="ع"}, - {a="f", b="ف"}, - {a="q", b="ق"}, - {a="k", b="ك"}, - {a="l", b="ل"}, - {a="m", b="م"}, - {a="n", b="ن"}, - {a="h", b="ه"}, - {a="w", b="و"}, - {a="y", b="ي"}, - {a="T", b="ة"}, - {a="u", b="ُ"}, - {a="a", b="َ"}, - {a="i", b="ِ"} + {a="A", b="َا"}, + {a="U", b="ُو"}, + {a="I", b="ِي"}, + {a="b", b="ب"}, + {a="t", b="ت"}, + {a="j", b="ج"}, + {a="x", b="خ"}, + {a="d", b="د"}, + {a="r", b="ر"}, + {a="z", b="ز"}, + {a="s", b="س"}, + {a="f", b="ف"}, + {a="`", b="ع"}, + {a="f", b="ف"}, + {a="q", b="ق"}, + {a="k", b="ك"}, + {a="l", b="ل"}, + {a="m", b="م"}, + {a="n", b="ن"}, + {a="h", b="ه"}, + {a="w", b="و"}, + {a="y", b="ي"}, + {a="T", b="ة"}, + {a="u", b="ُ"}, + {a="a", b="َ"}, + {a="i", b="ِ"} } hamza = { @@ -76,8 +83,12 @@ hamza = { {a="''([Uu])", b="ؤؤ%1"}, {a="''([Aa])", b="أأ%1"}, {a="''([Ii])", b="ئئ%1"}, - -- initial long u + -- initial long u and i (for a, see below) {a="%'%_U", b="أU"}, + {a="%'%_I", b="إI"}, + -- taḫfīfu 'l-hamza + {a="'u'([^uaiUAI])", b="أU%1"}, + {a="'i'([^uaiUAI])", b="إI%1"}, -- madda (historic writing below) {a="'a'([^uaiUAI])", b="آ%1"}, {a="'a?A([%_%^%.]?[%`%'btjghdrzsfqklmnywAY])", b="آ%1"}, |