(insert "<body>\n")
;; (insert (format "<h1>%s</h1>\n" file))
- (if (file-exists-p (expand-file-name file image-root))
- (let* ((desc-file (expand-file-name (concat file ".desc") image-root))
- (params
- (with-temp-buffer
- (when (file-exists-p desc-file)
- (insert-file-contents desc-file)
- (read (current-buffer)))))
- dir-desc-file
- image-file image-ref
- prev-file next-file
- prev-grade next-grade
- rest spec ret)
- (unless params
- (setq dir-desc-file
- (expand-file-name "dir.desc"
- (expand-file-name (file-name-directory file)
- image-root)))
- (setq params
- (with-temp-buffer
- (when (file-exists-p dir-desc-file)
- (insert-file-contents dir-desc-file)
- (read (current-buffer)))))
- (when (setq rest (assq 'files params))
- (setq rest (cdr rest)))
- (setq ret (file-name-nondirectory file))
- (while (and rest
- (not (string= (car rest) ret)))
- (setq prev-file (car rest)
- rest (cdr rest)))
- (setq next-file (car (cdr rest)))
- (if prev-file
- (setq params (list (cons 'prev-file prev-file))))
- (if next-file
- (setq params (cons (cons 'next-file next-file)
- params)))
+ (let* ((desc-file (expand-file-name (concat file ".desc") image-root))
+ (params
(with-temp-buffer
- (insert (format "%S" params))
- ;; (princ "X-XEmacs-Message: ")
- (write-region (point-min)(point-max) desc-file)
- ;; (princ "\n")
- ))
- (if (setq image-ref (assq 'ref params))
- (setq image-ref (cdr image-ref))
- (setq image-file file))
- (if (setq prev-file (assq 'prev-file params))
- (setq prev-file (cdr prev-file)))
- (if (setq next-file (assq 'next-file params))
- (setq next-file (cdr next-file)))
- (setq rest www-page-size-specs)
+ (when (file-exists-p desc-file)
+ (insert-file-contents desc-file)
+ (read (current-buffer)))))
+ dir-desc-file
+ image-file image-ref
+ prev-file next-file
+ prev-grade next-grade
+ rest spec ret)
+ (unless params
+ (setq dir-desc-file
+ (expand-file-name "dir.desc"
+ (expand-file-name (file-name-directory file)
+ image-root)))
+ (setq params
+ (with-temp-buffer
+ (when (file-exists-p dir-desc-file)
+ (insert-file-contents dir-desc-file)
+ (read (current-buffer)))))
+ (unless (assq 'refs params)
+ (when (setq rest (assq 'files params))
+ (setq rest (cdr rest)))
+ (setq ret (file-name-nondirectory file))
(while (and rest
- (setq spec (car rest))
- (not (eq (car spec) size)))
- (setq prev-grade (car spec)
+ (not (string= (car rest) ret)))
+ (setq prev-file (car rest)
rest (cdr rest)))
- (setq next-grade (car (car (cdr rest))))
- (if prev-file
- (insert (format "<a href=\"page.cgi?%s%s.html.%s&size=%s\">"
- (file-name-directory file) prev-file
- (or lang 'en)
- size)))
- (cond ((eq lang 'ja)
- (insert "[\e$BA0\e(B]")
- )
- (t
- (insert "[Previous]")
- ))
+ (setq next-file (car (cdr rest)))
(if prev-file
- (insert "</a>"))
- (insert "\n")
-
- (if next-file
- (insert (format "<a href=\"page.cgi?%s%s.html.%s&size=%s\">"
- (file-name-directory file) next-file
- (or lang 'en)
- size)))
- (cond ((eq lang 'ja)
- (insert "[\e$B<!\e(B]")
- )
- (t
- (insert "[Next]")
- ))
+ (setq params (list (cons 'prev-file prev-file))))
(if next-file
- (insert "</a>"))
- (insert "\n")
-
- (if prev-grade
- (insert (format "<a href=\"page.cgi?%s.html.%s&size=%s\">"
- file
- (or lang 'en)
- prev-grade)))
- (cond ((eq lang 'ja)
- (insert "[\e$B=L>.\e(B]")
- )
- (t
- (insert "[Smaller]")
- ))
- (if prev-grade
- (insert "</a>"))
- (insert "\n")
-
- (if next-grade
- (insert (format "<a href=\"page.cgi?%s.html.%s&size=%s\">"
- file
- (or lang 'en)
- next-grade)))
- (cond ((eq lang 'ja)
- (insert "[\e$B3HBg\e(B]")
- )
- (t
- (insert "[Larger]")
- ))
- (if next-grade
- (insert "</a>"))
- (insert "\n")
-
- (insert "
+ (setq params (cons (cons 'next-file next-file)
+ params)))
+ (if (file-directory-p (file-name-directory desc-file))
+ (with-temp-buffer
+ (insert (format "%S" params))
+ ;; (princ "X-XEmacs-Message: ")
+ (write-region (point-min)(point-max) desc-file)
+ ;; (princ "\n")
+ ))))
+ (if (setq image-ref (assq 'ref params))
+ (setq image-ref (cdr image-ref))
+ (setq image-file file))
+ (if (setq prev-file (assq 'prev-file params))
+ (setq prev-file (cdr prev-file)))
+ (if (setq next-file (assq 'next-file params))
+ (setq next-file (cdr next-file)))
+ (setq rest www-page-size-specs)
+ (while (and rest
+ (setq spec (car rest))
+ (not (eq (car spec) size)))
+ (setq prev-grade (car spec)
+ rest (cdr rest)))
+ (setq next-grade (car (car (cdr rest))))
+ (if prev-file
+ (insert (format "<a href=\"page.cgi?%s%s.html.%s&size=%s\">"
+ (file-name-directory file) prev-file
+ (or lang 'en)
+ size)))
+ (cond ((eq lang 'ja)
+ (insert "[\e$BA0\e(B]")
+ )
+ (t
+ (insert "[Previous]")
+ ))
+ (if prev-file
+ (insert "</a>"))
+ (insert "\n")
+
+ (if next-file
+ (insert (format "<a href=\"page.cgi?%s%s.html.%s&size=%s\">"
+ (file-name-directory file) next-file
+ (or lang 'en)
+ size)))
+ (cond ((eq lang 'ja)
+ (insert "[\e$B<!\e(B]")
+ )
+ (t
+ (insert "[Next]")
+ ))
+ (if next-file
+ (insert "</a>"))
+ (insert "\n")
+
+ (if prev-grade
+ (insert (format "<a href=\"page.cgi?%s.html.%s&size=%s\">"
+ file
+ (or lang 'en)
+ prev-grade)))
+ (cond ((eq lang 'ja)
+ (insert "[\e$B=L>.\e(B]")
+ )
+ (t
+ (insert "[Smaller]")
+ ))
+ (if prev-grade
+ (insert "</a>"))
+ (insert "\n")
+
+ (if next-grade
+ (insert (format "<a href=\"page.cgi?%s.html.%s&size=%s\">"
+ file
+ (or lang 'en)
+ next-grade)))
+ (cond ((eq lang 'ja)
+ (insert "[\e$B3HBg\e(B]")
+ )
+ (t
+ (insert "[Larger]")
+ ))
+ (if next-grade
+ (insert "</a>"))
+ (insert "\n")
+
+ (insert "
<hr>
")
- (if next-file
- (insert (format "<a href=\"page.cgi?%s%s.html.%s&size=%s\">"
- (file-name-directory file) next-file
- (or lang 'en)
- size)))
- (insert
- (if image-ref
- (format "<img alt=\"%s\" src=\"%s&size=%s\">"
- file image-ref size)
- (format "<img alt=\"%s\" src=\"page.cgi?%s&size=%s\">"
- file image-file size)))
- (if next-file
- (insert "</a>"))
- )
- (insert "<p>")
- (insert (format
- (cond
- ((eq lang 'ja)
- "\e$B2hA|%U%!%$%k\e(B %s \e$B$,8+IU$+$j$^$;$s!#\e(B\n")
- (t
- "Image file %s is not found.\n"))
- file))
- )
+ (if next-file
+ (insert (format "<a href=\"page.cgi?%s%s.html.%s&size=%s\">"
+ (file-name-directory file) next-file
+ (or lang 'en)
+ size)))
+ (if image-ref
+ (insert
+ (format "<img alt=\"%s\" src=\"%s&size=%s\">"
+ file image-ref size))
+ (if (file-exists-p (expand-file-name image-file image-root))
+ (insert
+ (format "<img alt=\"%s\" src=\"page.cgi?%s&size=%s\">"
+ file image-file size))
+ (insert "<p>")
+ (insert (format
+ (cond
+ ((eq lang 'ja)
+ "\e$B2hA|%U%!%$%k\e(B %s \e$B$,8+IU$+$j$^$;$s!#\e(B\n")
+ (t
+ "Image file %s is not found.\n"))
+ file))))
+
+ (if next-file
+ (insert "</a>"))
+ )
(insert "
<hr>