From: tomo Date: Tue, 3 Apr 2007 15:39:35 +0000 (+0000) Subject: (www-page-display-dir): Add new optional argument `hide-cgi'. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12644c947ac6397c80c006f0406785298c5bcd87;p=elisp%2Falbum.git (www-page-display-dir): Add new optional argument `hide-cgi'. (www-page-display-page): Likewise. (www-page-batch-get): Support new command-line option `hide-cgi'. --- diff --git a/www-page.el b/www-page.el index 6b30268..9d1f04b 100644 --- a/www-page.el +++ b/www-page.el @@ -67,7 +67,7 @@ coding-system)))) (defun www-page-display-dir (url-dir &optional size image-root - lang title parent-url) + lang title parent-url hide-cgi) (setq url-dir (file-name-as-directory url-dir)) (princ "Content-Type: text/html; charset=UTF-8 @@ -116,14 +116,20 @@ ") (dolist (image-file source-images) (setq file (file-name-nondirectory image-file)) - (insert "" (or lang 'en) (or size 'VGA))) - (insert (format "\"%s\"" - file url-dir file)) + (insert (format "\"%s\"") (insert "\n")) (setq i 1) @@ -150,8 +156,11 @@ (insert "))\n") (write-region (point-min)(point-max) file-desc))) (setq file (file-name-nondirectory ref-file)) - (insert "" i (or lang 'en) @@ -185,7 +194,7 @@ ))) (defun www-page-display-page (file &optional size image-root - lang prev-file next-file) + lang prev-file next-file hide-cgi) (if (stringp size) (setq size (intern size))) (if (stringp lang) @@ -263,11 +272,15 @@ (setq prev-grade (car spec) rest (cdr rest))) (setq next-grade (car (car (cdr rest)))) - (if prev-file - (insert (format "" - (file-name-directory file) prev-file - (or lang 'en) - size))) + (when prev-file + (insert "" + prev-file + (or lang 'en) + size)) + ) (cond ((eq lang 'ja) (insert "[前]") ) @@ -278,11 +291,15 @@ (insert "")) (insert "\n") - (if next-file - (insert (format "" - (file-name-directory file) next-file - (or lang 'en) - size))) + (when next-file + (insert "" + next-file + (or lang 'en) + size)) + ) (cond ((eq lang 'ja) (insert "[次]") ) @@ -293,11 +310,15 @@ (insert "")) (insert "\n") - (if prev-grade - (insert (format "" - file - (or lang 'en) - prev-grade))) + (when prev-grade + (insert "" + (file-name-nondirectory file) + (or lang 'en) + prev-grade)) + ) (cond ((eq lang 'ja) (insert "[縮小]") ) @@ -308,11 +329,15 @@ (insert "")) (insert "\n") - (if next-grade - (insert (format "" - file - (or lang 'en) - next-grade))) + (when next-grade + (insert "" + (file-name-nondirectory file) + (or lang 'en) + next-grade)) + ) (cond ((eq lang 'ja) (insert "[拡大]") ) @@ -326,40 +351,56 @@ (insert "
") + (when next-file + (insert "
" + next-file + (or lang 'en) + size)) + ) + (cond + (image-ref + (insert + (format "\"%s\"" + file image-ref size)) + ) + (t ; (file-exists-p (expand-file-name image-file image-root)) + (insert (format "\"%s\"" + (file-name-nondirectory image-file) size)) + ) + (t + (insert "

") + (insert (format + (cond + ((eq lang 'ja) + "画像ファイル %s が見付かりません。\n") + (t + "Image file %s is not found.\n")) + file)))) + (if next-file - (insert (format "" - (file-name-directory file) next-file - (or lang 'en) - size))) - (if image-ref - (insert - (format "\"%s\"" - file image-ref size)) - (if (file-exists-p (expand-file-name image-file image-root)) - (insert - (format "\"%s\"" - file image-file size)) - (insert "

") - (insert (format - (cond - ((eq lang 'ja) - "画像ファイル %s が見付かりません。\n") - (t - "Image file %s is not found.\n")) - file)))) - - (if next-file - (insert "")) - ) + (insert "")) + ) (insert "


") - (insert - (format "[index]" - (file-name-directory file) - (or lang 'en) - size)) + ;; (insert + ;; (format "[index]" + ;; (file-name-directory file) + ;; (or lang 'en) + ;; size)) + (insert "[index]" + (or lang 'en) + size)) (insert " @@ -421,7 +462,7 @@ ;; '(iso-7 iso-8-2 utf-8 big5 shift-jis ;; iso-8-designate iso-8-1 iso-lock-shift no-conversion)) ;; (set-coding-category-system 'utf-8 'utf-8-jp) - (let (target params method size key image-root lang ret) + (let (target params method size key image-root lang ret hide-cgi) (let ((rest (car command-line-args-left)) arg val) (if rest @@ -460,16 +501,20 @@ (if (setq ret (cdr (assoc "lang" params))) (setq lang (car ret))) (setq command-line-args-left (cdr command-line-args-left)) + (setq hide-cgi (string= (car command-line-args-left) "hide-cgi")) + (setq command-line-args-left (cdr command-line-args-left)) (setq image-root (or (car command-line-args-left) (expand-file-name www-page-default-base-directory default-directory))) (setq command-line-args-left (cdr command-line-args-left)) (cond ((eq method 'dir) - (www-page-display-dir target size image-root lang) + (www-page-display-dir target size image-root lang + nil nil hide-cgi) ) ((eq method 'page) - (www-page-display-page target size image-root lang) + (www-page-display-page target size image-root lang + nil nil hide-cgi) ) (t (www-page-display-image target size image-root)