Emacs Hebrew footnotes [CODE SNIPPET]
Boruch Baum
boruch_baum at gmx.com
Sun Dec 17 23:40:28 IST 2017
ref: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29759
I honestly don't remember if ever in the past I've used Hebrew footnote
numbering in emacs, but the current state of affairs is that although the
documentation indicates that the option is available, the file seems
nowhere to be found. The above reference reports the issue, and includes
the following code snippet, so if anyone has an improvement, please post
it there first.
(defconst footnote-hebrew-regex "[אבגדהוזחטיכלמנסעפצקרשת]+")
(defconst footnote-hebrew '(
("א" "ב" "ג" "ד" "ה" "ו" "ז" "ח" "ט")
("י" "כ" "ל" "מ" "נ" "ס" "ע" "פ" "צ")
("ק" "ר" "ש" "ת" "תק" "תר"" תש" "תת" "תתק")))
(defun Footnote-hebrew(n)
"Supports 9999 footnotes, then rolls over."
(let*
((n (+ (mod n 10000) (/ n 10000)))
(thousands (/ n 1000))
(hundreds (/ (mod n 1000) 100))
(tens (/ (mod n 100) 10))
(units (mod n 10))
(special (if (not (= tens 1)) nil
(or (when (= units 5) "טו")
(when (= units 6) "טז")))))
(concat
(when (/= 0 thousands) (concat (nth (1- thousands) (nth 0 footnote-hebrew)) "'"))
(when (/= 0 hundreds) (nth (1- hundreds) (nth 2 footnote-hebrew)))
(if special special
(concat
(when (/= 0 tens) (nth (1- tens) (nth 1 footnote-hebrew)))
(when (/= 0 units) (nth (1- units) (nth 0 footnote-hebrew))))))))
(add-to-list 'footnote-style-alist `(hebrew Footnote-hebrew ,footnote-hebrew-regex) t)
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
More information about the Linux-il
mailing list