From: MORIOKA Tomohiko Date: Sat, 30 Mar 2019 15:28:28 +0000 (+0900) Subject: (daijiten-page-number-to-ndl-950498): New function. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70b9c272da0b3d8441cc742fa7099ecfa3f38149;p=chise%2Fest.git (daijiten-page-number-to-ndl-950498): New function. (est-eval-value-as-daijiten-page): New function. (est-eval-value-as-daijiten-page-list): New function. (est-eval-apply-value): Use `est-eval-value-as-daijiten-page-list' for format `space-separated-daijiten-page-list'. --- diff --git a/est-eval.el b/est-eval.el index 8076a43..d395637 100644 --- a/est-eval.el +++ b/est-eval.el @@ -426,6 +426,27 @@ (format "%c" (ideographic-radical value))) (est-eval-value-as-S-exp value))) +(defun daijiten-page-number-to-ndl-950498 (page) + (+ (/ page 2) + (cond ((< page 229) + 23) + ((< page 261) + 24) + ((< page 263) + 25) + ((< page 516) ; 284=285 + 26) + (t + 27)))) + +(defun est-eval-value-as-daijiten-page (value) + (if (integerp value) + (list 'link + (list :ref + (format "http://image.chise.org/tify/?manifest=https://www.dl.ndl.go.jp/api/iiif/950498/manifest.json&tify={%%22pages%%22:[%d]}" + (daijiten-page-number-to-ndl-950498 value))) + value))) + (defun est-eval-value-as-object-list (value &optional separator subtype) (if (and (listp value) (listp (cdr value))) @@ -656,6 +677,20 @@ value))) (est-eval-value-default value))) +(defun est-eval-value-as-daijiten-page-list (value &optional separator subtype) + (if (and (listp value) + (listp (cdr value))) + (condition-case nil + (let (props) + (if separator + (setq props (list :separator separator))) + (if subtype + (setq props (list* :subtype subtype props))) + (list* 'list props + (mapcar #'est-eval-value-as-daijiten-page value))) + (error (format "%s" value))) + (format "%s" value))) + (defun est-eval-value-as-creators-names (value &optional subtype) (if (listp value) (let (role-name) @@ -820,6 +855,8 @@ (est-eval-value-as-created-works value 'unordered-list)) ((eq format 'journal-volume-list) (est-eval-value-as-journal-volumes value)) + ((eq format 'space-separated-daijiten-page-list) + (est-eval-value-as-daijiten-page-list value " ")) (t (est-eval-value-default value) ))