(setq
html-helper-htmldtd-version
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd\">\n"
html-helper-use-expert-menu t
hm--html-automatic-create-modified-line t
hm--html-automatic-update-modified-line t
hm--html-changed-comment-prefix "Changed with XEmacs, by: "
hm--html-created-comment-prefix "Created with XEmacs, by: "
hm--html-expert t
hm--html-html-doctype-version
"-//W3C//DTD HTML 4.01 Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd"
hm--html-log-date-format "%y-%m-%d"
hm--html-template-dir
(file-name-as-directory
(expand-file-name "templates"
(locate-data-directory "hm--html-menus")))
hm--html-frame-template-file
(expand-file-name "frame.html.tmpl" hm--html-template-dir)
hm--html-title-date-format "%y-%m-%d"
hm--html-username "Steve Youngs"
html-sigusr1-signal-value 10)
(setq
sgml-auto-activate-dtd t
sgml-live-element-indicator t
sgml-validate-command "onsgmls -s -m %s %s")
(setq sgml-system-path
'("."
"/usr/local/share/sgml/dtd/docbook-3.0/"
"/usr/local/share/sgml/dtd/docbook-3.1/"
"/usr/local/share/sgml/dtd/docbook-4.0/"
"/usr/local/share/sgml/dtd/jade/"
"/usr/local/share/sgml/dtd/sgmltools/"
"/usr/local/share/sgml/entities/iso-entities-8879.1986/"
"/usr/local/share/sgml/stylesheets/docbook/"
"/usr/local/share/sgml/stylesheets/sgmltools/"
"/usr/local/lib/xemacs/xemacs-packages/etc/psgml-dtds/"))
(defun tidy-buffer ()
"Run Tidy HTML parser on current buffer."
(interactive)
(if (get-buffer "tidy-errs")
(kill-buffer "tidy-errs"))
(shell-command-on-region (point-min) (point-max)
"tidy -f /tmp/tidy-errs -q -i -wrap 72 -c" t)
(find-file-other-window "/tmp/tidy-errs")
(other-window 1)
(delete-file "/tmp/tidy-errs")
(message "buffer tidy'ed"))
(autoload 'html-mode "psgml-html" "Load psgml-html-mode" t)
(autoload 'css-mode "css-mode")
(add-hook 'html-mode-hook 'hm--html-minor-mode)
(add-hook 'html-mode-hook
'(lambda ()
(setq ispell-extra-args "-H")))
(add-hook 'html-helper-timestamp-hook 'html-helper-default-insert-timestamp)
(eval-and-compile
(require 'htmlize))
(defun sy-htmlize-buffer (&optional buffer)
"This is just a simple wrapper for `htmlize-buffer'.
All it does is scan the buffer to be converted for any local variable
declarations and replaces them with a place holder. This prevents an
infloop when you go to save the resulting HTML buffer.
Original `htmlize-buffer' doc string:
Convert buffer to HTML, preserving the font-lock colorization.
The generated HTML is available in a new buffer, which is returned.
When invoked interactively, the new buffer is selected in the
current window."
(interactive)
(let ((htmlbuf (with-current-buffer (or buffer (current-buffer))
(goto-char (point-min))
(while (re-search-forward
(concat "^"
comment-start
"Local"
" Variables:$") nil t)
(replace-match
(concat comment-start
" Put the normal local variables declaration here")))
(htmlize-buffer-1)
(condition-case nil
(undo)
(error nil)))))
(when (interactive-p)
(switch-to-buffer htmlbuf))
htmlbuf))
(defun sy-htmlize-css-doctype ()
nil "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd\">")
(defalias 'htmlize-buffer 'sy-htmlize-buffer)
(defalias 'htmlize-css-doctype 'sy-htmlize-css-doctype)
(defun sy-htmlize-after-hook ()
"Function run from `htmlize-after-hook'.
It takes care of any relative hyperlinks and also dequotes any HTML
comments that were incorrectly quoted.
Relative hyperlinks need to be prepared in a particular way in the
file that is to be converted to HTML. For example, in an emacs lisp
file you might see:
Get the latest rls=/src/foo.el;rld=version here;rle.
Which would be converted to:
Get the latest <a href="/src/foo.el">version here</a>."
(save-excursion
(goto-char (point-min))
(mapcar
'(lambda (x) (save-excursion (eval x)))
'((replace-string "rls=" "<a href=\"")
(replace-string ";rld=" "\">")
(replace-string ";rle" "</a>")
(replace-string "<!--" "<!--")
(replace-string "-->" "-->")))))
(defconst sy-htmlize-appendix
"<!-- Logos -->
<br />
<!-- XEmacs Logo -->
<a href=\"http://www.xemacs.org/\">
<img src=\"/images/created-xemacs.png\"
border=\"0\"
width=\"88\"
height=\"31\"
alt=\"Created with XEmacs\" /></a>
<!-- End XEmacs Logo -->
<!-- Valid HTML 4.0.1 / CSS -->
<a href=\"http://validator.w3.org/check/referer\"><img border=\"0\"
src=\"/images/valid-html401.png\"
alt=\"Valid HTML 4.01!\" height=\"31\" width=\"88\"></a>
<a href=\"http://jigsaw.w3.org/css-validator/check/referer\">
<img style=\"border:0;width:88px;height:31px\"
src=\"/images/vcss.png\"
alt=\"Valid CSS!\">
</a>
<!-- End Valid HTML / CSS-->
<h6>Copyright © 2003 Steve Youngs<br />
Verbatim copying and distribution is permitted in any medium,
providing this notice is preserved.<br />
<!-- hhmts start -->
<!-- hhmts end -->
</h6>
")
(defun sy-htmlize-append ()
"Append some things to the end of files produced by `htmlize.el'."
(goto-char (point-max))
(re-search-backward "</body>" nil t)
(insert sy-htmlize-appendix))
(defun sy-htmlize-set-footer-image-locations ()
"Set the \"<img src=\" tags for the images at the bottom of the page."
(let ((location (read-string "Location (bigpond,eicq,local-p,local-s): "))
(bigpond-replace "/sryoungs/images/")
(eicq-replace "./images/")
(local-p-replace "/~steve/images/")
(local-s-replace "/images/")
(replace-this "/images/")
replacement)
(cond
((string= location "bigpond")
(setq replacement bigpond-replace))
((string= location "eicq")
(setq replacement eicq-replace))
((string= location "local-p")
(setq replacement local-p-replace))
((string= location "local-s")
(setq replacement local-s-replace)))
(save-excursion
(goto-char (point-min))
(re-search-forward "<!-- Logos -->" nil t)
(save-restriction
(narrow-to-region (point) (point-max))
(goto-char (point-min))
(while (re-search-forward replace-this nil t)
(replace-match replacement nil nil))))))
(setq
htmlize-html-charset "iso-8859-1"
htmlize-html-major-mode 'html-mode
htmlize-head-tags
"<meta http-equiv=\"author\" content=\"Steve Youngs\">
<meta http-equiv=\"generator\" content=\"Slackware GNU/Linux + XEmacs + htmlize.el\">
")
(add-hook 'htmlize-before-hook 'font-lock-fontify-buffer)
(add-hook 'htmlize-after-hook
'(lambda ()
(sy-htmlize-after-hook)
(sy-htmlize-append)
(sy-htmlize-set-footer-image-locations)
(font-lock-fontify-buffer)))
(message "hm--html-mode initialised")
Copyright © 2003 Steve Youngs
Verbatim copying and distribution is permitted in any medium,
providing this notice is preserved.
Last modified: Thu Oct 30 10:11:31 EST 2003