| 1 |
;;; ekdosis.el --- AUCTeX style for `ekdosis.sty' |
| 2 |
;; This file is part of the `ekdosis' package |
| 3 |
|
| 4 |
;; ekdosis -- TEI xml compliant critical editions |
| 5 |
;; Copyright (C) 2020--2021 Robert Alessi |
| 6 |
|
| 7 |
;; Please send error reports and suggestions for improvements to Robert |
| 8 |
;; Alessi <[email protected]> |
| 9 |
|
| 10 |
;; This program is free software: you can redistribute it and/or modify |
| 11 |
;; it under the terms of the GNU General Public License as published by |
| 12 |
;; the Free Software Foundation, either version 3 of the License, or |
| 13 |
;; (at your option) any later version. |
| 14 |
|
| 15 |
;; This program is distributed in the hope that it will be useful, but |
| 16 |
;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 |
;; General Public License for more details. |
| 19 |
|
| 20 |
;; You should have received a copy of the GNU General Public License |
| 21 |
;; along with this program. If not, see |
| 22 |
;; <http://www.gnu.org/licenses/>. |
| 23 |
|
| 24 |
(defvar LaTeX-ekdosis-preamble-options |
| 25 |
'(("parnotes" ("true" "false" "roman")) |
| 26 |
("teiexport" ("true" "false" "tidy")) |
| 27 |
("layout" ("float" "footins" "keyfloat" "fitapp")) |
| 28 |
("divs" ("ekdosis" "latex")) |
| 29 |
("poetry" ("verse")) |
| 30 |
("parnotes" ("true" "false" "roman")) |
| 31 |
("teiexport" ("true" "false" "tidy"))) |
| 32 |
"Package options for the ekdosis package.") |
| 33 |
|
| 34 |
(defun LaTeX-ekdosis-package-options () |
| 35 |
"Prompt for package options for ekdosis package." |
| 36 |
(TeX-read-key-val t LaTeX-ekdosis-preamble-options)) |
| 37 |
|
| 38 |
(defun LaTeX-ekdosis-long-key-val (optional arg) |
| 39 |
(let ((crm-local-completion-map |
| 40 |
(remove (assoc 32 crm-local-completion-map) |
| 41 |
crm-local-completion-map)) |
| 42 |
(minibuffer-local-completion-map |
| 43 |
(remove (assoc 32 minibuffer-local-completion-map) |
| 44 |
minibuffer-local-completion-map))) |
| 45 |
(TeX-argument-insert |
| 46 |
(TeX-read-key-val optional arg) |
| 47 |
optional))) |
| 48 |
|
| 49 |
(defvar LaTeX-ekdosis-ekdsetup-options |
| 50 |
'(("showpagebreaks" ("true" "false")) |
| 51 |
("spbmk") |
| 52 |
("hpbmk")) |
| 53 |
"List of local options for ekdsetup macro.") |
| 54 |
|
| 55 |
(defvar LaTeX-ekdosis-declarewitness-options |
| 56 |
'(("settlement") |
| 57 |
("institution") |
| 58 |
("repository") |
| 59 |
("collection") |
| 60 |
("idno") |
| 61 |
("msName") |
| 62 |
("origDate") |
| 63 |
("locus")) |
| 64 |
"List of local options for DeclareWitness macro.") |
| 65 |
|
| 66 |
(defvar LaTeX-ekdosis-declarehand-options |
| 67 |
'(("note")) |
| 68 |
"List of local options for DeclareHand macro.") |
| 69 |
|
| 70 |
(defvar LaTeX-ekdosis-declarescholar-options |
| 71 |
'(("rawname") |
| 72 |
("forename") |
| 73 |
("surname") |
| 74 |
("addname") |
| 75 |
("note")) |
| 76 |
"List of local options for DeclareScholar macro.") |
| 77 |
|
| 78 |
(defvar LaTeX-ekdosis-app-options |
| 79 |
'(("type")) |
| 80 |
"Local option for app|note macro.") |
| 81 |
|
| 82 |
(defvar LaTeX-ekdosis-lem-options |
| 83 |
'(("wit") |
| 84 |
("source") |
| 85 |
("resp") |
| 86 |
("alt") |
| 87 |
("pre") |
| 88 |
("post") |
| 89 |
("prewit") |
| 90 |
("postwit") |
| 91 |
("sep") |
| 92 |
("type") |
| 93 |
("num") |
| 94 |
("nonum") |
| 95 |
("nolem" ("true" "false")) |
| 96 |
("nosep" ("true" "false"))) |
| 97 |
"Local options for lem macro") |
| 98 |
|
| 99 |
(defvar LaTeX-ekdosis-rdg-options |
| 100 |
'(("wit") |
| 101 |
("source") |
| 102 |
("resp") |
| 103 |
("alt") |
| 104 |
("pre") |
| 105 |
("post") |
| 106 |
("prewit") |
| 107 |
("postwit") |
| 108 |
("subsep") |
| 109 |
("nosubsep") |
| 110 |
("type") |
| 111 |
("nordg" ("true" "false"))) |
| 112 |
"Local options for rdg macro.") |
| 113 |
|
| 114 |
(defvar LaTeX-ekdosis-note-options |
| 115 |
'(("type") |
| 116 |
("lem") |
| 117 |
("labelb") |
| 118 |
("labele") |
| 119 |
("sep") |
| 120 |
("nosep") |
| 121 |
("subsep") |
| 122 |
("num") |
| 123 |
("nonum") |
| 124 |
("pre") |
| 125 |
("post")) |
| 126 |
"Local options for note macro.") |
| 127 |
|
| 128 |
(defvar LaTeX-ekdosis-note-star-options |
| 129 |
'(("pre") |
| 130 |
("post")) |
| 131 |
"Local options for note* macro.") |
| 132 |
|
| 133 |
(defvar LaTeX-ekdosis-rdggrp-options |
| 134 |
'(("type")) |
| 135 |
"Local options for rdgGrp macro.") |
| 136 |
|
| 137 |
(defvar LaTeX-ekdosis-setcritsymbols-options |
| 138 |
'(("suppbegin") |
| 139 |
("suppend") |
| 140 |
("delbegin") |
| 141 |
("delend") |
| 142 |
("sicbegin") |
| 143 |
("sicend") |
| 144 |
("gapmark") |
| 145 |
("keepinapp")) |
| 146 |
"List of local options for setcritsymbols macro.") |
| 147 |
|
| 148 |
(defvar LaTeX-ekdosis-sethooks-options |
| 149 |
'(("appfontsize") |
| 150 |
("refnumstyle") |
| 151 |
("postrefnum") |
| 152 |
("lemmastyle") |
| 153 |
("readingstyle") |
| 154 |
("familysep") |
| 155 |
("initialrule") |
| 156 |
("noinitialrule") |
| 157 |
("keyparopts") |
| 158 |
("appheight") |
| 159 |
("fitalgorithm" ("fontsize" "hybrid" "areasize" "squeeze"))) |
| 160 |
"List of local options for sethooks macro.") |
| 161 |
|
| 162 |
(defvar LaTeX-ekdosis-gap-options |
| 163 |
'(("reason") |
| 164 |
("unit") |
| 165 |
("quantity") |
| 166 |
("extent")) |
| 167 |
"List of local options for gap macro.") |
| 168 |
|
| 169 |
(defvar LaTeX-ekdosis-setapparatus-options |
| 170 |
'(("direction" ("LR" "RL")) |
| 171 |
("sep") |
| 172 |
("subsep") |
| 173 |
("delim") |
| 174 |
("bhook") |
| 175 |
("ehook") |
| 176 |
("rule") |
| 177 |
("norule") |
| 178 |
("lang") |
| 179 |
("notelang")) |
| 180 |
"List of local options for setapparatus macro.") |
| 181 |
|
| 182 |
(defvar LaTeX-ekdosis-declareapparatus-options |
| 183 |
'(("direction" ("LR" "RL")) |
| 184 |
("sep") |
| 185 |
("subsep") |
| 186 |
("delim") |
| 187 |
("bhook") |
| 188 |
("ehook") |
| 189 |
("rule") |
| 190 |
("norule") |
| 191 |
("lang") |
| 192 |
("notelang") |
| 193 |
("maxentries")) |
| 194 |
"List of local options for declareapparatus macro.") |
| 195 |
|
| 196 |
(defvar LaTeX-ekdosis-setlineation-options |
| 197 |
'(("lineation" ("page" "document" "none")) |
| 198 |
("sep") |
| 199 |
("modulo") |
| 200 |
("modulonum") |
| 201 |
("margin" ("right" "left" "inner" "outer")) |
| 202 |
("numbers" ("elided" "full")) |
| 203 |
("vlineation" ("page" "document")) |
| 204 |
("vmodulo") |
| 205 |
("vnumbrokenlines" ("true" "false")) |
| 206 |
("vmargin" ("right" "left")) |
| 207 |
("continuousvnum")) |
| 208 |
"List of local options for setlineation macro.") |
| 209 |
|
| 210 |
(defvar LaTeX-ekdosis-ekddiv-options |
| 211 |
'(("type") |
| 212 |
("n") |
| 213 |
("head") |
| 214 |
("barehead") |
| 215 |
("depth" ("1" "2" "3" "4" "5" "6" "7" "8" "9")) |
| 216 |
("toc" ("book" "part" "chapter" "section" "subsection" |
| 217 |
"subsubsection" "paragraph" "subparagraph")) |
| 218 |
("mark")) |
| 219 |
"List of local options for ekddiv macro.") |
| 220 |
|
| 221 |
(defvar LaTeX-ekdosis-setteixmlexport-options |
| 222 |
'(("autopar" ("true" "false"))) |
| 223 |
"List of local options for SetTEIxmlExport macro.") |
| 224 |
|
| 225 |
(defvar LaTeX-ekdosis-alignment-key-val-options |
| 226 |
'(("tcols") |
| 227 |
("lcols") |
| 228 |
("texts") |
| 229 |
("apparatus") |
| 230 |
("flush" ("true" "false")) |
| 231 |
("paired" ("true" "false")) |
| 232 |
("lineation" ("page" "document"))) |
| 233 |
"Local options for alignment env.") |
| 234 |
|
| 235 |
(defvar LaTeX-ekdosis-ekdverse-key-val-options |
| 236 |
'(("width") |
| 237 |
("type")) |
| 238 |
"Local options for ekdverse env.") |
| 239 |
|
| 240 |
(defvar LaTeX-ekdosis-ekdstanza-key-val-options |
| 241 |
'(("type")) |
| 242 |
"Local options for ekdstanza env.") |
| 243 |
|
| 244 |
(TeX-add-style-hook |
| 245 |
"ekdosis" |
| 246 |
(lambda () |
| 247 |
;; Folding features: |
| 248 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 249 |
'("{1}" ("app")) |
| 250 |
t) |
| 251 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 252 |
'("{7}||{6}||{5}||{4}||{3}||{2}||{1}" ("lem")) |
| 253 |
t) |
| 254 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 255 |
'("[r]" ("rdg")) |
| 256 |
t) |
| 257 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 258 |
'("[n]" ("note")) |
| 259 |
t) |
| 260 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 261 |
'("[l]" ("linelabel")) |
| 262 |
t) |
| 263 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 264 |
'("{{1}}" ("surplus")) |
| 265 |
t) |
| 266 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 267 |
'("<{1}>" ("supplied")) |
| 268 |
t) |
| 269 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 270 |
'("{1}" ("sic")) |
| 271 |
t) |
| 272 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 273 |
'("[g]" ("gap")) |
| 274 |
t) |
| 275 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 276 |
'("{1}" ("mbox")) |
| 277 |
t) |
| 278 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 279 |
'("{1}" ("rdgGrp")) |
| 280 |
t) |
| 281 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 282 |
'("[pb]" ("ekdpb")) |
| 283 |
t) |
| 284 |
(add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
| 285 |
'("[t]" ("teidirect")) |
| 286 |
t) |
| 287 |
;; This package relies on lualatex, so check for it: |
| 288 |
(TeX-check-engine-add-engines 'luatex) |
| 289 |
(TeX-add-symbols |
| 290 |
'("ekdsetup" (TeX-arg-key-val LaTeX-ekdosis-ekdsetup-options)) |
| 291 |
'("DeclareWitness" "xml:id" "rendition" "description" |
| 292 |
[ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-declarewitness-options ] |
| 293 |
0) |
| 294 |
'("DeclareHand" "xml:id" "base ms." "rendition" |
| 295 |
[ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-declarehand-options ] |
| 296 |
0) |
| 297 |
'("DeclareSource" "xml:id" "rendition" |
| 298 |
0) |
| 299 |
'("DeclareScholar" "xml:id" "rendition" |
| 300 |
[ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-declarescholar-options ] |
| 301 |
0) |
| 302 |
'("DeclareShorthand" "xml:id" "rendition" "csv-list of ids" |
| 303 |
0) |
| 304 |
'("getsiglum" "csv-list" |
| 305 |
0) |
| 306 |
'("SigLine" "unique id" |
| 307 |
0) |
| 308 |
'("linelabel" "label" |
| 309 |
0) |
| 310 |
'("app" [ TeX-arg-key-val LaTeX-ekdosis-app-options ] |
| 311 |
t) |
| 312 |
'("lem" [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-lem-options ] |
| 313 |
t) |
| 314 |
'("rdg" [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-rdg-options ] |
| 315 |
t) |
| 316 |
'("note" [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-note-options ] |
| 317 |
t) |
| 318 |
'("note*" [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-note-star-options ] |
| 319 |
t) |
| 320 |
'("rdgGrp" [ TeX-arg-key-val LaTeX-ekdosis-rdggrp-options ] |
| 321 |
t) |
| 322 |
'("SetCritSymbols" (TeX-arg-key-val LaTeX-ekdosis-setcritsymbols-options)) |
| 323 |
'("supplied" "supplied text" 0) |
| 324 |
'("surplus" "surplus text" 0) |
| 325 |
'("gap" (TeX-arg-key-val LaTeX-ekdosis-gap-options)) |
| 326 |
'("sic" "sic text" 0) |
| 327 |
'("SetAlignment" |
| 328 |
(TeX-arg-key-val LaTeX-ekdosis-alignment-key-val-options)) |
| 329 |
'("columnratio" "fraction(s)" [ "fraction(s)" ] ) |
| 330 |
'("setcolumnwidth" "width/gap" [ "width/gap" ] ) |
| 331 |
'("marginparthreshold" "number of columns" [ "number of columns" ] ) |
| 332 |
'("footnotelayout" |
| 333 |
(TeX-arg-eval completing-read |
| 334 |
(TeX-argument-prompt nil nil "Layout") |
| 335 |
'("c" "m" "p"))) |
| 336 |
'("SetHooks" (TeX-arg-key-val LaTeX-ekdosis-sethooks-options)) |
| 337 |
'("SetLTRapp" 0) |
| 338 |
'("SetRTLapp" 0) |
| 339 |
'("SetSeparator" "separator" 0) |
| 340 |
'("SetSubseparator" "subseparator" 0) |
| 341 |
'("SetBeginApparatus" "chars|commands" 0) |
| 342 |
'("SetEndApparatus" "chars" 0) |
| 343 |
'("SetUnitDelimiter" "delimiter" 0) |
| 344 |
'("SetDefaultRule" "command" 0) |
| 345 |
'("SetApparatusLanguage" "lang name" 0) |
| 346 |
'("SetApparatusNoteLanguage" "lang name" 0) |
| 347 |
'("SetApparatus" (TeX-arg-key-val LaTeX-ekdosis-setapparatus-options)) |
| 348 |
'("footnoteruletrue" 0) |
| 349 |
'("footnoterulefalse" 0) |
| 350 |
'("ekdsep" 0) |
| 351 |
'("ekdsubsep" 0) |
| 352 |
'("SetDefaultApparatus" "apparatus name" 0) |
| 353 |
'("DeclareApparatus" "apparatus name" |
| 354 |
[ TeX-arg-key-val LaTeX-ekdosis-declareapparatus-options ] 0) |
| 355 |
'("indentpattern" "pattern" 0) |
| 356 |
'("vin" 0) |
| 357 |
'("SetLineation" (TeX-arg-key-val LaTeX-ekdosis-setlineation-options)) |
| 358 |
'("innerlinenumbers" 0) |
| 359 |
'("outerlinenumbers" 0) |
| 360 |
'("modulolinenumbers" [ "number" ] ) |
| 361 |
'("vmodulolinenumbers" [ "number" ] ) |
| 362 |
'("resetlinenumber" [ "number" ] ) |
| 363 |
'("resetvlinenumber" [ "number" ] ) |
| 364 |
'("verselinenumfont" "commands" 0) |
| 365 |
'("SetLR" 0) |
| 366 |
'("SetRL" 0) |
| 367 |
'("MkBodyDivs" "div1" "div2" "div3" "div4" "div5" "div6" 0) |
| 368 |
'("ekddiv" (LaTeX-ekdosis-long-key-val LaTeX-ekdosis-ekddiv-options)) |
| 369 |
'("FormatDiv" "number" "code before" "code after" 0) |
| 370 |
'("ekdpage" 0) |
| 371 |
'("ekdmark" 0) |
| 372 |
'("endmark" 0) |
| 373 |
'("ekdprintmark" |
| 374 |
(TeX-arg-eval completing-read |
| 375 |
(TeX-argument-prompt nil nil "selector") |
| 376 |
'("HEL" "HEC" "HER" "HOL" "HOC" "HOR" |
| 377 |
"FEL" "FEC" "FER" "FOL" "FOC" "FOR")) |
| 378 |
"signpost" 0 ) |
| 379 |
'("ekdnohfmark" 0) |
| 380 |
'("ekdresethfmarks" 0) |
| 381 |
'("ekdpb" [ "page number" ] "line number" 0) |
| 382 |
'("ekdpb*") |
| 383 |
'("addentries" [ "layer" ] "number" 0) |
| 384 |
'("SetTEIFilename" "base name" 0) |
| 385 |
'("SetTEIxmlExport" (TeX-arg-key-val |
| 386 |
LaTeX-ekdosis-setteixmlexport-options)) |
| 387 |
'("TeXtoTEI" "csname" "TEI element" [ "TEI attributes" ] 0) |
| 388 |
'("EnvtoTEI" "env name" "TEI element" [ "TEI attributes" ] 0) |
| 389 |
'("EnvtoTEI*" "env name" "TEI element" [ "TEI attributes" ] 0) |
| 390 |
'("TeXtoTEIPat" "TeX pattern" "TEI pattern" 0) |
| 391 |
'("teidirect" [ "xml attributes" ] "xml element" "code" 0) |
| 392 |
'("AddxmlBibResource" "basename or name.xml" 0) |
| 393 |
) |
| 394 |
(LaTeX-add-environments |
| 395 |
"ekdosis" |
| 396 |
"edition" |
| 397 |
"translation" |
| 398 |
"edition*" |
| 399 |
"translation*" |
| 400 |
"patverse" |
| 401 |
"ekdpar" |
| 402 |
'("alignment" LaTeX-env-args |
| 403 |
[ TeX-arg-key-val LaTeX-ekdosis-alignment-key-val-options ] ) |
| 404 |
'("ekdverse" LaTeX-env-args |
| 405 |
[ TeX-arg-key-val LaTeX-ekdosis-ekdverse-key-val-options ] ) |
| 406 |
'("ekdstanza" LaTeX-env-args |
| 407 |
[ TeX-arg-key-val LaTeX-ekdosis-ekdstanza-key-val-options ] ) |
| 408 |
) |
| 409 |
) |
| 410 |
LaTeX-dialect) |
| 411 |
|
| 412 |
;;; ekdosis.el ends here |