-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdiogenes-utils.elc
59 lines (43 loc) · 9.17 KB
/
diogenes-utils.elc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
;ELC
;;; Compiled
;;; in Emacs version 29.4
;;; with all optimizations.
(byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\207" [require cl-lib seq diogenes-lisp-utils ucs-normalize] 2)#@44 Mapping of greek beta code to utf-8 greek.
(defconst diogenes--beta-to-utf8-map '(("*)/a" . 7948) ("*)/e" . 7964) ("*)/h" . 7980) ("" . 7996) ("*)/o" . 8012) ("*)/w" . 8044) ("*(/a" . 7949) ("*(/e" . 7965) ("*(/h" . 7981) ("*(/i" . 7997) ("*(/o" . 8013) ("*(/u" . 8029) ("*(/w" . 8045) ("*)/a" . 7946) ("*)/e" . 7962) ("*)/h" . 7978) ("*)/i" . 7994) ("*)/o" . 8010) ("*)/w" . 8042) ("*(/a" . 7947) ("*(/e" . 7963) ("*(/h" . 7979) ("*(/i" . 7995) ("*(/o" . 8011) ("*(/u" . 8027) ("*(/w" . 8043) ("*)=a" . 7950) ("*)=h" . 7982) ("*)=i" . 7998) ("*)=w" . 8046) ("*(=a" . 7951) ("*(=h" . 7983) ("*(=i" . 7999) ("*(=u" . 8031) ("*(=w" . 8047) ("*)a" . 7944) ("*)e" . 7960) ("*)h" . 7976) ("*)i" . 7992) ("*)o" . 8008) ("*)u" . 8025) ("*)w" . 8040) ("*(a" . 7945) ("*(e" . 7961) ("*(h" . 7977) ("*(i" . 7993) ("*(o" . 8009) ("*(u" . 8025) ("*(w" . 8041) ("*(r" . 8172) ("*a" . 913) ("*b" . 914) ("*g" . 915) ("*d" . 916) ("*e" . 917) ("*z" . 918) ("*h" . 919) ("*q" . 920) ("*i" . 921) ("*k" . 922) ("*l" . 923) ("*m" . 924) ("*n" . 925) ("*c" . 926) ("*o" . 927) ("*p" . 928) ("*r" . 929) ("*s" . 931) ("*t" . 932) ("*u" . 933) ("*f" . 934) ("*x" . 935) ("*y" . 936) ("*w" . 937) ("i/+" . 8147) ("υ/+" . 8163) ("i+/" . 8147) ("υ+/" . 8163) ("i/+" . 912) ("υ/+" . 944) ("i+/" . 912) ("υ+/" . 944) ("i/+" . 912) ("υ/+" . 944) ("i+/" . 912) ("υ+/" . 944) ("i\\+" . 8146) ("υ\\+" . 8162) ("i+\\" . 8146) ("υ+\\" . 8162) ("i=+" . 8151) ("υ=+" . 8167) ("i+=" . 8151) ("υ+=" . 8167) ("a(=|" . 8071) ("h(=|" . 8087) ("w(=|" . 8103) ("a)=|" . 8070) ("h)=|" . 8086) ("w)=|" . 8102) ("a=|" . 8119) ("h=|" . 8135) ("w=|" . 8183) ("a(=" . 7943) ("h(=" . 7975) ("i(=" . 7991) ("u(=" . 8023) ("w(=" . 8039) ("a)=" . 7942) ("h)=" . 7974) ("i)=" . 7990) ("u)=" . 8022) ("w)=" . 8038) ("a=" . 8118) ("h=" . 8134) ("i=" . 8150) ("u=" . 8166) ("w=" . 8182) ("a(\\|" . 8067) ("h(\\|" . 8083) ("w(\\|" . 8099) ("a)\\|" . 8066) ("h)\\|" . 8082) ("w)\\|" . 8098) ("a\\|" . 8114) ("h\\|" . 8130) ("w\\|" . 8178) ("a(\\" . 7939) ("e(\\" . 7955) ("h(\\" . 7971) ("i(\\" . 7987) ("o(\\" . 8003) ("u(\\" . 8019) ("w(\\" . 8035) ("a)\\" . 7938) ("e)\\" . 7954) ("h)\\" . 7970) ("i)\\" . 7986) ("o)\\" . 8002) ("u)\\" . 8018) ("w)\\" . 8034) ("a\\" . 8048) ("e\\" . 8050) ("h\\" . 8052) ("i\\" . 8054) ("o\\" . 8056) ("u\\" . 8058) ("w\\" . 8060) ("a(/|" . 8069) ("h(/|" . 8085) ("w(/|" . 8101) ("a)/|" . 8068) ("h)/|" . 8084) ("w)/|" . 8100) ("a/|" . 8116) ("h/|" . 8132) ("w/|" . 8180) ("a(/" . 7941) ("e(/" . 7957) ("h(/" . 7973) ("i(/" . 7989) ("o(/" . 8005) ("u(/" . 8021) ("w(/" . 8037) ("a)/" . 7940) ("e)/" . 7956) ("h)/" . 7972) ("i)/" . 7988) ("o)/" . 8004) ("u)/" . 8020) ("w)/" . 8036) ("a/" . 8049) ("e/" . 8051) ("h/" . 8053) ("i/" . 8055) ("o/" . 8057) ("u/" . 8059) ("w/" . 8061) ("a/" . 940) ("e/" . 941) ("h/" . 942) ("i/" . 943) ("o/" . 972) ("u/" . 973) ("w/" . 974) ("a(|" . 8065) ("h(|" . 8081) ("w(|" . 8097) ("a)|" . 8064) ("h)|" . 8080) ("w)|" . 8096) ("a|" . 8115) ("h|" . 8131) ("w|" . 8179) ("a(" . 7937) ("e(" . 7953) ("h(" . 7969) ("i(" . 7985) ("o(" . 8001) ("u(" . 8017) ("w(" . 8033) ("a)" . 7936) ("e)" . 7952) ("h)" . 7968) ("i)" . 7984) ("o)" . 8000) ("u)" . 8016) ("w)" . 8032) ("r(" . 8165) ("r)" . 8164) ("a" . 945) ("b" . 946) ("g" . 947) ("d" . 948) ("e" . 949) ("z" . 950) ("h" . 951) ("q" . 952) ("i" . 953) ("k" . 954) ("l" . 955) ("m" . 956) ("n" . 957) ("c" . 958) ("o" . 959) ("p" . 960) ("r" . 961) ("s" . 963) ("t" . 964) ("u" . 965) ("f" . 966) ("x" . 967) ("y" . 968) ("w" . 969) ("s" . 962)) (#$ . 207))#@56 Translation table to convert greek beta code to utf-8.
(defconst diogenes--beta-to-utf8-table (byte-code "\301\302\303\"!\207" [diogenes--beta-to-utf8-map make-translation-table-from-alist mapcar #[257 "\211@\300!\262AB\207" [vconcat] 4 "\n\n(fn CONS)"]] 4) (#$ . 3742))#@56 Translation table to convert utf-8 greek to beta code.
(defconst diogenes--utf8-to-beta-table (byte-code "\301\302\303\"!\207" [diogenes--beta-to-utf8-map make-translation-table-from-alist mapcar #[257 "\211A@\300!\262B\207" [vconcat] 5 "\n\n(fn CONS)"]] 4) (#$ . 4022))#@59 Convert a string from greek beta code to utf-8.
(fn STR)
(defalias 'diogenes--beta-to-utf8 #[257 "\301\302\303\304\305\306\"r\211q\210\307\310\"\216c\210\311ed#\210\312 *\262#\207" [diogenes--beta-to-utf8-table replace-regexp-in-string "σ\\b\\|σ$" "ς" generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] translate-region buffer-string] 9 (#$ . 4302)])#@146 Convert a string from Perseus greek beta code to utf-8.
In addition to diogenes--beta-to-utf8, it handles also macron and
breve signs.
(fn STR)
(defalias 'diogenes--perseus-beta-to-utf8 #[257 "\211\205 \300\301\302\303\301\304\305\301\306\307\301\310\311####!\207" [diogenes--beta-to-utf8 replace-regexp-in-string "\\^" "̆" "\\(.\\)\\^\\([=/\\|+()]+\\)" "̆\\1\\2" "_" "̄" "\\(.\\)_\\([=/\\|+()]+\\)" "̄\\1\\2"] 15 (#$ . 4728)])#@63 Convert utf-8 greek in a string to greek beta code.
(fn STR)
(defalias 'diogenes--utf8-to-beta #[257 "\301\302\303\"r\211q\210\304\305\"\216c\210\306ed#\210\307 *\207" [diogenes--utf8-to-beta-table generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] translate-region buffer-string] 6 (#$ . 5169)])#@64 Ensures that a greek string is encoded in beta code.
(fn STR)
(defalias 'diogenes--greek-ensure-beta #[257 "\300 \301\302\"\216\303\304\"\210\305\303\306\"\211\203 \307!\266\202\202 \266\202)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data t] 3] string-match "\\cr" nil "\\cg" diogenes--utf8-to-beta] 6 (#$ . 5536)])
(defconst diogenes--iota-adscript-map '((8071 . "ἇι") (8087 . "ἧι") (8103 . "ὧι") (8070 . "ἆι") (8086 . "ἦι") (8102 . "ὦι") (8119 . "ᾶι") (8135 . "ῆι") (8183 . "ῶι") (8069 . "ἅι") (8085 . "ἥι") (8101 . "ὥι") (8068 . "ἄι") (8084 . "ἤι") (8100 . "ὤι") (8116 . "άι") (8132 . "ήι") (8180 . "ώι") (8067 . "ἃι") (8083 . "ἣι") (8099 . "ὣι") (8066 . "ἂι") (8082 . "ἢι") (8098 . "ὢι") (8114 . "ὰι") (8130 . "ὴι") (8178 . "ὼι") (8065 . "ἁι") (8081 . "ἡι") (8097 . "ὡι") (8064 . "ἀι") (8080 . "ἠι") (8096 . "ὠι") (8115 . "αι") (8131 . "ηι") (8179 . "ωι")))
(defconst diogenes--iota-adscript-table (byte-code "\301\302\303\"!\207" [diogenes--iota-adscript-map make-translation-table-from-alist mapcar #[257 "\211@A\300!\262B\207" [vconcat] 5 "\n\n(fn CONS)"]] 4))#@111 Convert all subscript iota into adscript ones in the current
buffer, or in the active region.
(fn BEGIN END)
(defalias 'diogenes-iota-subscript-to-adscript #[514 "\301 \204 e\262d\262\302#\207" [diogenes--iota-adscript-table region-active-p translate-region] 6 (#$ . 6754) "r"])#@12
(fn STR)
(defalias 'diogenes--beta-normalize-gravis #[257 "\300\301\302#\207" [replace-regexp-in-string "\\\\" "/"] 5 (#$ . 7045)])#@48 Test for the category non-spacing-mark
(fn C)
(defalias 'diogenes--unicode-non-spacing-mark-p #[257 "H\301U\207" [unicode-category-table 6] 3 (#$ . 7185)])
(byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put diogenes--unicode-non-spacing-mark-p speed -1 put byte-optimizer byte-compile-inline-expand] 5)#@46 Remove all diacritics in a string.
(fn STR)
(defalias 'diogenes--strip-diacritics #[257 "\300\301\302!\"\207" [cl-remove-if diogenes--unicode-non-spacing-mark-p string-glyph-decompose] 5 (#$ . 7511)])#@12
(fn A B)
(defalias 'diogenes--sort-alphabetically-no-diacritics #[514 "\300!\300!\231\207" [diogenes--strip-diacritics] 5 (#$ . 7719)])
(byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put diogenes--sort-alphabetically-no-diacritics speed -1 put byte-optimizer byte-compile-inline-expand] 5)#@83 Delete hyphenation in the active region, or until EOBP.
(fn &optional START END)
(defalias 'diogenes-remove-hyphenation #[512 "\212\214\300 \203 b\210\301 \210`b\210\302\210`}\210eb\210\302\211\211\303\304d\305#\205* \306\224\306\225B\262\203{ \302y\307U\205: \310\311!\211\205Q \312\313\314\"\315\"\205Q `\306\224\\`\306\225\\B\262\262\203{ @A{@AT|\210\316 \210Ab\210\317\306!\210\320!\266\302\262\202 \266*\302\207" [region-active-p beginning-of-line nil re-search-forward "\\([^ <-]+\\)-\\s-*$" t 1 0 thing-at-point line cl-find-if make-closure #[257 "\301\300\"\207" [V0 string-match] 4 "\n\n(fn REGEXP)"] ("^\\S-+\\s-\\{3,\\}\\(\\S-+\\)" "^\\s-\\{3,\\}\\(\\S-+\\)" "^\\(\\S-+\\)") delete-blank-lines delete-char insert-and-inherit] 10 (#$ . 8033) "r"])#@93 Replace all greek apostrophes with the typographical correct ῾.
(fn &optional START END)
(defalias 'diogenes-apostrophe #[512 "\212\214\300 \203 }\210eb\210\301\302\303\"*\207" [use-region-p replace-regexp "\\([[:nonascii:]]+\\)['’]" "\\1᾿"] 5 (#$ . 8818) "r"])#@11
(fn OL)
(defalias 'diogenes--ol-to-ad #[257 "\211\300_\301Z\211\302W\203\f \207\211T\207" [4 780 0] 4 (#$ . 9095)])#@13
(fn YEAR)
(defalias 'diogenes--bc-and-ad #[257 "\211\300W\203\f \301\302[\"\207\301\303\"\207" [0 format "%s B.C." "%s A.D."] 4 (#$ . 9218)])
(provide 'diogenes-utils)