aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/mail/footnote.el44
1 files changed, 26 insertions, 18 deletions
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index 2448211a238..121e771c550 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -245,7 +245,8 @@ Wrapping around the alphabet implies successive repetitions of letters."
245 (50 . "l") (100 . "c") (500 . "d") (1000 . "m")) 245 (50 . "l") (100 . "c") (500 . "d") (1000 . "m"))
246 "List of roman numerals with their values.") 246 "List of roman numerals with their values.")
247 247
248(defconst footnote-roman-lower-regexp "[ivxlcdm]+" 248(defconst footnote-roman-lower-regexp
249 (concat "[" (mapconcat #'cdr footnote-roman-lower-list "") "]+")
249 "Regexp of roman numerals.") 250 "Regexp of roman numerals.")
250 251
251(defun footnote--roman-lower (n) 252(defun footnote--roman-lower (n)
@@ -254,11 +255,11 @@ Wrapping around the alphabet implies successive repetitions of letters."
254 255
255;;; ROMAN UPPER 256;;; ROMAN UPPER
256(defconst footnote-roman-upper-list 257(defconst footnote-roman-upper-list
257 '((1 . "I") (5 . "V") (10 . "X") 258 (mapcar (lambda (x) (cons (car x) (upcase (cdr x))))
258 (50 . "L") (100 . "C") (500 . "D") (1000 . "M")) 259 footnote-roman-lower-list)
259 "List of roman numerals with their values.") 260 "List of roman numerals with their values.")
260 261
261(defconst footnote-roman-upper-regexp "[IVXLCDM]+" 262(defconst footnote-roman-upper-regexp (upcase footnote-roman-lower-regexp)
262 "Regexp of roman numerals. Not complete") 263 "Regexp of roman numerals. Not complete")
263 264
264(defun footnote--roman-upper (n) 265(defun footnote--roman-upper (n)
@@ -355,14 +356,15 @@ Use Unicode characters for footnoting."
355 356
356;; Hebrew 357;; Hebrew
357 358
358(defconst footnote-hebrew-numeric-regex "[אבגדהוזחטיכלמנסעפצקרשת']+")
359; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?")
360
361(defconst footnote-hebrew-numeric 359(defconst footnote-hebrew-numeric
362 '( 360 '(
363 ("א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט") 361 ("א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט")
364 ("י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ") 362 ("י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ")
365 ("ק" "ר" "ש" "ת" "תק" "תר"" תש" "תת" "תתק"))) 363 ("ק" "ר" "ש" "ת" "תק" "תר" "תש" "תת" "תתק")))
364
365(defconst footnote-hebrew-numeric-regex
366 (concat "[" (apply #'concat (apply #'append footnote-hebrew-numeric)) "']+"))
367;; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?")
366 368
367(defun footnote--hebrew-numeric (n) 369(defun footnote--hebrew-numeric (n)
368 "Supports 9999 footnotes, then rolls over." 370 "Supports 9999 footnotes, then rolls over."
@@ -371,25 +373,27 @@ Use Unicode characters for footnoting."
371 (hundreds (/ (mod n 1000) 100)) 373 (hundreds (/ (mod n 1000) 100))
372 (tens (/ (mod n 100) 10)) 374 (tens (/ (mod n 100) 10))
373 (units (mod n 10)) 375 (units (mod n 10))
374 (special (if (not (= tens 1)) nil 376 (special (cond
375 (or (when (= units 5) "טו") 377 ((not (= tens 1)) nil)
376 (when (= units 6) "טז"))))) 378 ((= units 5) "טו")
379 ((= units 6) "טז"))))
377 (concat 380 (concat
378 (when (/= 0 thousands) 381 (when (/= 0 thousands)
379 (concat (nth (1- thousands) (nth 0 footnote-hebrew-numeric)) "'")) 382 (concat (nth (1- thousands) (nth 0 footnote-hebrew-numeric)) "'"))
380 (when (/= 0 hundreds) 383 (when (/= 0 hundreds)
381 (nth (1- hundreds) (nth 2 footnote-hebrew-numeric))) 384 (nth (1- hundreds) (nth 2 footnote-hebrew-numeric)))
382 (if special special 385 (or special
383 (concat 386 (concat
384 (when (/= 0 tens) (nth (1- tens) (nth 1 footnote-hebrew-numeric))) 387 (when (/= 0 tens) (nth (1- tens) (nth 1 footnote-hebrew-numeric)))
385 (when (/= 0 units) (nth (1- units) (nth 0 footnote-hebrew-numeric)))))))) 388 (when (/= 0 units) (nth (1- units) (nth 0 footnote-hebrew-numeric))))))))
386
387(defconst footnote-hebrew-symbolic-regex "[אבגדהוזחטיכלמנסעפצקרשת]")
388 389
389(defconst footnote-hebrew-symbolic 390(defconst footnote-hebrew-symbolic
390 '( 391 '(
391 "א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט" "י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ" "ק" "ר" "ש" "ת")) 392 "א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט" "י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ" "ק" "ר" "ש" "ת"))
392 393
394(defconst footnote-hebrew-symbolic-regex
395 (concat "[" (apply #'concat footnote-hebrew-symbolic) "]"))
396
393(defun footnote--hebrew-symbolic (n) 397(defun footnote--hebrew-symbolic (n)
394 "Only 22 elements, per the style of eg. 'פירוש שפתי חכמים על רש״י'. 398 "Only 22 elements, per the style of eg. 'פירוש שפתי חכמים על רש״י'.
395Proceeds from `י' to `כ', from `צ' to `ק'. After `ת', rolls over to `א'." 399Proceeds from `י' to `כ', from `צ' to `ק'. After `ת', rolls over to `א'."
@@ -409,7 +413,11 @@ Proceeds from `י' to `כ', from `צ' to `ק'. After `ת', rolls over to `א'."
409 "Styles of footnote tags available. 413 "Styles of footnote tags available.
410By default, Arabic numbers, English letters, Roman Numerals, 414By default, Arabic numbers, English letters, Roman Numerals,
411Latin and Unicode superscript characters, and Hebrew numerals 415Latin and Unicode superscript characters, and Hebrew numerals
412are available.") 416are available.
417Each element of the list should be of the form (NAME FUNCTION REGEXP)
418where NAME is a symbol, FUNCTION takes a footnote number and
419returns the corresponding representation in that style as a string,
420and REGEXP should be a regexp that matches any output of FUNCTION.")
413 421
414(defcustom footnote-style 'numeric 422(defcustom footnote-style 'numeric
415 "Default style used for footnoting. 423 "Default style used for footnoting.