(setq
html-helper-htmldtd-version
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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 SXEmacs, by: "
hm--html-created-comment-prefix "Created with SXEmacs, by: "
hm--html-expert t
hm--html-html-doctype-version
"\"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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")
(defvar sy-sgml-dirs
(directory-files-recur "/usr/share/sgml" 'full nil nil 'subdir)
"List of directories for `sgml-system-path'.")
(setq sgml-system-path
(append '("."
"/usr/share/sxemacs/xemacs-packages/etc/psgml-dtds/")
sy-sgml-dirs))
(autoload 'html-mode "psgml-html" "Load psgml-html-mode" t)
(autoload 'css-mode "css-mode")
(add-hook 'html-mode-hook #'hm--html-minor-mode)
(eval-when-compile (defvar ispell-extra-args))
(add-hook 'html-mode-hook
#'(lambda ()
(make-local-variable 'ispell-extra-args)
(push "-H" ispell-extra-args)))
(add-hook 'html-helper-timestamp-hook #'html-helper-default-insert-timestamp)
(eval-and-compile
(require 'htmlize))
(defun htmlize-default-doctype ()
nil
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
(defadvice htmlize-buffer (around nolocals (&rest args) activate)
"Turn off file local variables during htmlize-buffer."
(let ((enable-local-variables nil)
buf)
(setq buf ad-do-it)
(when (interactive-p) (switch-to-buffer buf))))
(defadvice htmlize-make-file-name (before filename activate)
"Prefer filenames \"file.ext\" -> \"file.html\"."
(setq file (file-name-sans-extension file)))
(defun sy-htmlize-set-links ()
"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>."
(unless (string-match "07-html" (buffer-name (declare-boundp htmlbuf)))
(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 "-->" "-->"))))))
(defun sy-htmlize-add-xmlns ()
"Adds a xmlns property to the html tag.
Because we are trying to output XHTML we need to add the xmlns to the
html tag. Done via `htmlize-after-hook'."
(save-excursion
(goto-char (point-min))
(re-search-forward "<html>" nil t)
(replace-match
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">")))
(defvar sy-htmlize-appendix
(concat "<!-- SXEmacs Logo -->
<div class=\"img\">
<a href=\"https://www.sxemacs.org/\" target=\"_parent\">
<img style=\"padding:0px 5px 0px 0px;border:0;width:88px;height:31px\"
src=\"/Images/cbsx.png\"
title=\"This page was created entirely in SXEmacs\"
alt=\"Created with SXEmacs\" />
</a>
<!-- End SXEmacs Logo -->
<!-- Valid XHTML 1.0 -->
<a href=\"http://validator.w3.org/check?uri=" "%s" "\" target=\"_blank\">
<img style=\"padding:0px 5px 0px 10px;border:0;width:88px;height:31px\"
src=\"/Images/valid-xhtml10.png\"
title=\"Valid XHTML 1.0 Transitional!\"
alt=\"Valid XHTML 1.0 Transitional!\" />
</a>
</div>
<!-- End Valid XHTML 1.0 -->
<h6>Copyright © "
(format-time-string "%Y") " Steve Youngs<br />
Verbatim copying and distribution is permitted in any medium,
providing this notice is preserved.<br />
<!-- hhmts start -->
<!-- hhmts end -->
</h6>
"
))
(autoload 'url-hexify-string "url-util")
(defun sy-htmlize-append ()
"Append some things to the end of files produced by `htmlize.el'."
(let ((html (url-hexify-string
(concat "https://www.sxemacs.org/SYinits/"
(buffer-name)))))
(goto-char (point-max))
(re-search-backward "</body>" nil t)
(insert (format sy-htmlize-appendix html))))
(setq
htmlize-html-charset nil
htmlize-html-major-mode 'html-mode
htmlize-head-tags
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<meta name=\"author\" content=\"Steve Youngs\" />
<meta name=\"owner\" content=\"steve@sxemacs.org\" />
")
(setq htmlize-hyperlink-style "
a {
color: #FF0000;
background-color: inherit;
font: inherit;
font-weight: bold;
text-decoration: underline;
}
a:hover {
color: #FFFFFF;
background-color: #FD00FD;
text-decoration: underline;
}
.img a:hover {
background-color: #000000;
text-decoration: none;
}
")
(defvar sy-htmlize-this-file nil
"The name of the file we htmlize'd.")
(defun sy-htmlize-before-hook ()
"Prepares the buffer for htmlising.
Turns off howm-mode as it can play havoc with the font-locking, and we
force a fontify of the buffer."
(setq sy-htmlize-this-file (buffer-file-name))
(and howm-mode (howm-mode 0))
(font-lock-fontify-buffer))
(defun sy-htmlize-after-hook ()
(sy-htmlize-set-links)
(sy-htmlize-append)
(sy-htmlize-add-xmlns)
(with-current-buffer (get-file-buffer sy-htmlize-this-file)
(normal-mode)) (setq sy-htmlize-this-file nil))
(add-hook 'htmlize-before-hook #'sy-htmlize-before-hook)
(add-hook 'htmlize-after-hook #'sy-htmlize-after-hook)
(message "HTML settings initialised")
Copyright © 2020 Steve Youngs
Verbatim copying and distribution is permitted in any medium,
providing this notice is preserved.
Last modified: Sat Apr 18 21:42:00 AEST 2020