From: MORIOKA Tomohiko Date: Wed, 19 Jan 2022 01:38:01 +0000 (+0900) Subject: (est-eval-value-as-HDIC-Yuanben-Yupian-volume-leaf-line-number): New X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6dfe4156ac4c1f00c32d7155341af9c20a39480;p=chise%2Fest.git (est-eval-value-as-HDIC-Yuanben-Yupian-volume-leaf-line-number): New function. (est-eval-apply-value): Use `est-eval-value-as-HDIC-Yuanben-Yupian-volume-leaf-line-number' for format `hdic-yy-readable'. (est-eval-unit): Treat `hdic-yy-readable' as a value getter. --- diff --git a/est-eval.el b/est-eval.el index 8a9a838..ef1914f 100644 --- a/est-eval.el +++ b/est-eval.el @@ -476,6 +476,21 @@ value)) (format "/%s/" (char-to-string value))))) +(defun est-eval-value-as-HDIC-Yuanben-Yupian-volume-leaf-line-number (value) + (if (symbolp value) + (setq value (symbol-name value))) + (if (and (stringp value) + (string-match + "^Y\\([0-9][0-9]\\)\\([0-9][0-9][0-9]\\)\\([0-9][0-9][0-9]\\)-\\([0-9]\\)$" + value)) + (format "%d巻 %d紙 %d列 %d字目 (%s)" + (string-to-int (match-string 1 value)) + (string-to-int (match-string 2 value)) + (string-to-int (match-string 3 value)) + (string-to-int (match-string 4 value)) + value) + value)) + (defun est-eval-value-as-object-list (value &optional separator subtype) (if (and (listp value) (listp (cdr value))) @@ -866,6 +881,9 @@ ((eq format 'tify-url-for-ndl) (est-eval-value-as-ndl-page-by-tify value) ) + ((eq format 'hdic-yy-readable) + (est-eval-value-as-HDIC-Yuanben-Yupian-volume-leaf-line-number value) + ) ((eq format 'shuowen-radical) (est-eval-value-as-shuowen-radical value)) ((eq format 'ids) @@ -964,7 +982,8 @@ (cond ((memq (car exp) '(value decimal hex HEX ku-ten kangxi-radical shuowen-radical - S-exp string default tify-url-for-ndl)) + S-exp string default + tify-url-for-ndl hdic-yy-readable)) (let ((fn (plist-get (nth 1 exp) :feature)) domain domain-fn ret) (when fn