(www-display-object-desc): Add new argument `uri-feature-name'; if it
authorMORIOKA Tomohiko <tomo.git@chise.org>
Wed, 18 Jun 2014 12:56:49 +0000 (21:56 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Wed, 18 Jun 2014 12:56:49 +0000 (21:56 +0900)
is specified, display only the specified feature with all items of the
value.
(www-batch-view): Modify for `www-display-object-desc'.

cwiki-view.el

index 75d32ec..9fc844f 100644 (file)
@@ -42,12 +42,14 @@ size=\"64\" maxlength=\"256\" value=\"%s\">
                      "")))
   )
 
-(defun www-display-object-desc (genre uri-object &optional lang level simple
+(defun www-display-object-desc (genre uri-object &optional uri-feature-name
+                                     lang level simple
                                      uri-feature-name-to-edit editing-format)
   (unless level
     (setq level 0))
   (let ((object (www-uri-decode-object genre uri-object))
-       feature-name-to-edit
+       (est-eval-list-feature-items-limit est-eval-list-feature-items-limit)
+       feature-name-to-display feature-name-to-edit
        base-name-to-edit metadata-name-to-edit
        without-header
        logical-feature chise-wiki-displayed-features
@@ -122,10 +124,15 @@ size=\"64\" maxlength=\"256\" value=\"%s\">
                       (www-format-feature-name '->subsumptive lang))))
       (when (eq genre 'character)
        (setq GlyphWiki-id (char-GlyphWiki-id object)))
+      (setq ret (www-format-encode-string
+                (est-format-object object 'readable)))
       (princ (format "<h%d>%s%s</h%d>\n"
                     level
-                    (www-format-encode-string
-                     (est-format-object object 'readable))
+                    (if uri-feature-name
+                        (format "<a href=\"%s\">%s</a>"
+                                (www-uri-make-object-url object uri-object)
+                                ret)
+                      ret)
                     (if GlyphWiki-id
                         (format
                          " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
@@ -146,9 +153,20 @@ size=\"30\" maxlength=\"30\" value=\"%s\">)</p>
                  (decode-uri-string uri-object 'utf-8-mcs-er))
          'utf-8-mcs-er)))
       (setq object-spec
-           (if (eq genre 'character)
-               (char-attribute-alist object)
-             (concord-object-spec object)))
+           (cond
+            (uri-feature-name
+             (setq feature-name-to-display
+                   (www-uri-decode-feature-name uri-feature-name))
+             (setq est-eval-list-feature-items-limit nil)
+             (list
+              (cons feature-name-to-display
+                    (if (eq genre 'character)
+                        (get-char-attribute object feature-name-to-display)
+                      (concord-object-get object feature-name-to-display)))))
+            (t
+             (if (eq genre 'character)
+                 (char-attribute-alist object)
+               (concord-object-spec object)))))
       (when feature-name-to-edit
        (unless (assq base-name-to-edit object-spec)
          (setq object-spec (cons (cons base-name-to-edit nil)
@@ -440,8 +458,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
          (setq ret (car target))
          (cond ((eq (car ret) 'char)
                 (www-display-object-desc
-                 'character
-                  (cdr ret)
+                 'character (cdr ret) (cdr (assq 'feature target))
                  lang nil
                  (eq mode 'simple))
                 )
@@ -455,8 +472,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
                 )
                (t
                 (www-display-object-desc
-                 (car ret)
-                  (cdr ret)
+                 (car ret) (cdr ret) (cdr (assq 'feature target))
                  lang nil
                  (eq mode 'simple))
                 ))