From: MORIOKA Tomohiko Date: Mon, 13 Jun 2011 12:06:01 +0000 (+0900) Subject: (ruimoku-format-volume): New function. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=d3dd5c0b4284dfa62dfcb0c8611a0c6da241c09b;p=chise%2Fest.git (ruimoku-format-volume): New function. (est-eval-journal-volume): New function. (est-eval-value-as-object): Use `est-eval-journal-volume' for genre `journal-volume@ruimoku'. (est-eval-value-as-creators-names): New function. (est-eval-value-as-created-works): New function. (est-eval-apply-value): Use `est-eval-value-as-creators-names' for `space-separated-creator-name-list'; use `est-eval-value-as-created-works' for `space-separated-created-work-list'. --- diff --git a/est-eval.el b/est-eval.el index 7bf4482..a99bb10 100644 --- a/est-eval.el +++ b/est-eval.el @@ -1,6 +1,49 @@ ;; -*- coding: utf-8-mcs-er -*- (require 'cwiki-common) +(defun ruimoku-format-volume (spec value year lang) + (when (stringp spec) + (setq spec (car (read-from-string spec)))) + (cond ((eq spec 'YY) (if (eq lang 'cjk) + (format "%d年" year) + (format "%d" year))) + ((eq spec 00) value) + ((eq spec 01) (concat value "期")) + ((eq spec 02) (concat value "巻")) + ((eq spec 03) (concat value "号")) + ((eq spec 04) (concat value ">-35694;")) + ((eq spec 05) (concat value ">-33870;")) + ((eq spec 06) (concat value ">-56392;")) + ((eq spec 07) (concat value "輯")) + ((eq spec 08) (concat value ">-53119;")) + ((eq spec 09) (concat value ">-53119;分󠄀")) + ((eq spec 10) (concat value "冊")) + ((eq spec 11) (concat value "分󠄀冊")) + ((eq spec 12) (concat value "&J90-3C21;")) + ((eq spec 13) (concat value ">-18140;号")) + ((eq spec 14) (concat value "特>-56392;号")) + ((eq spec 15) (concat value "本")) + ((eq spec 16) (concat value "分󠄀")) + ((eq spec 51) (concat "Vol." value)) + ((eq spec 52) (concat "No." value)) + ((eq spec 53) (concat "Part " value)) + ((eq spec 54) (concat "Issue " value)) + ((eq spec 55) (concat "Tome " value)) + ((eq spec 56) (concat "Tomo " value)) + ((eq spec 57) (concat "Tomus " value)) + ((eq spec 58) (concat "Fasc." value)) + ((eq spec 59) (concat "Livre " value)) + ((eq spec 60) (concat "Année " value)) + ((eq spec 61) (concat "Bd." value)) + ((eq spec 62) (concat "Heft " value)) + ((eq spec 63) (concat "Nr." value)) + ((eq spec 64) (concat "Jahrg." value)) + ((eq spec 65) (concat "Jaarg." value)) + ((eq spec 66) (concat "Trimestre" value)) + (t "") + )) + + ;;; @ Feature value presentation ;;; @@ -19,28 +62,113 @@ value))) (est-eval-value-as-S-exp value))) +;; (defun est-journal-volume-object-get-volume-format (spec feature) +;; (when (integerp spec) +;; (setq spec (format "%02d" spec))) +;; (cond ((string= spec "YY") `((decimal (:feature +;; ->published/date*year)) "年")) +;; ((string= spec "00") `((decimal (:feature ,feature)))) +;; ((string= spec "01") `((decimal (:feature ,feature)) "期")) +;; ((string= spec "02") `((decimal (:feature ,feature)) "巻")) +;; ((string= spec "03") `((decimal (:feature ,feature)) "号")) +;; ((string= spec "04") `((decimal (:feature ,feature)) ">-35694;")) +;; ((string= spec "05") `((decimal (:feature ,feature)) ">-33870;")) +;; ((string= spec "06") `((decimal (:feature ,feature)) ">-56392;")) +;; ((string= spec "07") `((decimal (:feature ,feature)) "輯")) +;; ((string= spec "08") `((decimal (:feature ,feature)) ">-53119;")) +;; ((string= spec "09") `((decimal (:feature ,feature)) ">-53119;分󠄀")) +;; ((string= spec "10") `((decimal (:feature ,feature)) "冊")) +;; ((string= spec "11") `((decimal (:feature ,feature)) "分󠄀冊")) +;; ((string= spec "12") `((decimal (:feature ,feature)) "&J90-3C21;")) +;; ((string= spec "13") `((decimal (:feature ,feature)) ">-18140;号")) +;; ((string= spec "14") `((decimal (:feature ,feature)) "特>-56392;号")) +;; ((string= spec "15") `((decimal (:feature ,feature)) "本")) +;; ((string= spec "16") `((decimal (:feature ,feature)) "分󠄀")) +;; ((string= spec "51") `("Vol." ((decimal (:feature ,feature))))) +;; ((string= spec "52") `("No." ((decimal (:feature ,feature))))) +;; ((string= spec "53") `("Part " ((decimal (:feature ,feature))))) +;; ((string= spec "54") `("Issue " ((decimal (:feature ,feature))))) +;; ((string= spec "55") `("Tome " ((decimal (:feature ,feature))))) +;; ((string= spec "56") `("Tomo " ((decimal (:feature ,feature))))) +;; ((string= spec "57") `("Tomus " ((decimal (:feature ,feature))))) +;; ((string= spec "58") `("Fasc." ((decimal (:feature ,feature))))) +;; ((string= spec "59") `("Livre " ((decimal (:feature ,feature))))) +;; ((string= spec "60") `("Année " ((decimal (:feature ,feature))))) +;; ((string= spec "61") `("Bd." ((decimal (:feature ,feature))))) +;; ((string= spec "62") `("Heft " ((decimal (:feature ,feature))))) +;; ((string= spec "63") `("Nr." ((decimal (:feature ,feature))))) +;; ((string= spec "64") `("Jahrg." ((decimal (:feature ,feature))))) +;; ((string= spec "65") `("Jaarg." ((decimal (:feature ,feature))))) +;; ((string= spec "66") `("Trimestre" ((decimal (:feature ,feature))))) +;; (t nil) +;; )) + +(defun est-eval-journal-volume (value) + (let ((journal (car (concord-object-get value '<-volume))) + volume-type number-type + year) + (setq volume-type (concord-object-get journal 'volume/type/code) + number-type (concord-object-get journal 'number/type/code)) + (setq year (concord-object-get value '->published/date*year)) + ;; (append (list (concord-object-get journal 'name)) + ;; (est-journal-volume-object-get-volume-format + ;; volume-type '<-volume*volume) + ;; (est-journal-volume-object-get-volume-format + ;; number-type '<-volume*number) + ;; ) + (concat (concord-object-get journal 'name) + " " + (ruimoku-format-volume + volume-type + (concord-object-get value '<-volume*volume) + year 'cjk) + (ruimoku-format-volume + number-type + (concord-object-get value '<-volume*number) + year 'cjk)) + )) + +;; (defun est-eval-creator (value) +;; (est-eval-list +;; '((value (:feature ->name)) +;; (string (:feature role*name))) +;; value nil)) + (defun est-eval-value-as-object (value) (if (or (characterp value) (concord-object-p value)) (list 'object (list :object value) (if (characterp value) (char-to-string value) - (let ((genre-o (concord-decode-object - '=id (concord-object-genre value) - 'genre)) + (let ((genre (concord-object-genre value)) + genre-o format) - (or (and genre-o - (setq format - (concord-object-get - genre-o 'object-representative-format)) - (est-eval-list format value nil)) - (www-get-feature-value - value - (or (and genre-o - (www-get-feature-value - genre-o 'object-representative-feature)) - 'name)) - (est-eval-value-default value))))) + (cond + ((eq genre 'journal-volume@ruimoku) + ;; (est-eval-list + ;; (est-journal-volume-get-object-format value) + ;; value nil) + (est-eval-journal-volume value) + ) + ;; ((eq genre 'creator@ruimoku) + ;; (est-eval-creator value) + ;; ) + (t + (setq genre-o (concord-decode-object '=id genre 'genre)) + (or (and genre-o + (setq format + (concord-object-get + genre-o 'object-representative-format)) + (est-eval-list format value nil)) + (www-get-feature-value + value + (or (and genre-o + (www-get-feature-value + genre-o 'object-representative-feature)) + 'name)) + (est-eval-value-default value)) + )) + ))) (est-eval-value-default value))) (defun est-eval-value-as-HEX (value) @@ -189,6 +317,41 @@ value))) (est-eval-value-default value))) +(defun est-eval-value-as-creators-names (value) + (if (listp value) + (let (role-name) + (list* 'creator-name + '(:separator " ") + (mapcar (lambda (creator) + (setq role-name + (concord-object-get creator + 'role*name)) + (est-eval-list + (list + '(value (:feature ->name)) + (list + 'object (list :object creator) + (or role-name + (format "(%s)" + (concord-object-get creator + 'role*type))))) + creator nil) + ) + value) + )) + (est-eval-value-default value))) + +(defun est-eval-value-as-created-works (value) + (if (listp value) + (list* 'creator-name + '(:separator " ") + (mapcar (lambda (creator) + (est-eval-list + '((value (:feature ->created))) + creator nil)) + value)) + (est-eval-value-default value))) + ;;; @ format evaluator ;;; @@ -266,6 +429,10 @@ (est-eval-value-as-space-separated-ids value)) ((eq format 'space-separated-domain-list) (est-eval-value-as-domain-list value)) + ((eq format 'space-separated-creator-name-list) + (est-eval-value-as-creators-names value)) + ((eq format 'space-separated-created-work-list) + (est-eval-value-as-created-works value)) (t (est-eval-value-default value) ))