1 ;;; muse-html.el --- publish to HTML and XHTML
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
4 ;; Free Software Foundation, Inc.
6 ;; This file is part of Emacs Muse. It is not part of GNU Emacs.
8 ;; Emacs Muse is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 3, or (at your
11 ;; option) any later version.
13 ;; Emacs Muse is distributed in the hope that it will be useful, but
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ;; General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with Emacs Muse; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, USA.
27 ;; Zhiqiang Ye (yezq AT mail DOT cbi DOT pku DOT edu DOT cn) suggested
28 ;; appending an 'encoding="..."' fragment to the first line of the
29 ;; sample publishing header so that when editing the resulting XHTML
30 ;; file, Emacs would use the proper encoding.
32 ;; Sun Jiyang (sunyijiang AT gmail DOT com) came up with the idea for
33 ;; the <src> tag and provided an implementation for emacs-wiki.
35 ;; Charles Wang (wcy123 AT gmail DOT com) provided an initial
36 ;; implementation of the <src> tag for Muse.
38 ;; Clinton Ebadi (clinton AT unknownlamer DOT org) provided further
39 ;; ideas for the implementation of the <src> tag.
43 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45 ;; Muse HTML Publishing
47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
49 (require 'muse-publish
)
50 (require 'muse-regexps
)
51 (require 'muse-xml-common
)
53 (defgroup muse-html nil
54 "Options controlling the behavior of Muse HTML publishing."
57 (defcustom muse-html-extension
".html"
58 "Default file extension for publishing HTML files."
62 (defcustom muse-xhtml-extension
".html"
63 "Default file extension for publishing XHTML files."
67 (defcustom muse-html-style-sheet
68 "<style type=\"text/css\">
70 background: white; color: black;
71 margin-left: 3%; margin-right: 7%;
75 p.verse { margin-left: 3% }
77 .example { margin-left: 3% }
83 h3 { margin-bottom: 0px; }
85 "Store your stylesheet definitions here.
86 This is used in `muse-html-header'.
87 You can put raw CSS in here or a <link> tag to an external stylesheet.
88 This text may contain <lisp> markup tags.
90 An example of using <link> is as follows.
92 <link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/default.css\">"
96 (defcustom muse-xhtml-style-sheet
97 "<style type=\"text/css\">
99 background: white; color: black;
100 margin-left: 3%; margin-right: 7%;
104 p.verse { margin-left: 3% }
106 .example { margin-left: 3% }
112 h3 { margin-bottom: 0px; }
114 "Store your stylesheet definitions here.
115 This is used in `muse-xhtml-header'.
116 You can put raw CSS in here or a <link> tag to an external stylesheet.
117 This text may contain <lisp> markup tags.
119 An example of using <link> is as follows.
121 <link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/default.css\" />"
125 (defcustom muse-html-header
126 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
130 (concat (muse-publishing-directive \"title\")
131 (let ((author (muse-publishing-directive \"author\")))
132 (if (not (string= author (user-full-name)))
133 (concat \" (by \" author \")\"))))</lisp></title>
134 <meta name=\"generator\" content=\"muse.el\">
135 <meta http-equiv=\"<lisp>muse-html-meta-http-equiv</lisp>\"
136 content=\"<lisp>muse-html-meta-content-type</lisp>\">
138 (let ((maintainer (muse-style-element :maintainer)))
140 (concat \"<link rev=\\\"made\\\" href=\\\"\" maintainer \"\\\">\")))
142 (muse-style-element :style-sheet muse-publishing-current-style)
147 (concat (muse-publishing-directive \"title\")
148 (let ((author (muse-publishing-directive \"author\")))
149 (if (not (string= author (user-full-name)))
150 (concat \" (by \" author \")\"))))</lisp></h1>
151 <!-- Page published by Emacs Muse begins here -->\n"
152 "Header used for publishing HTML files. This may be text or a filename."
156 (defcustom muse-html-footer
"
157 <!-- Page published by Emacs Muse ends here -->
160 "Footer used for publishing HTML files. This may be text or a filename."
164 (defcustom muse-xhtml-header
165 "<?xml version=\"1.0\" encoding=\"<lisp>
166 (muse-html-encoding)</lisp>\"?>
167 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
168 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
169 <html xmlns=\"http://www.w3.org/1999/xhtml\">
172 (concat (muse-publishing-directive \"title\")
173 (let ((author (muse-publishing-directive \"author\")))
174 (if (not (string= author (user-full-name)))
175 (concat \" (by \" author \")\"))))</lisp></title>
176 <meta name=\"generator\" content=\"muse.el\" />
177 <meta http-equiv=\"<lisp>muse-html-meta-http-equiv</lisp>\"
178 content=\"<lisp>muse-html-meta-content-type</lisp>\" />
180 (let ((maintainer (muse-style-element :maintainer)))
182 (concat \"<link rev=\\\"made\\\" href=\\\"\" maintainer \"\\\" />\")))
184 (muse-style-element :style-sheet muse-publishing-current-style)
189 (concat (muse-publishing-directive \"title\")
190 (let ((author (muse-publishing-directive \"author\")))
191 (if (not (string= author (user-full-name)))
192 (concat \" (by \" author \")\"))))</lisp></h1>
193 <!-- Page published by Emacs Muse begins here -->\n"
194 "Header used for publishing XHTML files. This may be text or a filename."
198 (defcustom muse-xhtml-footer
"
199 <!-- Page published by Emacs Muse ends here -->
202 "Footer used for publishing XHTML files. This may be text or a filename."
206 (defcustom muse-html-anchor-on-word nil
207 "When true, anchors surround the closest word. This allows you
208 to select them in a browser (i.e. for pasting), but has the
209 side-effect of marking up headers in multiple colors if your
210 header style is different from your link style."
214 (defcustom muse-html-table-attributes
215 " class=\"muse-table\" border=\"2\" cellpadding=\"5\""
216 "The attribute to be used with HTML <table> tags.
217 Note that Muse supports insertion of raw HTML tags, as long
218 as you wrap the region in <literal></literal>."
222 (defcustom muse-html-markup-regexps
223 `(;; Beginning of doc, end of doc, or plain paragraph separator
224 (10000 ,(concat "\\(\\(\n\\(?:[" muse-regexp-blank
"]*\n\\)*"
225 "\\([" muse-regexp-blank
"]*\n\\)\\)"
226 "\\|\\`\\s-*\\|\\s-*\\'\\)")
227 ;; this is somewhat repetitive because we only require the
228 ;; line just before the paragraph beginning to be not
230 3 muse-html-markup-paragraph
))
231 "List of markup rules for publishing a Muse page to HTML.
232 For more on the structure of this list, see `muse-publish-markup-regexps'."
233 :type
'(repeat (choice
234 (list :tag
"Markup rule"
236 (choice regexp symbol
)
238 (choice string function symbol
))
242 (defcustom muse-html-markup-functions
243 '((anchor . muse-html-markup-anchor
)
244 (table . muse-html-markup-table
)
245 (footnote . muse-html-markup-footnote
))
246 "An alist of style types to custom functions for that kind of text.
247 For more on the structure of this list, see
248 `muse-publish-markup-functions'."
249 :type
'(alist :key-type symbol
:value-type function
)
252 (defcustom muse-html-markup-strings
253 '((image-with-desc .
"<table class=\"image\" width=\"100%%\">
254 <tr><td align=\"center\"><img src=\"%1%.%2%\" alt=\"%3%\"></td></tr>
255 <tr><td align=\"center\" class=\"image-caption\">%3%</td></tr>
257 (image .
"<img src=\"%s.%s\" alt=\"\">")
258 (image-link .
"<a class=\"image-link\" href=\"%s\">
259 <img src=\"%s.%s\"></a>")
260 (anchor-ref .
"<a href=\"#%s\">%s</a>")
261 (url .
"<a href=\"%s\">%s</a>")
262 (link .
"<a href=\"%s\">%s</a>")
263 (link-and-anchor .
"<a href=\"%s#%s\">%s</a>")
264 (email-addr .
"<a href=\"mailto:%s\">%s</a>")
265 (anchor .
"<a name=\"%1%\" id=\"%1%\">")
266 (emdash .
"%s—%s")
267 (comment-begin .
"<!-- ")
268 (comment-end .
" -->")
271 (no-break-space .
" ")
272 (line-break .
"<br>")
276 (section-end .
"</h2>")
277 (subsection .
"<h3>")
278 (subsection-end .
"</h3>")
279 (subsubsection .
"<h4>")
280 (subsubsection-end .
"</h4>")
281 (section-other .
"<h5>")
282 (section-other-end .
"</h5>")
283 (begin-underline .
"<u>")
284 (end-underline .
"</u>")
285 (begin-literal .
"<code>")
286 (end-literal .
"</code>")
287 (begin-cite .
"<span class=\"citation\">")
288 (begin-cite-author .
"<span class=\"citation-author\">")
289 (begin-cite-year .
"<span class=\"citation-year\">")
290 (end-cite .
"</span>")
291 (begin-emph .
"<em>")
293 (begin-more-emph .
"<strong>")
294 (end-more-emph .
"</strong>")
295 (begin-most-emph .
"<strong><em>")
296 (end-most-emph .
"</em></strong>")
297 (begin-verse .
"<p class=\"verse\">\n")
298 (verse-space .
" ")
299 (end-verse-line .
"<br>")
300 (end-last-stanza-line .
"<br>")
301 (empty-verse-line .
"<br>")
303 (begin-example .
"<pre class=\"example\">")
304 (end-example .
"</pre>")
305 (begin-center .
"<center>\n<p>")
306 (end-center .
"</p>\n</center>")
307 (begin-quote .
"<blockquote>\n")
308 (end-quote .
"\n</blockquote>")
309 (begin-quote-item .
"<p class=\"quoted\">")
310 (end-quote-item .
"</p>")
311 (begin-uli .
"<ul>\n")
312 (end-uli .
"\n</ul>")
313 (begin-uli-item .
"<li>")
314 (end-uli-item .
"</li>")
315 (begin-oli .
"<ol>\n")
316 (end-oli .
"\n</ol>")
317 (begin-oli-item .
"<li>")
318 (end-oli-item .
"</li>")
319 (begin-dl .
"<dl>\n")
321 (begin-ddt .
"<dt><strong>")
322 (end-ddt .
"</strong></dt>")
325 (begin-table .
"<table%s>\n")
326 (end-table .
"</table>")
327 (begin-table-row .
" <tr>\n")
328 (end-table-row .
" </tr>\n")
329 (begin-table-entry .
" <%s>")
330 (end-table-entry .
"</%s>\n"))
331 "Strings used for marking up text as HTML.
332 These cover the most basic kinds of markup, the handling of which
333 differs little between the various styles."
334 :type
'(alist :key-type symbol
:value-type string
)
337 (defcustom muse-xhtml-markup-strings
338 '((image-with-desc .
"<table class=\"image\" width=\"100%%\">
339 <tr><td align=\"center\"><img src=\"%1%.%2%\" alt=\"%3%\" /></td></tr>
340 <tr><td align=\"center\" class=\"image-caption\">%3%</td></tr>
342 (image .
"<img src=\"%s.%s\" alt=\"\" />")
343 (image-link .
"<a class=\"image-link\" href=\"%s\">
344 <img src=\"%s.%s\" alt=\"\" /></a>")
346 (fn-sep .
"<hr />\n")
347 (line-break .
"<br />")
348 (begin-underline .
"<span style=\"text-decoration: underline;\">")
349 (end-underline .
"</span>")
350 (begin-center .
"<p style=\"text-align: center;\">\n")
351 (end-center .
"\n</p>")
352 (end-verse-line .
"<br />")
353 (end-last-stanza-line .
"<br />")
354 (empty-verse-line .
"<br />"))
355 "Strings used for marking up text as XHTML.
356 These cover the most basic kinds of markup, the handling of which
357 differs little between the various styles.
359 If a markup rule is not found here, `muse-html-markup-strings' is
361 :type
'(alist :key-type symbol
:value-type string
)
364 (defcustom muse-xhtml1.1-markup-strings
365 '((anchor .
"<a id=\"%s\">"))
366 "Strings used for marking up text as XHTML 1.1.
367 These cover the most basic kinds of markup, the handling of which
368 differs little between the various styles.
370 If a markup rule is not found here, `muse-xhtml-markup-strings'
371 and `muse-html-markup-strings' are searched."
372 :type
'(alist :key-type symbol
:value-type string
)
375 (defcustom muse-html-markup-tags
376 '(("class" t t t muse-html-class-tag
)
377 ("div" t t t muse-html-div-tag
)
378 ("src" t t nil muse-html-src-tag
))
379 "A list of tag specifications, for specially marking up HTML."
380 :type
'(repeat (list (string :tag
"Markup tag")
381 (boolean :tag
"Expect closing tag" :value t
)
382 (boolean :tag
"Parse attributes" :value nil
)
383 (boolean :tag
"Nestable" :value nil
)
387 (defcustom muse-html-meta-http-equiv
"Content-Type"
388 "The http-equiv attribute used for the HTML <meta> tag."
392 (defcustom muse-html-meta-content-type
"text/html"
393 "The content type used for the HTML <meta> tag.
394 If you are striving for XHTML 1.1 compliance, you may want to
395 change this to \"application/xhtml+xml\"."
399 (defcustom muse-html-meta-content-encoding
(if (featurep 'mule
)
402 "The charset to append to the HTML <meta> tag.
403 If set to the symbol 'detect, use `muse-html-encoding-map' to try
404 and determine the HTML charset from emacs's coding. If set to a
405 string, this string will be used to force a particular charset"
406 :type
'(choice string symbol
)
409 (defcustom muse-html-encoding-default
'iso-8859-1
410 "The default Emacs buffer encoding to use in published files.
411 This will be used if no special characters are found."
415 (defcustom muse-html-charset-default
"iso-8859-1"
416 "The default HTML meta charset to use if no translation is found in
417 `muse-html-encoding-map'."
421 (defcustom muse-html-src-allowed-modes t
422 "Modes that we allow the <src> tag to colorize.
423 If t, permit the <src> tag to colorize any mode.
425 If a list of mode names, such as '(\"html\" \"latex\"), and the
426 lang argument to <src> is not in the list, then use fundamental
428 :type
'(choice (const :tag
"Any" t
)
429 (repeat (string :tag
"Mode")))
432 (defun muse-html-insert-anchor (anchor)
433 "Insert an anchor, either around the word at point, or within a tag."
434 (skip-chars-forward (concat muse-regexp-blank
"\n"))
435 (if (looking-at (concat "<\\([^" muse-regexp-blank
"/>\n]+\\)>"))
436 (let ((tag (match-string 1)))
437 (goto-char (match-end 0))
438 (muse-insert-markup (muse-markup-text 'anchor anchor
))
439 (when muse-html-anchor-on-word
440 (or (and (search-forward (format "</%s>" tag
)
441 (muse-line-end-position) t
)
442 (goto-char (match-beginning 0)))
444 (muse-insert-markup "</a>"))
445 (muse-insert-markup (muse-markup-text 'anchor anchor
))
446 (when muse-html-anchor-on-word
448 (muse-insert-markup "</a>\n")))
450 (defun muse-html-markup-anchor ()
451 (unless (get-text-property (match-end 1) 'muse-link
)
453 (muse-html-insert-anchor (match-string 2)))
456 (defun muse-html-markup-paragraph ()
457 (let ((end (copy-marker (match-end 0) t
)))
458 (goto-char (match-beginning 0))
459 (when (save-excursion
461 (and (not (get-text-property (max (point-min) (1- (point)))
463 (re-search-backward "<\\(/?\\)p[ >]" nil t
)
464 (not (string-equal (match-string 1) "/")))))
465 (when (get-text-property (1- (point)) 'muse-end-list
)
466 (goto-char (previous-single-property-change (1- (point))
468 (muse-insert-markup "</p>"))
474 ((get-text-property (point) 'muse-no-paragraph
)
477 ((eq (char-after) ?\
<)
479 ((looking-at "<\\(em\\|strong\\|code\\|span\\)[ >]")
480 (muse-insert-markup "<p>"))
482 (if (looking-at "<a[^>\n]+><img")
483 (muse-insert-markup "<p class=\"image-link\">")
484 (muse-insert-markup "<p>")))
485 ((looking-at "<img[ >]")
486 (muse-insert-markup "<p class=\"image\">"))
490 ((muse-looking-back "\\(</h[1-4]>\\|<hr>\\)\n\n")
491 (muse-insert-markup "<p class=\"first\">"))
493 (muse-insert-markup "<p>"))))
495 (defun muse-html-markup-footnote ()
497 ((get-text-property (match-beginning 0) 'muse-link
)
499 ((= (muse-line-beginning-position) (match-beginning 0))
501 (let ((text (match-string 1)))
503 (concat "<p class=\"footnote\">"
504 "<a class=\"footnum\" name=\"fn." text
505 "\" href=\"#fnr." text
"\">"
509 (let* ((beg (goto-char (match-end 0)))
510 (end (and (search-forward "\n\n" nil t
)
512 (copy-marker (match-beginning 0))
514 (while (re-search-forward (concat "^["
518 (replace-match "\\1" t
)))))
520 (t (let ((text (match-string 1)))
522 (concat "<sup><a class=\"footref\" name=\"fnr." text
523 "\" href=\"#fn." text
"\">"
525 (replace-match ""))))
527 (defun muse-html-markup-table ()
528 (muse-xml-markup-table muse-html-table-attributes
))
530 ;; Handling of tags for HTML
532 (defun muse-html-strip-links (string)
533 "Remove all HTML links from STRING."
534 (muse-replace-regexp-in-string "\\(<a .*?>\\|</a>\\)" "" string nil t
))
536 (defun muse-html-insert-contents (depth)
537 "Scan the current document and generate a table of contents at point.
538 DEPTH indicates how many levels of headings to include. The default is 2."
539 (let ((max-depth (or depth
2))
543 (goto-char (point-min))
544 (search-forward "Page published by Emacs Muse begins here" nil t
)
546 (while (re-search-forward "<h\\([0-9]+\\)>\\(.+?\\)</h\\1>$" nil t
)
547 (unless (and (get-text-property (point) 'read-only
)
548 (not (get-text-property (match-beginning 0)
550 (remove-text-properties (match-beginning 0) (match-end 0)
551 '(muse-contents nil
))
552 (setq l
(1- (string-to-number (match-string 1))))
557 (when (<= l max-depth
)
558 ;; escape specials now before copying the text, so that we
559 ;; can deal sanely with both emphasis in titles and
560 ;; special characters
561 (goto-char (match-end 2))
562 (setq end
(point-marker))
563 (muse-publish-escape-specials (match-beginning 2) end
565 (muse-publish-mark-read-only (match-beginning 2) end
)
566 (setq contents
(cons (cons l
(buffer-substring-no-properties
567 (match-beginning 2) end
))
570 (goto-char (match-beginning 2))
571 (muse-html-insert-anchor (concat "sec" (int-to-string index
)))
572 (setq index
(1+ index
)))))))
573 (setq index
1 contents
(nreverse contents
))
574 (let ((depth 1) (sub-open 0) (p (point)))
575 (muse-insert-markup "<div class=\"contents\">\n<dl>\n")
577 (muse-insert-markup "<dt>\n"
578 "<a href=\"#sec" (int-to-string index
) "\">"
579 (muse-html-strip-links (cdar contents
))
582 (setq index
(1+ index
)
583 depth
(caar contents
)
584 contents
(cdr contents
))
587 ((< (caar contents
) depth
)
588 (let ((idx (caar contents
)))
590 (muse-insert-markup "</dl>\n</dd>\n")
591 (setq sub-open
(1- sub-open
)
593 ((> (caar contents
) depth
) ; can't jump more than one ahead
594 (muse-insert-markup "<dd>\n<dl>\n")
595 (setq sub-open
(1+ sub-open
))))))
596 (while (> sub-open
0)
597 (muse-insert-markup "</dl>\n</dd>\n")
598 (setq sub-open
(1- sub-open
)))
599 (muse-insert-markup "</dl>\n</div>\n")
600 (muse-publish-mark-read-only p
(point)))))
602 (defun muse-html-denote-headings ()
603 "Place a text property on any headings in the current buffer.
604 This allows the headings to be picked up later on if publishing a
607 (goto-char (point-min))
608 (search-forward "Page published by Emacs Muse begins here" nil t
)
609 (while (re-search-forward "<h\\([0-9]+\\)>\\(.+?\\)</h\\1>$" nil t
)
610 (unless (get-text-property (point) 'read-only
)
611 (add-text-properties (match-beginning 0) (match-end 0)
612 '(muse-contents t
))))))
614 (defun muse-html-class-tag (beg end attrs
)
615 (let ((name (cdr (assoc "name" attrs
))))
618 (muse-insert-markup "<span class=\"" name
"\">")
621 (muse-insert-markup "</span>")))))
623 (defun muse-html-div-tag (beg end attrs
)
624 "Publish a <div> tag for HTML."
625 (let ((id (cdr (assoc "id" attrs
)))
626 (style (cdr (assoc "style" attrs
))))
630 (muse-insert-markup "<div style=\"" style
"\">")
631 (muse-insert-markup "<div id=\"" id
"\">"))
634 (muse-insert-markup "</div>")))))
636 (defun muse-html-src-tag (beg end attrs
)
637 "Publish the region using htmlize.
638 The language to use may be specified by the \"lang\" attribute.
640 Muse will look for a function named LANG-mode, where LANG is the
641 value of the \"lang\" attribute.
643 This tag requires htmlize 1.34 or later in order to work."
644 (if (condition-case nil
647 (if (fboundp 'htmlize-region-for-paste
)
649 (muse-display-warning
650 (concat "The `htmlize-region-for-paste' function was not"
651 " found.\nThis is available in htmlize.el 1.34"
655 ;; if htmlize.el was not found, treat this like an example tag
656 (muse-publish-example-tag beg end
)
657 (muse-publish-ensure-block beg end
)
658 (let* ((lang (cdr (assoc "lang" attrs
)))
659 (mode (or (and (not (eq muse-html-src-allowed-modes t
))
660 (not (member lang muse-html-src-allowed-modes
))
662 (intern-soft (concat lang
"-mode"))))
663 (text (muse-delete-and-extract-region beg end
))
670 (font-lock-fontify-buffer)
671 ;; silence the byte-compiler
672 (when (fboundp 'htmlize-region-for-paste
)
673 ;; transform the region to HTML
674 (htmlize-region-for-paste (point-min) (point-max))))))
676 (narrow-to-region (point) (point))
678 (goto-char (point-min))
679 (re-search-forward "<pre\\([^>]*\\)>\n?" nil t
)
680 (replace-match "<pre class=\"src\">")
681 (goto-char (point-max))
682 (muse-publish-mark-read-only (point-min) (point-max))))))
684 ;; Register the Muse HTML Publisher
686 (defun muse-html-browse-file (file)
687 (browse-url (concat "file:" file
)))
689 (defun muse-html-encoding ()
690 (if (stringp muse-html-meta-content-encoding
)
691 muse-html-meta-content-encoding
692 (muse-xml-transform-content-type
693 (or (and (boundp 'buffer-file-coding-system
)
694 buffer-file-coding-system
)
695 muse-html-encoding-default
)
696 muse-html-charset-default
)))
698 (defun muse-html-prepare-buffer ()
699 (make-local-variable 'muse-html-meta-http-equiv
)
700 (set (make-local-variable 'muse-html-meta-content-type
)
702 (string-match "charset=" muse-html-meta-content-type
))
703 muse-html-meta-content-type
704 (concat muse-html-meta-content-type
"; charset="
705 (muse-html-encoding)))))
707 (defun muse-html-munge-buffer ()
708 (if muse-publish-generate-contents
710 (goto-char (car muse-publish-generate-contents
))
711 (muse-html-insert-contents (cdr muse-publish-generate-contents
))
712 (setq muse-publish-generate-contents nil
))
713 (muse-html-denote-headings)))
715 (defun muse-html-finalize-buffer ()
716 (when (and (boundp 'buffer-file-coding-system
)
717 (memq buffer-file-coding-system
'(no-conversion undecided-unix
)))
718 ;; make it agree with the default charset
719 (setq buffer-file-coding-system muse-html-encoding-default
)))
721 ;;; Register the Muse HTML and XHTML Publishers
723 (muse-define-style "html"
724 :suffix
'muse-html-extension
725 :regexps
'muse-html-markup-regexps
726 :functions
'muse-html-markup-functions
727 :strings
'muse-html-markup-strings
728 :tags
'muse-html-markup-tags
729 :specials
'muse-xml-decide-specials
730 :before
'muse-html-prepare-buffer
731 :before-end
'muse-html-munge-buffer
732 :after
'muse-html-finalize-buffer
733 :header
'muse-html-header
734 :footer
'muse-html-footer
735 :style-sheet
'muse-html-style-sheet
736 :browser
'muse-html-browse-file
)
738 (muse-derive-style "xhtml" "html"
739 :suffix
'muse-xhtml-extension
740 :strings
'muse-xhtml-markup-strings
741 :header
'muse-xhtml-header
742 :footer
'muse-xhtml-footer
743 :style-sheet
'muse-xhtml-style-sheet
)
745 ;; xhtml1.0 is an alias for xhtml
746 (muse-derive-style "xhtml1.0" "xhtml")
748 ;; xhtml1.1 has some quirks that need attention from us
749 (muse-derive-style "xhtml1.1" "xhtml"
750 :strings
'muse-xhtml1.1-markup-strings
)
754 ;;; muse-html.el ends here