(est-eval-value-as-HDIC-Yuanben-Yupian-volume-leaf-line-number): New
authorMORIOKA Tomohiko <tomo.git@chise.org>
Wed, 19 Jan 2022 01:38:01 +0000 (10:38 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Wed, 19 Jan 2022 06:36:43 +0000 (15:36 +0900)
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.

est-eval.el

index 8a9a838..ef1914f 100644 (file)
                          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)))
         ((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)
     (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