aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoruch Baum2017-12-22 16:39:44 +0200
committerEli Zaretskii2017-12-22 16:39:44 +0200
commitf6e6f5937356158287e1095a8e51422a5cbd2abc (patch)
tree1e5fceb6dc90a7e35df00bd2da652ce0fb68df90
parent2b6912c3d1ca99719c9eb6efb5eb1e7986ad280d (diff)
downloademacs-f6e6f5937356158287e1095a8e51422a5cbd2abc.tar.gz
emacs-f6e6f5937356158287e1095a8e51422a5cbd2abc.zip
Support Hebrew-style footnotes in footnote.el
* lisp/mail/footnote.el (footnote-hebrew-numeric-regex) (footnote-hebrew-symbolic-regex): New defconsts. (Footnote-hebrew-numeric, Footnote-hebrew-symbolic): New functions. (footnote-style-alist): Add new Hebrew styles. Doc fix. (footnote-style): Add new Hebrew styles. (Bug#29759)
-rw-r--r--lisp/mail/footnote.el51
1 files changed, 49 insertions, 2 deletions
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index 5e18d892d4a..d82f7410207 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -310,6 +310,48 @@ Use Unicode characters for footnoting."
310 (push (aref footnote-unicode-string modulus) result)) 310 (push (aref footnote-unicode-string modulus) result))
311 (apply #'string result))) 311 (apply #'string result)))
312 312
313;; Hebrew
314
315(defconst footnote-hebrew-numeric-regex "[אבגדהוזחטיכלמנסעפצקרשת']+")
316; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?")
317
318(defconst footnote-hebrew-numeric
319 '(
320 ("א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט")
321 ("י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ")
322 ("ק" "ר" "ש" "ת" "תק" "תר"" תש" "תת" "תתק")))
323
324(defun Footnote-hebrew-numeric (n)
325 "Supports 9999 footnotes, then rolls over."
326 (let* ((n (+ (mod n 10000) (/ n 10000)))
327 (thousands (/ n 1000))
328 (hundreds (/ (mod n 1000) 100))
329 (tens (/ (mod n 100) 10))
330 (units (mod n 10))
331 (special (if (not (= tens 1)) nil
332 (or (when (= units 5) "טו")
333 (when (= units 6) "טז")))))
334 (concat
335 (when (/= 0 thousands)
336 (concat (nth (1- thousands) (nth 0 footnote-hebrew-numeric)) "'"))
337 (when (/= 0 hundreds)
338 (nth (1- hundreds) (nth 2 footnote-hebrew-numeric)))
339 (if special special
340 (concat
341 (when (/= 0 tens) (nth (1- tens) (nth 1 footnote-hebrew-numeric)))
342 (when (/= 0 units) (nth (1- units) (nth 0 footnote-hebrew-numeric))))))))
343
344(defconst footnote-hebrew-symbolic-regex "[אבגדהוזחטיכלמנסעפצקרשת]")
345
346(defconst footnote-hebrew-symbolic
347 '(
348 "א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט" "י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ" "ק" "ר" "ש" "ת"))
349
350(defun Footnote-hebrew-symbolic (n)
351 "Only 22 elements, per the style of eg. 'פירוש שפתי חכמים על רש״י'.
352Proceeds from `י' to `כ', from `צ' to `ק'. After `ת', rolls over to `א'."
353 (nth (mod (1- n) 22) footnote-hebrew-symbolic))
354
313;;; list of all footnote styles 355;;; list of all footnote styles
314(defvar footnote-style-alist 356(defvar footnote-style-alist
315 `((numeric Footnote-numeric ,footnote-numeric-regexp) 357 `((numeric Footnote-numeric ,footnote-numeric-regexp)
@@ -318,9 +360,12 @@ Use Unicode characters for footnoting."
318 (roman-lower Footnote-roman-lower ,footnote-roman-lower-regexp) 360 (roman-lower Footnote-roman-lower ,footnote-roman-lower-regexp)
319 (roman-upper Footnote-roman-upper ,footnote-roman-upper-regexp) 361 (roman-upper Footnote-roman-upper ,footnote-roman-upper-regexp)
320 (latin Footnote-latin ,footnote-latin-regexp) 362 (latin Footnote-latin ,footnote-latin-regexp)
321 (unicode Footnote-unicode ,footnote-unicode-regexp)) 363 (unicode Footnote-unicode ,footnote-unicode-regexp)
364 (hebrew-numeric Footnote-hebrew-numeric ,footnote-hebrew-numeric-regex)
365 (hebrew-symbolic Footnote-hebrew-symbolic ,footnote-hebrew-symbolic-regex))
322 "Styles of footnote tags available. 366 "Styles of footnote tags available.
323By default only boring Arabic numbers, English letters and Roman Numerals 367By default, Arabic numbers, English letters, Roman Numerals,
368Latin and Unicode superscript characters, and Hebrew numerals
324are available. 369are available.
325See footnote-han.el, footnote-greek.el and footnote-hebrew.el for more 370See footnote-han.el, footnote-greek.el and footnote-hebrew.el for more
326exciting styles.") 371exciting styles.")
@@ -334,6 +379,8 @@ roman-lower == i, ii, iii, iv, v, ...
334roman-upper == I, II, III, IV, V, ... 379roman-upper == I, II, III, IV, V, ...
335latin == ¹ ² ³ º ª § ¶ 380latin == ¹ ² ³ º ª § ¶
336unicode == ¹, ², ³, ... 381unicode == ¹, ², ³, ...
382hebrew-numeric == א, ב, ..., יא, ..., תקא...
383hebrew-symbolic == א, ב, ..., י, כ, ..., צ, ק, ..., ת, א
337See also variables `footnote-start-tag' and `footnote-end-tag'. 384See also variables `footnote-start-tag' and `footnote-end-tag'.
338 385
339Note: some characters in the unicode style may not show up 386Note: some characters in the unicode style may not show up