1 ;; -*- coding: utf-8-mcs-er -*-
2 (require 'cwiki-common)
4 (defvar est-eval-list-feature-items-limit 20)
6 (defun ruimoku-format-volume (spec value year lang)
8 (setq spec (car (read-from-string spec))))
9 (cond ((eq spec 'YY) (if (eq lang 'cjk)
13 ((eq spec 01) (concat value "期"))
14 ((eq spec 02) (concat value "巻"))
15 ((eq spec 03) (concat value "号"))
16 ((eq spec 04) (concat value "編"))
17 ((eq spec 05) (concat value "&MJ019590;"))
18 ((eq spec 06) (concat value "集"))
19 ((eq spec 07) (concat value "輯"))
20 ((eq spec 08) (concat value "部"))
21 ((eq spec 09) (concat value "部分"))
22 ((eq spec 10) (concat value "冊"))
23 ((eq spec 11) (concat value "分冊"))
24 ((eq spec 12) (concat value "次"))
25 ((eq spec 13) (concat value "月号"))
26 ((eq spec 14) (concat value "特集号"))
27 ((eq spec 15) (concat value "本"))
28 ((eq spec 16) (concat value "分"))
29 ((eq spec 51) (concat "Vol." value))
30 ((eq spec 52) (concat "No." value))
31 ((eq spec 53) (concat "Part " value))
32 ((eq spec 54) (concat "Issue " value))
33 ((eq spec 55) (concat "Tome " value))
34 ((eq spec 56) (concat "Tomo " value))
35 ((eq spec 57) (concat "Tomus " value))
36 ((eq spec 58) (concat "Fasc." value))
37 ((eq spec 59) (concat "Livre " value))
38 ((eq spec 60) (concat "Année " value))
39 ((eq spec 61) (concat "Bd." value))
40 ((eq spec 62) (concat "Heft " value))
41 ((eq spec 63) (concat "Nr." value))
42 ((eq spec 64) (concat "Jahrg." value))
43 ((eq spec 65) (concat "Jaarg." value))
44 ((eq spec 66) (concat "Trimestre" value))
49 ;;; @ Feature value presentation
52 (defun est-eval-value-as-S-exp (value)
53 (list 'S-exp nil (format "%S" value)))
55 (defun est-eval-value-default (value)
57 (if (eq (car value) 'omitted)
65 (est-eval-value-as-S-exp value)))
67 (defun est-eval-value-as-image-resource (value &optional accept-full-image)
68 (let ((name (concord-object-get value 'name)))
70 ((concord-object-get value 'image-offset-x)
71 (list 'img (list* :src (or (concord-object-get value '=location@iiif)
72 (concord-object-get value '=location))
77 (list 'img (list* :src (concord-object-get value '=location)
84 (defun est-eval-value-as-glyph-image (value)
85 (let ((image-resource (car (concord-object-get value '->image-resource))))
86 (est-eval-value-as-image-resource image-resource)))
88 (defun est-eval-value-as-image-object (value)
89 (let ((image-resource (car (concord-object-get value '->image-resource))))
90 (list 'object (list :object value)
91 (est-eval-value-as-image-resource
92 image-resource 'accept-full-image))))
94 ;; (defun est-journal-volume-object-get-volume-format (spec feature)
95 ;; (when (integerp spec)
96 ;; (setq spec (format "%02d" spec)))
97 ;; (cond ((string= spec "YY") `((decimal (:feature
98 ;; ->published/date*year)) "年"))
99 ;; ((string= spec "00") `((decimal (:feature ,feature))))
100 ;; ((string= spec "01") `((decimal (:feature ,feature)) "期"))
101 ;; ((string= spec "02") `((decimal (:feature ,feature)) "巻"))
102 ;; ((string= spec "03") `((decimal (:feature ,feature)) "号"))
103 ;; ((string= spec "04") `((decimal (:feature ,feature)) "&AJ1-03620;"))
104 ;; ((string= spec "05") `((decimal (:feature ,feature)) "&MJ019590;"))
105 ;; ((string= spec "06") `((decimal (:feature ,feature)) "集"))
106 ;; ((string= spec "07") `((decimal (:feature ,feature)) "輯"))
107 ;; ((string= spec "08") `((decimal (:feature ,feature)) "部"))
108 ;; ((string= spec "09") `((decimal (:feature ,feature)) "部分"))
109 ;; ((string= spec "10") `((decimal (:feature ,feature)) "冊"))
110 ;; ((string= spec "11") `((decimal (:feature ,feature)) "分冊"))
111 ;; ((string= spec "12") `((decimal (:feature ,feature)) "次"))
112 ;; ((string= spec "13") `((decimal (:feature ,feature)) "月号"))
113 ;; ((string= spec "14") `((decimal (:feature ,feature)) "特集号"))
114 ;; ((string= spec "15") `((decimal (:feature ,feature)) "本"))
115 ;; ((string= spec "16") `((decimal (:feature ,feature)) "分"))
116 ;; ((string= spec "51") `("Vol." ((decimal (:feature ,feature)))))
117 ;; ((string= spec "52") `("No." ((decimal (:feature ,feature)))))
118 ;; ((string= spec "53") `("Part " ((decimal (:feature ,feature)))))
119 ;; ((string= spec "54") `("Issue " ((decimal (:feature ,feature)))))
120 ;; ((string= spec "55") `("Tome " ((decimal (:feature ,feature)))))
121 ;; ((string= spec "56") `("Tomo " ((decimal (:feature ,feature)))))
122 ;; ((string= spec "57") `("Tomus " ((decimal (:feature ,feature)))))
123 ;; ((string= spec "58") `("Fasc." ((decimal (:feature ,feature)))))
124 ;; ((string= spec "59") `("Livre " ((decimal (:feature ,feature)))))
125 ;; ((string= spec "60") `("Année " ((decimal (:feature ,feature)))))
126 ;; ((string= spec "61") `("Bd." ((decimal (:feature ,feature)))))
127 ;; ((string= spec "62") `("Heft " ((decimal (:feature ,feature)))))
128 ;; ((string= spec "63") `("Nr." ((decimal (:feature ,feature)))))
129 ;; ((string= spec "64") `("Jahrg." ((decimal (:feature ,feature)))))
130 ;; ((string= spec "65") `("Jaarg." ((decimal (:feature ,feature)))))
131 ;; ((string= spec "66") `("Trimestre" ((decimal (:feature ,feature)))))
135 (defun est-eval-value-as-journal-volume (value &optional short)
136 (let ((journal (car (or (concord-object-get value '<-journal/volume)
137 (concord-object-get value '<-volume))))
138 (vol-name (concord-object-get value '<-journal/volume*name))
139 volume-type number-type
141 dest ret title subtitle)
147 (list 'object (list :object value)
149 (setq volume-type (concord-object-get journal 'volume/type/code)
150 number-type (concord-object-get journal 'number/type/code))
151 (setq year (or (concord-object-get value '->published/date*year)
153 (car (concord-object-get value 'date)) 'year)))
158 (ruimoku-format-volume
160 (or (concord-object-get value '<-journal/volume*volume)
161 (concord-object-get value '<-volume*volume))
163 (ruimoku-format-volume
165 (or (concord-object-get value '<-journal/volume*number)
166 (concord-object-get value '<-volume*number))
170 (if (setq ret (est-eval-value-as-object journal))
172 (list* ret " " dest))))
173 (list* 'list '(:subtype sequence :separator "") dest)
175 ((setq title (concord-object-get value 'title))
176 (setq subtitle (concord-object-get value 'title/subtitle))
179 (if (eq (concord-object-get value 'writing-system) 'cjk)
182 (list 'object (list :object value)
184 (concat title " — " subtitle)
189 (list 'object (list :object value)
191 (concat title " — " subtitle)
196 (est-eval-value-default value)
198 ;; (concat (concord-object-get journal 'name)
200 ;; (ruimoku-format-volume
202 ;; (or (concord-object-get value '<-journal/volume*volume)
203 ;; (concord-object-get value '<-volume*volume))
205 ;; (ruimoku-format-volume
207 ;; (or (concord-object-get value '<-journal/volume*number)
208 ;; (concord-object-get value '<-volume*number))
212 (defun est-eval-value-as-article (value)
213 (let ((journal-volume (car (concord-object-get value '<-article)))
214 (page (concord-object-get value 'page))
217 (setq date (car (concord-object-get journal-volume 'date)))
219 (setq ret (est-eval-value-as-object date)))
220 (setq dest (list ", " ret))))
222 (setq dest (list* ", pp." page dest)))
223 (when (and journal-volume
224 (setq ret (est-eval-value-as-journal-volume journal-volume)))
225 (setq dest (cons ret dest)))
226 (if (setq ret (est-eval-value-as-book value))
227 (setq dest (list* ret " " dest)))
228 (list* 'list '(:subtype sequence :separator "") dest))
229 ;; (let ((creators (concord-object-get value '->creator))
230 ;; (title (concord-object-get value 'title))
231 ;; creator-name creator-role)
235 ;; (setq creator-name
236 ;; (concord-object-get
237 ;; (car (concord-object-get creator '->creator/name))
239 ;; (setq creator-role
240 ;; (or (concord-object-get creator 'role*name)
242 ;; (concord-object-get creator 'role*type))))
243 ;; (concat creator-name " " creator-role))
245 ;; (if (eq (concord-object-get value 'writing-system) 'cjk)
246 ;; (concat "「" title "」")
247 ;; (concat " ‘" title "’"))))
250 (defun est-eval-value-as-book (value)
251 (let ((creators (concord-object-get value '->creator))
252 (title (concord-object-get value 'title))
253 (subtitle (concord-object-get value 'title/subtitle))
254 (series (concord-object-get value 'series))
255 (publisher (car (concord-object-get value 'publisher)))
256 (date (car (concord-object-get value 'date)))
257 ;; creator-name creator-role
260 (setq ret (est-eval-value-as-object date)))
261 (setq dest (list ", " ret)))
263 (setq ret (est-eval-value-as-object publisher)))
264 (setq dest (list* " " ret dest)))
266 (setq dest (list* series "," dest)))
269 (if (eq (concord-object-get value 'writing-system) 'cjk)
272 (list 'object (list :object value)
274 (concat title " — " subtitle)
279 (list 'object (list :object value)
281 (concat title " — " subtitle)
285 (list 'object (list :object value)
289 (setq ret (est-eval-value-as-creators-names creators)))
290 (setq dest (cons ret dest)))
291 (list* 'list '(:subtype sequence :separator "") dest)
295 ;; (setq creator-name
296 ;; (concord-object-get
297 ;; (car (concord-object-get creator '->creator/name))
299 ;; (setq creator-role
300 ;; (or (concord-object-get creator 'role*name)
302 ;; (concord-object-get creator 'role*type))))
303 ;; (concat creator-name " " creator-role))
305 ;; (if (eq (concord-object-get value 'writing-system) 'cjk)
308 ;; (concat " — " subtitle))
310 ;; (concat " ‘" title
312 ;; (concat " — " subtitle))
315 ;; (concat " " series))
318 ;; (concord-object-get
319 ;; (car (concord-object-get
320 ;; publisher '->publisher/name))
323 ;; (concat ", " (concord-object-get date 'name)))))
326 ;; (defun est-eval-creator (value)
328 ;; '((value (:feature ->name))
329 ;; (string (:feature role*name)))
332 (defun est-eval-value-as-object (value)
333 (if (or (characterp value)
334 (concord-object-p value))
335 (list 'object (list :object value)
336 (if (characterp value)
337 (char-to-string value)
338 (let ((genre (concord-object-genre value))
342 ((eq genre 'journal-volume@ruimoku)
344 ;; (est-journal-volume-get-object-format value)
346 (est-eval-value-as-journal-volume value)
348 ((eq genre 'article@ruimoku)
349 (est-eval-value-as-article value)
351 ((eq genre 'book@ruimoku)
352 (est-eval-value-as-book value)
354 ;; ((eq genre 'creator@ruimoku)
355 ;; (est-eval-creator value)
357 ((eq genre 'image-resource)
358 (est-eval-value-as-image-resource value)
360 ((eq genre 'glyph-image)
361 (est-eval-value-as-glyph-image value)
364 (setq genre-o (concord-decode-object '=id genre 'genre))
368 genre-o 'object-representative-format))
369 (est-eval-list format value nil))
370 (www-get-feature-value
373 (www-get-feature-value
374 genre-o 'object-representative-feature))
376 (www-get-feature-value value '=name)
377 (est-eval-value-default value))
380 (est-eval-value-default value)))
382 (defun est-eval-value-as-character (value)
384 (if (and (concord-object-p value)
385 (setq ret (concord-object-get value 'character)))
386 (list 'object (list :object value)
387 (mapconcat #'char-to-string ret ""))
388 (est-eval-value-as-object value))))
390 (defun est-eval-value-as-location (value)
392 (if (and (concord-object-p value)
393 (setq ret (concord-object-get value '=location)))
394 (list 'object (list :object value)
396 (est-eval-value-as-object value))))
398 (defun est-eval-value-as-name (value)
400 (if (and (concord-object-p value)
401 (setq ret (concord-object-get value 'name)))
402 (list 'object (list :object value)
404 (est-eval-value-as-object value))))
406 (defun est-eval-value-as-HEX (value)
408 (list 'HEX nil (format "%X" value))
409 (est-eval-value-as-S-exp value)))
411 (defun est-eval-value-as-kuten (value)
416 (- (lsh value -8) 32)
417 (- (logand value 255) 32)))
418 (est-eval-value-as-S-exp value)))
420 (defun est-eval-value-as-kangxi-radical (value)
421 (if (and (integerp value)
424 (list 'kangxi-radical
426 (format "%c" (ideographic-radical value)))
427 (est-eval-value-as-S-exp value)))
429 (defun est-eval-value-as-shuowen-radical (value)
430 (if (and (integerp value)
433 (list 'shuowen-radical
435 (format "%c" (shuowen-radical value)))
436 (est-eval-value-as-S-exp value)))
438 (defun daijiten-page-number-to-ndl-950498 (page)
446 ((< page 516) ; 284=285
451 (defun est-eval-value-as-daijiten-page (value)
455 (format "http://image.chise.org/tify/?manifest=https://www.dl.ndl.go.jp/api/iiif/950498/manifest.json&tify={%%22pages%%22:[%d]}"
456 (daijiten-page-number-to-ndl-950498 value)))
459 (defun est-eval-value-as-Web-yunzi-char (value)
460 (if (char-or-char-int-p value)
463 (format "http://suzukish.s252.xrea.com/search/inkyo/yunzi/%c"
465 (format "/%s/" (char-to-string value)))))
467 (defun est-eval-value-as-object-list (value &optional separator subtype)
468 (if (and (listp value)
473 (setq props (list :separator separator)))
475 (setq props (list* :subtype subtype props)))
477 (mapcar #'est-eval-value-as-object value)))
478 (error (format "%s" value)))
479 (format "%s" value)))
481 (defun est-eval-value-as-char-list (value &optional separator subtype)
482 (if (and (listp value)
487 (setq props (list :separator separator)))
489 (setq props (list* :subtype subtype props)))
491 (mapcar #'est-eval-value-as-character value)))
492 (error (format "%s" value)))
493 (format "%s" value)))
495 (defun est-eval-value-as-location-list (value &optional separator subtype)
496 (if (and (listp value)
501 (setq props (list :separator separator)))
503 (setq props (list* :subtype subtype props)))
505 (mapcar #'est-eval-value-as-location value)))
506 (error (format "%s" value)))
507 (format "%s" value)))
509 (defun est-eval-value-as-name-list (value &optional separator subtype)
510 (if (and (listp value)
515 (setq props (list :separator separator)))
517 (setq props (list* :subtype subtype props)))
519 (mapcar #'est-eval-value-as-name value)))
520 (error (format "%s" value)))
521 (format "%s" value)))
523 (defun est-eval-value-as-image-list (value &optional separator subtype)
524 (if (and (listp value)
529 (setq props (list :separator separator)))
531 (setq props (list* :subtype subtype props)))
532 (list* 'image-list props
533 (mapcar #'est-eval-value-as-image-object value)))
534 (error (format "%s" value)))
535 (format "%s" value)))
537 (defun est-eval-value-as-composition-list (value &optional separator subtype)
538 (if (and (listp value)
543 (setq props (list :separator separator)))
545 (setq props (list* :subtype subtype props)))
551 (list 'object (list :object (car cell))
552 (format "U+%04X" (car cell)))
554 (est-eval-value-as-object (cdr cell))))
557 (< (car a)(car b)))))))
558 (error (format "%s" value)))
559 (format "%s" value)))
561 (defun est-eval-value-as-decomposition-list (value)
562 (if (and (listp value)
567 (mapconcat #'char-to-string value "")
570 (list* 'list '(:separator " + ")
573 (list 'object (list :object chr)
574 (format "U+%04X" chr)))
577 (error (format "%s" value)))
578 (format "%s" value)))
580 ;; (defun est-eval-value-as-ids (value)
582 ;; (list 'ids nil (ideographic-structure-to-ids value))
583 ;; (format "%s" value)))
584 (defun est-eval-value-as-ids (value)
588 (mapcar #'est-eval-value-as-object
589 (ideographic-structure-to-ids value))
591 (est-eval-value-default value)))
593 (defun est-eval-value-as-space-separated-ids (value)
597 ;; (mapconcat #'char-to-string
598 ;; (ideographic-structure-to-ids value)
600 (mapcar #'est-eval-value-as-object
601 (ideographic-structure-to-ids value))
603 (est-eval-value-default value)))
605 (defun est-eval-value-as-domain-list (value)
607 (let (source item source-objs source0 start end num)
617 ((string-match "=" unit)
619 (substring unit 0 (match-beginning 0)))
620 item (car (read-from-string
621 (substring unit (match-end 0)))))
626 (est-eval-value-as-object
627 (or (concord-decode-object
628 '=id item 'book@ruimoku)
629 (concord-decode-object
630 '=id item 'article@ruimoku)
633 ((memq source '(zob1959 zob1968))
634 (if (and (symbolp item)
635 (setq num (symbol-name item))
637 "^\\([0-9]+\\)-\\([0-9]+\\)$" num))
638 (setq start (string-to-number
639 (match-string 1 num))
640 end (string-to-number
641 (match-string 2 num)))
644 (if (not (numberp start))
647 (est-eval-value-as-object (intern unit))))
648 (if (eq source source0)
653 (format "http://chise.zinbun.kyoto-u.ac.jp/koukotsu/rubbings/%04d"
656 (setq source0 source)
661 (format "http://chise.zinbun.kyoto-u.ac.jp/koukotsu/rubbings/%04d"
666 (:ref "http://chise.zinbun.kyoto-u.ac.jp/koukotsu/")
667 "\u4EAC大人\u6587研甲\u9AA8")))
669 (setq num (1+ start))
675 (format "http://chise.zinbun.kyoto-u.ac.jp/koukotsu/rubbings/%04d"
680 (setq source-objs (nreverse source-objs)))
684 (list (est-eval-value-as-object (intern unit))))
688 :source source :item item)
692 (list 'res-link nil unit)
695 (est-eval-value-default value)))
697 (defun est-eval-value-as-daijiten-page-list (value &optional separator subtype)
698 (if (and (listp value)
703 (setq props (list :separator separator)))
705 (setq props (list* :subtype subtype props)))
707 (mapcar #'est-eval-value-as-daijiten-page value)))
708 (error (format "%s" value)))
709 (format "%s" value)))
711 (defun est-eval-value-as-Web-yunzi-char-list (value &optional separator subtype)
712 (if (and (listp value)
717 (setq props (list :separator separator)))
719 (setq props (list* :subtype subtype props)))
721 (mapcar #'est-eval-value-as-Web-yunzi-char value)))
722 (error (format "%s" value)))
723 (format "%s" value)))
725 (defun est-eval-value-as-creators-names (value &optional subtype)
730 '(:subtype unordered-list)
732 (mapcar (lambda (creator)
734 ((concord-object-p creator)
740 '(value (:feature ->creator/name))
742 'object (list :object creator)
745 (concord-object-get creator
752 (est-eval-value-default value)))
754 (defun est-eval-value-as-created-works (value &optional subtype)
758 '(:subtype unordered-list)
760 (mapcar (lambda (creator)
761 (if (concord-object-p creator)
763 '((value (:feature <-creator)))
765 (est-eval-value-default creator)))
767 (est-eval-value-default value)))
769 (defun est-eval-value-as-journal-volumes (value &optional subtype)
771 (list* 'journal-volumes
773 '(:subtype unordered-list)
775 (mapcar (lambda (volume)
776 (if (concord-object-p volume)
777 (est-eval-value-as-journal-volume volume 'short)
780 (est-eval-value-default value)))
783 ;;; @ format evaluator
786 ;; (defun est-make-env (object feature-name)
787 ;; (list (cons 'object object)
788 ;; (cons 'feature-name feature-name)))
790 ;; (defun est-env-push-item (env item value)
791 ;; (cons (cons item value)
794 ;; (defun est-env-get-item (env item)
795 ;; (cdr (assq item env)))
797 ;; (defun est-env-current-value (env)
798 ;; (let ((obj (est-env-get-item env 'object))
799 ;; (feature (est-env-get-item env 'feature-name)))
800 ;; (if (characterp obj)
801 ;; (char-feature obj feature)
802 ;; (concord-object-get obj feature))))
805 (defun est-eval-props-to-string (props &optional format)
807 (setq format (plist-get props :format)))
809 (plist-get props :flag)
810 (if (plist-get props :len)
812 (let ((ret (plist-get props :len)))
817 ((eq format 'decimal) "d")
818 ((eq format 'hex) "x")
819 ((eq format 'HEX) "X")
820 ((eq format 'S-exp) "S")
823 (defun est-eval-apply-value (object feature-name format props value
824 &optional uri-object)
827 :feature feature-name)
829 ((memq format '(decimal hex HEX))
833 (format (est-eval-props-to-string props format)
838 (list 'string nil (format "%s" value))
840 ((eq format 'wiki-text)
841 (est-eval-list value object feature-name nil uri-object)
843 ((eq format 'unordered-link-list)
844 (est-eval-list value object feature-name nil uri-object
845 '(:subtype unordered-list :separator " "))
848 (est-eval-value-as-S-exp value)
851 (est-eval-value-as-kuten value))
852 ((eq format 'kangxi-radical)
853 (est-eval-value-as-kangxi-radical value))
854 ((eq format 'shuowen-radical)
855 (est-eval-value-as-shuowen-radical value))
857 (est-eval-value-as-ids value))
858 ((eq format 'decomposition)
859 (est-eval-value-as-decomposition-list value))
860 ((eq format 'composition)
861 (est-eval-value-as-composition-list value))
862 ((or (eq format 'space-separated)
863 (eq format 'space-separated-char-list))
864 (est-eval-value-as-object-list value " "))
865 ((eq format 'char-list)
866 (est-eval-value-as-char-list value nil))
867 ((eq format 'location-list)
868 (est-eval-value-as-location-list value nil))
869 ((eq format 'name-list)
870 (est-eval-value-as-name-list value nil))
871 ((eq format 'image-list)
872 (est-eval-value-as-image-list value nil))
873 ((eq format 'unordered-list)
874 (est-eval-value-as-object-list value nil 'unordered-list))
875 ((eq format 'unordered-composition-list)
876 (est-eval-value-as-composition-list value nil 'unordered-list))
877 ((eq format 'space-separated-ids)
878 (est-eval-value-as-space-separated-ids value))
879 ((eq format 'space-separated-domain-list)
880 (est-eval-value-as-domain-list value))
881 ((eq format 'space-separated-creator-name-list)
882 (est-eval-value-as-creators-names value))
883 ((eq format 'unordered-creator-name-list)
884 (est-eval-value-as-creators-names value 'unordered-list))
885 ((eq format 'space-separated-created-work-list)
886 (est-eval-value-as-created-works value))
887 ((eq format 'unordered-created-work-list)
888 (est-eval-value-as-created-works value 'unordered-list))
889 ((eq format 'journal-volume-list)
890 (est-eval-value-as-journal-volumes value))
891 ((eq format 'space-separated-daijiten-page-list)
892 (est-eval-value-as-daijiten-page-list value " "))
893 ((eq format 'space-separated-Web-yunzi-char-list)
894 (est-eval-value-as-Web-yunzi-char-list value " "))
896 (est-eval-value-default value)
900 (defun est-eval-feature-value (object feature-name
901 &optional format lang uri-object value)
903 (setq value (www-get-feature-value object feature-name)))
905 (setq format (www-feature-value-format feature-name)))
906 (if (and (consp value)
907 est-eval-list-feature-items-limit
908 (not (eq feature-name 'sources)))
909 (let ((ret (condition-case nil
910 (nthcdr est-eval-list-feature-items-limit value)
915 (list :object object :feature feature-name)
919 (est-eval-apply-value object feature-name
926 (setq format (car format))
927 (est-eval-apply-value object feature-name
928 (car format) (nth 1 format) value
932 (est-eval-list format object feature-name lang uri-object)
935 (defun est-eval-unit (exp object feature-name
936 &optional lang uri-object value)
938 (setq value (www-get-feature-value object feature-name)))
940 (setq uri-object (www-uri-encode-object object)))
943 ((or (characterp exp)
944 (concord-object-p exp))
945 (est-eval-value-as-object exp)
950 ((memq (car exp) '(value decimal hex HEX ku-ten
951 kangxi-radical shuowen-radical
952 S-exp string default))
953 (let ((fn (plist-get (nth 1 exp) :feature))
954 domain domain-fn ret)
957 (setq fn (intern fn)))
958 (setq domain (char-feature-name-domain feature-name))
959 (setq domain-fn (char-feature-name-at-domain fn domain))
960 (if (setq ret (www-get-feature-value object domain-fn))
961 (setq feature-name domain-fn
963 (setq feature-name fn
964 value (www-get-feature-value object fn)))
965 (push feature-name chise-wiki-displayed-features)
967 (if (eq (car exp) 'value)
968 (est-eval-feature-value object feature-name
969 (plist-get (nth 1 exp) :format)
970 lang uri-object value)
971 (est-eval-apply-value
973 (car exp) (nth 1 exp) value
976 ((eq (car exp) 'name)
977 (let ((fn (plist-get (nth 1 exp) :feature))
980 (setq domain (char-feature-name-domain feature-name))
982 (setq fn (intern fn)))
983 (setq domain-fn (char-feature-name-at-domain fn domain))
984 (setq feature-name domain-fn)))
987 :feature feature-name)
988 (www-format-feature-name* feature-name lang))
990 ((eq (car exp) 'name-url)
991 (let ((fn (plist-get (nth 1 exp) :feature))
992 (object (plist-get (nth 1 exp) :object))
995 (setq domain (char-feature-name-domain feature-name))
997 (setq fn (intern fn)))
998 (setq domain-fn (char-feature-name-at-domain fn domain))
999 (setq feature-name domain-fn)))
1000 (list 'name-url (list :feature feature-name)
1001 (www-uri-make-feature-name-url
1002 (est-object-genre object)
1003 (www-uri-encode-feature-name feature-name)
1006 ((eq (car exp) 'domain-name)
1007 (let ((domain (char-feature-name-domain feature-name)))
1009 (format "@%s" domain)
1012 ((eq (car exp) 'omitted)
1014 (list :object object :feature feature-name)
1017 ((eq (car exp) 'prev-char)
1019 (list :object object :feature feature-name)
1020 '(input (:type "submit" :value "-")))
1022 ((eq (car exp) 'next-char)
1024 (list :object object :feature feature-name)
1025 '(input (:type "submit" :value "+")))
1027 ((eq (car exp) 'link)
1030 (est-eval-list (plist-get (nth 1 exp) :ref)
1031 object feature-name lang uri-object))
1032 (est-eval-list (nthcdr 2 exp)
1033 object feature-name lang uri-object))
1038 (defun est-eval-list (format-list object feature-name
1039 &optional lang uri-object list-props)
1040 (if (consp format-list)
1044 (est-eval-unit exp object feature-name lang uri-object nil))
1047 (list* 'list list-props ret)
1049 (est-eval-unit format-list object feature-name lang uri-object nil)))
1057 ;;; est-eval.el ends here