From: MORIOKA Tomohiko Date: Thu, 19 Jun 2014 23:54:16 +0000 (+0900) Subject: (www-display-object-desc): Support `est-hide-cgi-mode'. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1822caa0d9b493b819635bf48b9066287467a10;p=chise%2Fest.git (www-display-object-desc): Support `est-hide-cgi-mode'. (www-display-feature-desc): Likewise. (www-batch-view-smart): New function. --- diff --git a/cwiki-view.el b/cwiki-view.el index 9fc844f..ead1465 100644 --- a/cwiki-view.el +++ b/cwiki-view.el @@ -49,6 +49,18 @@ size=\"64\" maxlength=\"256\" value=\"%s\"> (setq level 0)) (let ((object (www-uri-decode-object genre uri-object)) (est-eval-list-feature-items-limit est-eval-list-feature-items-limit) + (est-view-url-prefix (if uri-feature-name + "../.." + "..")) + (rdf-uri-object (if est-hide-cgi-mode + (if (string-match "=" uri-object) + (concat + (est-uri-decode-feature-name-body + (substring uri-object 0 (match-beginning 0))) + ":" + (est-uri-decode-feature-name-body + (substring uri-object (match-end 0)))) + uri-object))) feature-name-to-display feature-name-to-edit base-name-to-edit metadata-name-to-edit without-header @@ -90,30 +102,39 @@ size=\"64\" maxlength=\"256\" value=\"%s\"> (mount-char-attribute-table (char-feature-name-at-domain feature '$rev=latest)))) (princ - (format - (if simple - "
+ (if simple + (format + (if est-hide-cgi-mode + "
+ + +\n" + "
- - - - - -
-
\n" +\n") + genre rdf-uri-object) + (format "
- + - - +\n" + genre + (if (string-match ":" uri-object) + (concat + (est-uri-encode-feature-name-body + (substring uri-object 0 (match-beginning 0))) + "=" + (est-uri-encode-feature-name-body + (substring uri-object (match-end 0)))))))) + (princ + (format "
-
\n") - genre uri-object - genre uri-object)) +
\n" + genre rdf-uri-object)) (when (setq parents (www-get-feature-value object '<-denotational)) (princ (format "

%s %s

\n
\n" (www-format-value-as-char-list parents) @@ -129,7 +150,10 @@ size=\"64\" maxlength=\"256\" value=\"%s\"> (princ (format "%s%s\n" level (if uri-feature-name - (format "%s" + (format "%s" + ;; (if est-hide-cgi-mode + ;; "%s" + ;; "%s") (www-uri-make-object-url object uri-object) ret) ret) @@ -274,7 +298,16 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />" (defun www-display-feature-desc (uri-feature-name genre uri-object &optional lang simple) - (let ((feature-name (www-uri-decode-feature-name uri-feature-name)) + (let ((rdf-uri-object (if est-hide-cgi-mode + (if (string-match "=" uri-object) + (concat + (est-uri-decode-feature-name-body + (substring uri-object 0 (match-beginning 0))) + ":" + (est-uri-decode-feature-name-body + (substring uri-object (match-end 0)))) + uri-object))) + (feature-name (www-uri-decode-feature-name uri-feature-name)) (name@lang (intern (format "name@%s" lang)))) (princ (encode-coding-string @@ -285,22 +318,32 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />" 'utf-8-mcs-er)) (princ "\n") (princ - (format - (if simple - "
- + (if simple + (format + (if est-hide-cgi-mode + "
+

\n" - "
- - + "
\n") - uri-feature-name genre uri-object)) + uri-feature-name genre rdf-uri-object) + (format + "
+ + + +
+
\n" + uri-feature-name genre uri-object))) (princ (format "

%s

\n" (www-format-encode-string @@ -493,4 +536,97 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />" (princ (format "%S" err))) )) +(defun www-batch-view-smart () + (setq debug-on-error t) + (setq terminal-coding-system 'binary) + (condition-case err + (let* ((est-hide-cgi-mode t) + (target (pop command-line-args-left)) + (user (pop command-line-args-left)) + (accept-language (pop command-line-args-left)) + (mode (intern (pop command-line-args-left))) + (lang + (intern + (car (split-string + (car (split-string + (car (split-string accept-language ",")) + ";")) + "-")))) + ret genre feature) + (princ "Content-Type: text/html; charset=UTF-8 + + + +") + (cond + ((stringp target) + (when (string-match "^char/\\(&[^&;]+;\\)" target) + (setq ret (match-end 0)) + (setq target + (concat "char/" + (www-uri-encode-object + (www-uri-decode-object + 'character (match-string 1 target))) + (substring target ret)))) + (setq target + (mapcar + (lambda (cell) + (if (string-match "/" cell) + (progn + (setq genre (substring cell 0 (match-beginning 0)) + 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)))) + (list (decode-uri-string cell 'utf-8-mcs-er))) + ;; (setq ret (split-string cell "/")) + ;; (cons (intern + ;; (decode-uri-string (car ret) 'utf-8-mcs-er)) + ;; (cdr ret)) + ) + (split-string target "&"))) + (setq ret (car target)) + ;; (princ (format "

%S, %S, %S

" + ;; (car ret)(nth 1 ret)(nth 2 ret))) + (cond ((eq (car ret) 'char) + (www-display-object-desc + 'character (nth 1 ret) (nth 2 ret) + lang nil + (eq mode 'simple)) + ) + ((eq (car ret) 'feature) + (www-display-feature-desc + (decode-uri-string (nth 1 ret) 'utf-8-mcs-er) + (car (nth 1 target)) + (nth 1 (nth 1 target)) + lang + (eq mode 'simple)) + ) + (t + (www-display-object-desc + (car ret) (nth 1 ret) (nth 2 ret) + lang nil + (eq mode 'simple)) + )) + )) + (princ "\n
\n") + (princ (format "mode=%S\n" mode)) + (princ (format "user=%s\n" user)) + ;; (princ (format "local user=%s\n" (user-login-name))) + (princ (format "lang=%S\n" lang)) + (princ (encode-coding-string (emacs-version) 'utf-8-jp-er)) + ;; (princ " CHISE ") + ;; (princ xemacs-chise-version) + (princ " + +") + ) + (error nil + (princ (format "%S" err))) + )) + (provide 'cwiki-view)