(est-eval-value-as-object): Accept `=title' as the same as `=name'.
authorMORIOKA Tomohiko <tomo.git@chise.org>
Tue, 15 Mar 2022 13:08:51 +0000 (22:08 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Thu, 28 Apr 2022 13:35:39 +0000 (22:35 +0900)
(est-eval-value-as-sources): New function.
(est-eval-apply-value):
- Use `est-eval-value-as-sources' instead of
  `est-eval-value-as-domain-list' for format
  `space-separated-domain-list'.
- Support new format `space-separated-source-list'.

est-eval.el

index ef1914f..10ff991 100644 (file)
                                 genre-o 'object-representative-feature))
                           'name))
                      (www-get-feature-value value '=name)
+                     (www-get-feature-value value '=title)
                      (est-eval-value-default value))
                  ))
                )))
                value)))
     (est-eval-value-default value)))
 
+(defun est-eval-value-as-sources (value)
+  (if (listp value)
+      (let (unit-str
+           source item source-objs source0 start end num
+           source-cobj title)
+       (list* 'res-list
+              '(:separator " ")
+              (mapcar
+               (lambda (unit)
+                 (setq unit-str
+                       (if (symbolp unit)
+                           (symbol-name unit)
+                         (format "%s" unit)))
+                 (if (string-match "=" unit-str)
+                     (setq source (intern
+                                   (substring unit-str 0 (match-beginning 0)))
+                           item (car (read-from-string
+                                      (substring unit-str (match-end 0)))))
+                   (setq source unit
+                         item nil))
+                 (cond
+                  ((and (setq source-cobj (concord-decode-object
+                                           '=chise-bib-id source 'bibliography))
+                        (setq title (concord-object-get source-cobj '=title)))
+                   (setq source-objs
+                         (if item
+                             (list (est-eval-value-as-object source-cobj)
+                                   "="
+                                   item)
+                           (list (est-eval-value-as-object source-cobj))))
+                   )
+                  ((eq source 'bos)
+                   (setq source-objs
+                         (list
+                          (est-eval-value-as-object
+                           (or (concord-decode-object
+                                '=id item 'book@ruimoku)
+                               (concord-decode-object
+                                '=id item 'article@ruimoku)
+                               unit))))
+                   )
+                  ((memq source '(zob1959 zob1968))
+                   (if (and (symbolp item)
+                            (setq num (symbol-name item))
+                            (string-match
+                             "^\\([0-9]+\\)-\\([0-9]+\\)$" num))
+                       (setq start (string-to-number
+                                    (match-string 1 num))
+                             end (string-to-number
+                                  (match-string 2 num)))
+                     (setq start item
+                           end item))
+                   (if (not (numberp start))
+                       (setq source-objs
+                             (list
+                              (est-eval-value-as-object unit)))
+                     (if (eq source source0)
+                         (setq source-objs
+                               (list
+                                (list 'link
+                                      (list :ref
+                                            (format "http://chise.zinbun.kyoto-u.ac.jp/koukotsu/rubbings/%04d"
+                                                    start))
+                                      start)))
+                       (setq source0 source)
+                       (setq source-objs
+                             (list
+                              (list 'link
+                                      (list :ref
+                                            (format "http://chise.zinbun.kyoto-u.ac.jp/koukotsu/rubbings/%04d"
+                                                    start))
+                                      start)
+                              "="
+                              '(link
+                                (:ref "http://chise.zinbun.kyoto-u.ac.jp/koukotsu/")
+                                "\u4EAC大人\u6587研甲\u9AA8")))
+                       )
+                     (setq num (1+ start))
+                     (while (<= num end)
+                       (setq source-objs
+                             (cons
+                              (list 'link
+                                    (list :ref
+                                          (format "http://chise.zinbun.kyoto-u.ac.jp/koukotsu/rubbings/%04d"
+                                                  num))
+                                    num)
+                              source-objs))
+                       (setq num (1+ num)))
+                     (setq source-objs (nreverse source-objs)))
+                   )
+                  (t
+                   (setq source-objs
+                         (list (est-eval-value-as-object unit)))
+                   ))
+                 (list* 'res-link
+                        (list :separator " "
+                              :source source :item item)
+                        source-objs)
+                 )
+               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)))
         ((eq format 'space-separated-ids)
          (est-eval-value-as-space-separated-ids value))
         ((eq format 'space-separated-domain-list)
-         (est-eval-value-as-domain-list value))
+          ;; (est-eval-value-as-domain-list value)
+         (est-eval-value-as-sources value))
+        ((eq format 'space-separated-source-list)
+         (est-eval-value-as-sources value))
         ((eq format 'space-separated-creator-name-list)
          (est-eval-value-as-creators-names value))
         ((eq format 'unordered-creator-name-list)