diff options
Diffstat (limited to 'arabluatex.el')
-rw-r--r-- | arabluatex.el | 145 |
1 files changed, 93 insertions, 52 deletions
diff --git a/arabluatex.el b/arabluatex.el index 73bfcd6..5007675 100644 --- a/arabluatex.el +++ b/arabluatex.el | |||
@@ -1,29 +1,33 @@ | |||
1 | ;;; arabluatex.el --- AUCTeX style for `arabluatex.sty' | 1 | ;;; arabluatex.el --- AUCTeX style for `arabluatex.sty' |
2 | ;; This file is part of the `arabluatex' package | 2 | ;; This file is part of the `arabluatex' package |
3 | 3 | ||
4 | ;; ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX | 4 | ;; arabluatex -- ArabTeX for LuaLaTeX |
5 | ;; Copyright (C) 2016--2019 Robert Alessi | 5 | ;; Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 |
6 | ;; Robert Alessi <alessi@robertalessi.net> | ||
6 | 7 | ||
7 | ;; Please send error reports and suggestions for improvements to Robert | 8 | ;; Permission to use, copy, modify, and distribute this software for |
8 | ;; Alessi <alessi@robertalessi.net> | 9 | ;; any purpose with or without fee is hereby granted, provided that |
10 | ;; the above copyright notice and this permission notice appear in all | ||
11 | ;; copies. | ||
9 | 12 | ||
10 | ;; This program is free software: you can redistribute it and/or modify | 13 | ;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
11 | ;; it under the terms of the GNU General Public License as published by | 14 | ;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
12 | ;; the Free Software Foundation, either version 3 of the License, or | 15 | ;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
13 | ;; (at your option) any later version. | 16 | ;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR |
17 | ;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
18 | ;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
19 | ;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
20 | ;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
14 | 21 | ||
15 | ;; This program is distributed in the hope that it will be useful, but | 22 | ;; The author would like to express his grateful thanks to Arash |
16 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of | 23 | ;; Esbati <arash@gnu.org> whose comments helped to improve this file |
17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 24 | ;; immensely. |
18 | ;; General Public License for more details. | ||
19 | 25 | ||
20 | ;; You should have received a copy of the GNU General Public License | 26 | ;; Please send error reports and suggestions for improvements to Robert |
21 | ;; along with this program. If not, see | 27 | ;; Alessi <alessi@robertalessi.net> |
22 | ;; <http://www.gnu.org/licenses/>. | ||
23 | 28 | ||
24 | (defvar LaTeX-arabluatex-preamble-options | 29 | (defvar LaTeX-arabluatex-preamble-options |
25 | '(;; | 30 | '(("voc") |
26 | ("voc") | ||
27 | ("fullvoc") | 31 | ("fullvoc") |
28 | ("novoc") | 32 | ("novoc") |
29 | ("trans") | 33 | ("trans") |
@@ -32,21 +36,17 @@ | |||
32 | 36 | ||
33 | (defun LaTeX-arabluatex-package-options () | 37 | (defun LaTeX-arabluatex-package-options () |
34 | "Prompt for package options for arabluatex package." | 38 | "Prompt for package options for arabluatex package." |
35 | (TeX-read-key-val t | 39 | (TeX-read-key-val t LaTeX-arabluatex-preamble-options)) |
36 | (append LaTeX-arabluatex-preamble-options))) | ||
37 | 40 | ||
38 | (defvar LaTeX-arabluatex-mode-options | 41 | (defvar LaTeX-arabluatex-mode-options |
39 | '(;; | 42 | '(("voc") |
40 | ("voc") | ||
41 | ("fullvoc") | 43 | ("fullvoc") |
42 | ("novoc") | 44 | ("novoc") |
43 | ("trans") | 45 | ("trans")) |
44 | ) | 46 | "List of local options for arabluatex macros.") |
45 | "Local options.") | ||
46 | 47 | ||
47 | (defvar LaTeX-arabluatex-key-val-options | 48 | (defvar LaTeX-arabluatex-key-val-options |
48 | '(;; | 49 | '(("mode" ("voc" "fullvoc" "novoc" "trans")) |
49 | ("mode" ("voc" "fullvoc" "novoc" "trans")) | ||
50 | ("width") | 50 | ("width") |
51 | ("gutter") | 51 | ("gutter") |
52 | ("metre") | 52 | ("metre") |
@@ -56,23 +56,31 @@ | |||
56 | ("export" ("true" "false"))) | 56 | ("export" ("true" "false"))) |
57 | "Key=value options for arabverse environment.") | 57 | "Key=value options for arabverse environment.") |
58 | 58 | ||
59 | (defvar LaTeX-arabluatex-color-options | ||
60 | '(())) | ||
61 | |||
62 | (defvar LaTeX-arabluatex-outfile-options | 59 | (defvar LaTeX-arabluatex-outfile-options |
63 | '(;; | 60 | '(("newline")) |
64 | ("newline")) | 61 | "List of options for outfile command.") |
65 | "Option for outfile command.") | ||
66 | 62 | ||
67 | (defvar LaTeX-arabluatex-arbmark-options | 63 | (defvar LaTeX-arabluatex-arbmark-options |
68 | '(;; | 64 | '(("rl") |
69 | ("rl") | ||
70 | ("lr")) | 65 | ("lr")) |
71 | "Option for arbmark command.") | 66 | "List of options for arbmark command.") |
67 | |||
68 | (defvar LaTeX-arabluatex-arind-options | ||
69 | '(("index") | ||
70 | ("root" | ||
71 | ("1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15")) | ||
72 | ("form") | ||
73 | ("pipe")) | ||
74 | "Option for arind command.") | ||
72 | 75 | ||
73 | (TeX-add-style-hook | 76 | (TeX-add-style-hook |
74 | "arabluatex" | 77 | "arabluatex" |
75 | (lambda () | 78 | (lambda () |
79 | ;; Run the style hook for loaded packages: | ||
80 | (TeX-run-style-hooks "xcolor") | ||
81 | ;; Folding features: | ||
82 | (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) | ||
83 | '("[i]" ("arind")) t) | ||
76 | ;; This package relies on lualatex, so check for it: | 84 | ;; This package relies on lualatex, so check for it: |
77 | (TeX-check-engine-add-engines 'luatex) | 85 | (TeX-check-engine-add-engines 'luatex) |
78 | (TeX-add-symbols | 86 | (TeX-add-symbols |
@@ -93,45 +101,78 @@ | |||
93 | "uc" | 101 | "uc" |
94 | "prname" | 102 | "prname" |
95 | "txarb" | 103 | "txarb" |
96 | '("arb" [ (TeX-arg-eval completing-read "Mode: " | 104 | '("arb" [ TeX-arg-eval completing-read |
97 | LaTeX-arabluatex-mode-options) ] | 105 | (TeX-argument-prompt nil nil "Mode") |
106 | LaTeX-arabluatex-mode-options ] | ||
98 | t) | 107 | t) |
99 | '("arbcolor" [ (TeX-arg-eval completing-read "Color: " | 108 | '("arbcolor" [ TeX-arg-eval completing-read |
100 | LaTeX-arabluatex-color-options) ] | 109 | (TeX-argument-prompt nil nil "Color") |
110 | (LaTeX-xcolor-definecolor-list) ] | ||
101 | t) | 111 | t) |
102 | '("arbmark" [ (TeX-arg-eval completing-read "Option: " | 112 | '("arbmark" [ TeX-arg-eval completing-read |
103 | LaTeX-arabluatex-arbmark-options) ] | 113 | (TeX-argument-prompt nil nil "Option") |
114 | LaTeX-arabluatex-arbmark-options ] | ||
104 | t) | 115 | t) |
105 | '("ArbOutFile" [ (TeX-arg-eval completing-read "Color: " | 116 | '("ArbOutFile" [ TeX-arg-eval completing-read |
106 | LaTeX-arabluatex-outfile-options) ] | 117 | (TeX-argument-prompt nil nil "Option") |
118 | LaTeX-arabluatex-outfile-options ] | ||
107 | t) | 119 | t) |
108 | '("ArbOutFile*" [ (TeX-arg-eval completing-read "Option: " | 120 | '("ArbOutFile*" [ TeX-arg-eval completing-read |
109 | LaTeX-arabluatex-outfile-options) ] | 121 | (TeX-argument-prompt nil nil "Option") |
122 | LaTeX-arabluatex-outfile-options ] | ||
110 | t) | 123 | t) |
124 | '("arind" [ TeX-arg-key-val LaTeX-arabluatex-arind-options ] | ||
125 | TeX-arg-index) | ||
111 | "SetHemistichDelim" | 126 | "SetHemistichDelim" |
112 | '("bayt" 2) | 127 | '("bayt" 2) |
128 | '("bayt+" 2) | ||
113 | "abjad" | 129 | "abjad" |
130 | '("SetArbNumbers" "Indian or Arabic") | ||
114 | "arbnull" | 131 | "arbnull" |
115 | "abraces" | 132 | "abraces" |
116 | "LR" | 133 | "LR" |
117 | "RL" | 134 | "RL" |
118 | "LRmarginpar" | 135 | '("LRmarginpar" [ "Left margin text" ] "Text") |
119 | "LRfootnote" | 136 | '("LRfootnote" |
120 | "RLfootnote" | 137 | (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil) |
138 | t) | ||
139 | '("RLfootnote" | ||
140 | (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil) | ||
141 | t) | ||
121 | "FixArbFtnmk" | 142 | "FixArbFtnmk" |
122 | "MkArbBreak" | 143 | "MkArbBreak" |
123 | '("newarbmark" 3) | 144 | '("newarbmark" 3) |
124 | '("setRL" 0) | 145 | '("setRL" 0) |
125 | '("setLR" 0)) | 146 | '("setLR" 0)) |
147 | |||
126 | (LaTeX-add-environments | 148 | (LaTeX-add-environments |
127 | '("arab" LaTeX-env-args | 149 | '("arab" LaTeX-env-args |
128 | [ (TeX-arg-eval completing-read "Mode: " | 150 | [ TeX-arg-eval completing-read |
129 | LaTeX-arabluatex-mode-options) ] | 151 | (TeX-argument-prompt nil nil "Mode") |
130 | 0) | 152 | LaTeX-arabluatex-mode-options ] |
153 | ) | ||
131 | "txarab" | 154 | "txarab" |
132 | "arabexport" | 155 | "arabexport" |
133 | '("arabverse" LaTeX-env-args | 156 | '("arabverse" LaTeX-env-args |
134 | [ TeX-arg-key-val LaTeX-arabluatex-key-val-options ] 0)) | 157 | [ TeX-arg-key-val LaTeX-arabluatex-key-val-options ] )) |
158 | |||
159 | ;; Fontification | ||
160 | (when (and (featurep 'font-latex) | ||
161 | (eq TeX-install-font-lock 'font-latex-setup)) | ||
162 | (font-latex-add-keywords '(("aemph" "{")) | ||
163 | 'italic-command) | ||
164 | (font-latex-add-keywords '(("LRmarginpar" "[{") | ||
165 | ("LRfootnote" "[{") | ||
166 | ("RLfootnote" "[{") | ||
167 | ("arind" "[{")) | ||
168 | 'reference) | ||
169 | (font-latex-add-keywords '(("SetTranslitFont" "{") | ||
170 | ("SetTranslitStyle" "{") | ||
171 | ("SetTranslitConvention" "{")) | ||
172 | 'function)) | ||
173 | ;; RefTeX support | ||
174 | (when (fboundp 'reftex-add-index-macros) | ||
175 | (reftex-add-index-macros '(("\\arind[]{*}" "" ?a "" nil t)))) | ||
135 | ) | 176 | ) |
136 | LaTeX-dialect) | 177 | LaTeX-dialect) |
137 | 178 | ||