Paste number 14288: html-helper-timestamp-hook example

Index of paste annotations: 3 | 2 | 1

Paste number 14288: html-helper-timestamp-hook example
Pasted by: anaran
When:6 years, 2 months ago
Share:Tweet this! | http://paste.lisp.org/+B0W
Channel:#xemacs
Paste contents:
Raw Source | XML | Display As
(setq html-helper-timestamp-hook
      (lambda ()
	 ;; The trailing four spaces cause html-helper-timestamp-end
	 ;; to be indented correctly (kludge).
	 (let ((time (current-time-string))
	       (zone (nth 1 (current-time-zone))))
	   (insert "    <meta http-equiv=\"Last-modified\" content=\""
		   time " " zone "\"/>\n")
	   (insert "    <meta http-equiv=\"Expires\" content=\""
		   time " " zone "\"/>\n    "))))

Annotations for this paste:

Annotation number 3: corrected hook
Pasted by: fledermaus
When:6 years, 2 months ago
Share:Tweet this! | http://paste.lisp.org/+B0W/3
Paste contents:
Raw Source | Display As
;; format-time-string is a function, not a variable
;; don't add hooks with setq, use add-hook
;; don't add lambdas to hooks as a general rule, it can get messy later.

(defun html-helper-deutsche-timestamp ()
  (insert (format-time-string "    Letzte &Auml;nderung:  %d. %m. %Y")))

(add-hook 'html-helper-timestamp-hook 
	  'html-helper-deutsche-timestamp)

Annotation number 2: yet another try
Pasted by: micha--
When:6 years, 2 months ago
Share:Tweet this! | http://paste.lisp.org/+B0W/2
Paste contents:
Raw Source | Display As
(setq format-time-string "%C") 
(setq html-helper-timestamp-hook
      (lambda ()
         ;; The trailing four spaces cause html-helper-timestamp-end
         ;; to be indented correctly (kludge).
	(let (time (current-time-string))
           (insert "    Letzte &Auml;nderung: "
                   time".")
                   )))

Annotation number 1: My try
Pasted by: micha--
When:6 years, 2 months ago
Share:Tweet this! | http://paste.lisp.org/+B0W/1
Paste contents:
Raw Source | Display As
(setq html-helper-timestamp-hook
      (lambda ()
         ;; The trailing four spaces cause html-helper-timestamp-end
         ;; to be indented correctly (kludge).
         (let ((format-time-string "%d. %m. %Y")
	       (time (current-time-string)))
           (insert "    Letzte &Auml;nderung: "
                   time".")
                   )))

Colorize as:
Show Line Numbers
Index of paste annotations: 3 | 2 | 1

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.