"))
"*Value of `sgml-tag-help' for HTML mode.")
;;;###autoload
(defun html-mode ()
"Major mode based on SGML mode for editing HTML documents.
This allows inserting skeleton costructs used in hypertext documents with
completion. See below for an introduction to HTML. Use
\\[browse-url-of-buffer] to see how this comes out. See also `sgml-mode' on
which this is based.
Do \\[describe-variable] html- SPC and \\[describe-variable] sgml- SPC to see available variables.
To write fairly well formatted pages you only need to know few things. Most
browsers have a function to read the source code of the page being seen, so
you can imitate various tricks. Here's a very short HTML primer which you
can also view with a browser to see what happens:
A Title Describing Contents should be on every page. Pages can
have Very Major Headlines
through Very Minor Headlines
Parts can be separated with horizontal rules.
Paragraphs only need an opening tag. Line breaks and multiple spaces are
ignored unless the text is
preformatted.
Text can be marked as
bold, italic or underlined using the normal M-g or
Edit/Text Properties/Face commands.
Pages can have named points and can link other points
to them with see also somename. In the same way see also URL where URL is a filename relative to current
directory or something like http://www.cs.indiana.edu/elisp/w3/docs.html.
Images in many formats can be inlined with .
If you mainly create your own documents, `sgml-specials' might be interesting.
But note that some HTML 2 browsers can't handle '. To work around that
do:
\(eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil))
\\{html-mode-map}"
(interactive)
(sgml-mode-common html-tag-face-alist html-display-text)
(use-local-map html-mode-map)
(make-local-variable 'sgml-tag-alist)
(make-local-variable 'sgml-face-tag-alist)
(make-local-variable 'sgml-tag-help)
(make-local-variable 'outline-regexp)
(make-local-variable 'outline-heading-end-regexp)
(make-local-variable 'outline-level)
(make-local-variable 'sentence-end)
(setq sentence-end
"[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*")
(setq mode-name "HTML"
major-mode 'html-mode
sgml-tag-alist html-tag-alist
sgml-face-tag-alist html-face-tag-alist
sgml-tag-help html-tag-help
outline-regexp "^.*<[Hh][1-6]\\>"
outline-heading-end-regexp "[Hh][1-6]>"
outline-level (lambda ()
(char-after (1- (match-end 0)))))
(run-hooks 'html-mode-hook))
(define-skeleton html-href-anchor
"HTML anchor tag with href attribute."
nil
"")
(define-skeleton html-name-anchor
"HTML anchor tag with name attribute."
nil
"")
(define-skeleton html-headline-1
"HTML level 1 headline tags."
nil
"" _ "
")
(define-skeleton html-headline-2
"HTML level 2 headline tags."
nil
"" _ "
")
(define-skeleton html-headline-3
"HTML level 3 headline tags."
nil
"" _ "
")
(define-skeleton html-headline-4
"HTML level 4 headline tags."
nil
"" _ "
")
(define-skeleton html-headline-5
"HTML level 5 headline tags."
nil
"" _ "
")
(define-skeleton html-headline-6
"HTML level 6 headline tags."
nil
"" _ "
")
(define-skeleton html-horizontal-rule
"HTML horizontal rule tag."
nil
"
" \n)
(define-skeleton html-image
"HTML image tag."
nil
"")
(define-skeleton html-line
"HTML line break tag."
nil
"
" \n)
(define-skeleton html-ordered-list
"HTML ordered list tags."
nil
?< "ol>" \n
"" _ \n
"")
(define-skeleton html-unordered-list
"HTML unordered list tags."
nil
?< "ul>" \n
"" _ \n
"")
(define-skeleton html-list-item
"HTML list item tag."
nil
(if (bolp) nil '\n)
"")
(define-skeleton html-paragraph
"HTML paragraph tag."
nil
(if (bolp) nil ?\n)
\n "")
(define-skeleton html-checkboxes
"Group of connected checkbox inputs."
nil
'(setq v1 (eval str)) ; allow passing name as argument
("Value & Text: "
" str
(or v2 (setq v2 (if (y-or-n-p "Newline? ") "
" ""))) \n))
(define-skeleton html-radio-buttons
"Group of connected radio button inputs."
nil
'(setq v1 (eval str)) ; allow passing name as argument
("Value & Text: "
" str
(or v2 (setq v2 (if (y-or-n-p "Newline? ") "
" ""))) \n))
(defun html-autoview-mode (&optional arg)
"Toggle automatic viewing via `html-viewer' upon saving buffer.
With positive prefix ARG always turns viewing on, with negative ARG always off.
Can be used as a value for `html-mode-hook'."
(interactive "P")
(if (setq arg (if arg
(< (prefix-numeric-value arg) 0)
(and (boundp 'after-save-hook)
(memq 'browse-url-of-buffer after-save-hook))))
(setq after-save-hook (delq 'browse-url-of-buffer after-save-hook))
(make-local-hook 'after-save-hook)
(add-hook 'after-save-hook 'browse-url-of-buffer nil t))
(message "Autoviewing turned %s."
(if arg "off" "on")))
;;; sgml-mode.el ends here