X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fest.git;a=blobdiff_plain;f=cwiki-view.el;h=e868df989f3a8e37424f390330fe88c06befce1e;hp=3c4e0aa752c8ceb5b76547adca05929fb61b2305;hb=29e90e4291f87c99aca8e040feced79dbf5983f6;hpb=53ddb25bf760598f4f00e9f4c71598f808eef7b8
diff --git a/cwiki-view.el b/cwiki-view.el
index 3c4e0aa..e868df9 100644
--- a/cwiki-view.el
+++ b/cwiki-view.el
@@ -44,6 +44,7 @@ size=\"64\" maxlength=\"256\" value=\"%s\">
)
(defun www-display-object-desc (genre uri-object &optional uri-feature-name
+ image-selection
lang level simple
uri-feature-name-to-edit editing-format)
(unless level
@@ -67,7 +68,8 @@ size=\"64\" maxlength=\"256\" value=\"%s\">
without-header
logical-feature chise-wiki-displayed-features
parents
- GlyphWiki-id HNG-card ret object-spec)
+ GlyphWiki-id HNG-card HNG-card-id HNG-card-cobj ret object-spec
+ width height image-cobj base-image x y w h)
(if (eq level 0)
(setq level 1
without-header nil)
@@ -102,9 +104,40 @@ ul { margin: 0 0; color: black; }
li { margin: 0 0 0 2em; }
.feature-name { font-family: sans-serif; font-weight: bold; }
.feature-name a { color: black; }
+
+.tooltip {
+ position: relative;
+ display: inline-block;
+ border-bottom: 1px dotted black;
+}
+
+.tooltip .tooltiptext {
+ visibility: hidden;
+ width: 120px;
+ top: 100%%;
+ left: 50%%;
+ margin-left: -60px;
+ background-color: black;
+ color: #fff;
+ text-align: center;
+ padding: 5px 0;
+ border-radius: 6px;
+
+ position: absolute;
+ z-index: 1;
+}
+
+.value .image-list img { height: 320px; vertical-align: top; }
+
+.list .tooltip:hover .tooltiptext {
+ visibility: visible;
+}
-->
+
+
EsT %s = %s
\n"
genre
@@ -157,43 +190,163 @@ li { margin: 0 0 0 2em; }
genre rdf-uri-object)
"")))
(when (setq parents (www-get-feature-value object '<-denotational))
+ (if (characterp parents)
+ (setq parents (list parents)))
(princ (format "%s %s
\n
\n"
(www-format-value-as-char-list parents)
(www-format-feature-name '->denotational lang))))
(when (setq parents (www-get-feature-value object '<-subsumptive))
+ (if (characterp parents)
+ (setq parents (list parents)))
(princ (format "%s %s
\n
\n"
(www-format-value-as-char-list parents)
(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)))
- (setq HNG-card
- (if (string-match "%s%s\n"
- level
- (if uri-feature-name
- (format "%s"
- ;; (if est-hide-cgi-mode
- ;; "%s"
- ;; "%s")
- (www-uri-make-object-url object uri-object)
- ret)
- (if HNG-card
- (format
- "%s"
- HNG-card ret)
- ret))
- (if GlyphWiki-id
- (format
- " "
- GlyphWiki-id
- GlyphWiki-id GlyphWiki-id)
- "")
- level))
+ (cond
+ ((eq genre 'image-resource)
+ (princ
+ (if (setq ret (concord-object-get object '=location@iiif))
+ (if (setq base-image
+ (car (concord-object-get object '<-image-segment)))
+ (format ""
+ (www-uri-encode-object base-image)
+ (concord-object-get object 'image-offset-x)
+ (concord-object-get object 'image-offset-y)
+ (concord-object-get object 'image-width)
+ (concord-object-get object 'image-height)
+ ret ret)
+ (if (and image-selection
+ (string-match "\\([0-9]+\\),\\([0-9]+\\),\\([0-9]+\\),\\([0-9]+\\)" image-selection))
+ (progn
+ (setq x (string-to-int (match-string 1 image-selection))
+ y (string-to-int (match-string 2 image-selection))
+ w (string-to-int (match-string 3 image-selection))
+ h (string-to-int (match-string 4 image-selection)))
+ (setq width (float
+ (concord-object-get object 'image-width)))
+ ;; (setq height (float
+ ;; (concord-object-get object 'image-height)))
+ (format "
+
+
+"
+ ret
+ (/ x width)
+ (/ y width)
+ (/ w width)
+ (/ h width)
+ ))
+ (format "
+
+
+"
+ ret)))
+ (setq ret (concord-object-get object '=location))
+ (format ""
+ ret ret)))
+ )
+ ((and (eq genre 'glyph-image)
+ (setq image-cobj
+ (car (concord-object-get object '->image-resource))))
+ (if (and (setq ret (concord-object-get image-cobj '=location@iiif))
+ (setq base-image
+ (car (concord-object-get image-cobj '<-image-segment))))
+ (princ
+ (format ""
+ (www-uri-encode-object base-image)
+ (concord-object-get image-cobj 'image-offset-x)
+ (concord-object-get image-cobj 'image-offset-y)
+ (concord-object-get image-cobj 'image-width)
+ (concord-object-get image-cobj 'image-height)
+ ret ret))
+ (setq ret (concord-object-get image-cobj '=location))
+ (princ (format ""
+ ret ret)))
+ )
+ ((and (eq genre 'hng-card)
+ (setq ret (concord-object-get object '=hng-card))
+ (setq ret (symbol-name ret))
+ (string-match "\\([0-9]+\\)-\\([0-9]+\\)" ret))
+ (princ
+ (format
+ ""
+ ret
+ (string-to-int (match-string 1 ret))
+ (string-to-int (match-string 2 ret))))
+ )
+ (t
+ (setq ret (www-format-encode-string
+ (est-format-object object 'readable)))
+ (when (string-match
+ "%s%s\n"
+ level
+ (cond
+ (uri-feature-name
+ (format "%s"
+ ;; (if est-hide-cgi-mode
+ ;; "%s"
+ ;; "%s")
+ (www-uri-make-object-url object uri-object)
+ ret)
+ )
+ (HNG-card
+ (format
+ "%s"
+ HNG-card ret)
+ )
+ (t ret))
+ (if GlyphWiki-id
+ (format
+ " "
+ GlyphWiki-id
+ GlyphWiki-id GlyphWiki-id)
+ "")
+ level))
+ ))
(if (> level 1)
(princ ""))
(when feature-name-to-edit
@@ -206,6 +359,18 @@ size=\"30\" maxlength=\"30\" value=\"%s\">)
genre genre
(decode-uri-string uri-object 'utf-8-mcs-er))
'utf-8-mcs-er)))
+ (when (and HNG-card-id
+ (eq genre 'character)
+ (setq HNG-card-cobj
+ (concord-decode-object
+ '=id HNG-card-id
+ 'hng-card)))
+ (put-char-attribute object 'sources@HNG/card (list HNG-card-cobj))
+ (if (setq ret (concord-object-get
+ HNG-card-cobj
+ '->glyph-image@zinbun/takuhon))
+ (put-char-attribute object 'sources@zinbun/takuhon ret))
+ )
(setq object-spec
(cond
(uri-feature-name
@@ -296,56 +461,45 @@ size=\"30\" maxlength=\"30\" value=\"%s\">)
"\n"
"
- \n"))
(when (eq genre 'character)
- (princ
- "\n")
+ encoded-object-for-form))
+ (princ
+ (www-format-encode-string
+ "ã\u542Bã\u6F22\u5B57ã\u63A2ã"))
+ (princ " \n")
+ (princ "\n")
- (princ
- "\n")
- )
+ encoded-object-for-form))
+ (princ
+ (www-format-encode-string
+ "ã\u542Bã HNG ã®\u6F22\u5B57ã\u63A2ã"))
+ (princ " \n")
+ (princ "\n")
+ ))
(princ
(if (= level 1)
"\n"
@@ -560,6 +714,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
(cond ((eq (car ret) 'char)
(www-display-object-desc
'character (cdr ret) (cdr (assq 'feature target))
+ nil
lang nil
(eq mode 'simple))
)
@@ -574,6 +729,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
(t
(www-display-object-desc
(car ret) (cdr ret) (cdr (assq 'feature target))
+ nil
lang nil
(eq mode 'simple))
))
@@ -610,7 +766,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
(car (split-string accept-language ","))
";"))
"-"))))
- ret genre feature json obj)
+ ret genre feature obj-url json obj)
(cond
((stringp target)
(when (string-match "/data\\.json$" target)
@@ -633,10 +789,18 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
ret (substring cell (match-end 0)))
(cons
(intern (decode-uri-string genre 'utf-8-mcs-er))
- (if (string-match "/feature=" ret)
- (list (substring ret 0 (match-beginning 0))
- (substring ret (match-end 0)))
- (list ret))))
+ (cond
+ ((string-match "/feature=" ret)
+ (list (substring ret 0 (match-beginning 0))
+ (substring ret (match-end 0)))
+ )
+ ((string-match "...$.zoom-xywh=" ret)
+ (list (substring ret 0 (match-beginning 0))
+ nil
+ (substring ret (match-end 0)))
+ )
+ (t
+ (list ret)))))
(list (decode-uri-string cell 'utf-8-mcs-er)))
;; (setq ret (split-string cell "/"))
;; (cons (intern
@@ -669,7 +833,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
;; (princ (encode-coding-string
;; (format "// %S\n" obj)
;; char-db-file-coding-system))
- (char-db-json-char-data-with-variant obj)
+ (char-db-json-char-data-with-variant obj 'printable)
(encode-coding-region
(point-min)(point-max)
char-db-file-coding-system)
@@ -677,6 +841,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
)
(www-display-object-desc
'character (nth 1 ret) (nth 2 ret)
+ nil
lang nil
(eq mode 'simple)))
)
@@ -688,9 +853,32 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
lang
(eq mode 'simple))
)
+ ;; ((eq (car ret) 'image-resource)
+ ;; ;; (cond
+ ;; ;; ((string-match "^\\.iiif=" (nth 1 ret))
+ ;; ;; (setq obj-url (decode-uri-string
+ ;; ;; (substring (nth 1 ret) (match-end 0))
+ ;; ;; 'utf-8-mcs-er))
+ ;; ;; (setq obj (concord-images-add-iiif obj-url))
+ ;; ;; (www-display-object-desc
+ ;; ;; 'image-resource
+ ;; ;; (www-uri-encode-object obj)
+ ;; ;; (nth 2 ret)
+ ;; ;; lang nil
+ ;; ;; (eq mode 'simple))
+ ;; ;; )
+ ;; ;; (t
+ ;; (princ (nth 1 ret))
+ ;; (www-display-object-desc
+ ;; 'image-resource (nth 1 ret) (nth 2 ret)
+ ;; lang nil
+ ;; (eq mode 'simple))
+ ;; ;; ))
+ ;; )
(t
(www-display-object-desc
(car ret) (nth 1 ret) (nth 2 ret)
+ (nth 3 ret)
lang nil
(eq mode 'simple))
))