New XHTML style, add more examples to my sample muse config
[muse-el.git] / muse-xhtml.el
blobd2b8daa7d2f0a2c6bdebba09382302d6aa209262
1 ;;; muse-xhtml.el --- Muse XHTML publishing style.
3 ;; Copyright (C) 2005 Free Software Foundation, Inc.
5 ;; This file is not part of GNU Emacs.
7 ;; This is free software; you can redistribute it and/or modify it under
8 ;; the terms of the GNU General Public License as published by the Free
9 ;; Software Foundation; either version 2, or (at your option) any later
10 ;; version.
12 ;; This is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 ;; for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 ;; MA 02111-1307, USA.
22 ;;; Commentary:
24 ;;; Contributors:
26 ;;; Code:
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 ;; Muse XHTML Publishing
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34 (require 'muse-html)
36 (defgroup muse-xhtml nil
37 "Options controlling the behaviour of Muse XHTML publishing.
38 See `muse-xhtml' for more information."
39 :group 'muse-publish)
41 (defcustom muse-xhtml-extension ".html"
42 "Default file extension for publishing XHTML files."
43 :type 'string
44 :group 'muse-xhtml)
46 (defcustom muse-xhtml-style-sheet
47 "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/default.css\" />"
48 "Store your stylesheet definitions here.
49 This is used in `muse-xhtml-header'.
50 You can put raw CSS in here or a <link> tag to an external stylesheet.
51 This text may contain <lisp> markup tags."
52 :type 'string
53 :group 'muse-xhtml)
55 (defcustom muse-xhtml-header
56 "<?xml version=\"1.0\"?>
57 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
58 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
59 <html xmlns=\"http://www.w3.org/1999/xhtml\">
60 <head>
61 <title><lisp>
62 (concat (muse-publishing-directive \"title\")
63 (let ((author (muse-publishing-directive \"author\")))
64 (if (not (string= author (user-full-name)))
65 (concat \" (by \" author \")\"))))</lisp></title>
66 <meta name=\"generator\" content=\"muse.el\" />
67 <meta http-equiv=\"<lisp>muse-xhtml-meta-http-equiv</lisp>\"
68 content=\"<lisp>muse-html-meta-content-type</lisp>\" />
69 <lisp>
70 (let ((maintainer (muse-style-element :maintainer)))
71 (when maintainer
72 (concat \"<link rev=\\\"made\\\" href=\\\"\" maintainer \"\\\" />\")))
73 </lisp>
74 <lisp>muse-xhtml-style-sheet</lisp>
75 </head>
76 <body>
77 <h1><lisp>
78 (concat (muse-publishing-directive \"title\")
79 (let ((author (muse-publishing-directive \"author\")))
80 (if (not (string= author (user-full-name)))
81 (concat \" (by \" author \")\"))))</lisp></h1>
82 <!-- Page published by Emacs Muse begins here -->\n"
83 "Header used for publishing XHTML files."
84 :type '(choice string file)
85 :group 'muse-xhtml)
87 (defcustom muse-xhtml-footer "
88 <!-- Page published by Emacs Muse ends here -->
89 </body>
90 </html>\n"
91 "Footer used for publishing XHTML files."
92 :type '(choice string file)
93 :group 'muse-xhtml)
95 (defcustom muse-xhtml-markup-strings
96 '((image-with-desc . "<img src=\"%s\" alt=\"%s\" />")
97 (image-link . "<img src=\"%s\" alt=\"\" />")
98 (url-with-image . "<a class=\"image-link\" href=\"%s\"><img src=\"%s\" alt=\"\" /></a>")
99 (begin-underline . "<span style=\"text-decoration: underline;\">\n")
100 (end-underline . "</span>")
101 (begin-center . "<span style=\"text-align: center;\">\n")
102 (end-center . "\n</span>"))
103 "Strings used for marking up text.
104 These cover the most basic kinds of markup, the handling of which
105 differs little between the various styles.
107 If a markup rule is not found here, `muse-html-markup-strings' is
108 searched."
109 :type '(alist :key-type symbol :value-type string)
110 :group 'muse-xhtml)
112 (defcustom muse-xhtml-meta-http-equiv "Content-Type"
113 "The http-equiv attribute used for the HTML <meta> tag."
114 :type 'string
115 :group 'muse-xhtml)
117 (defcustom muse-xhtml-meta-content-type "text/html"
118 "The content type used for the HTML <meta> tag."
119 :type 'string
120 :group 'muse-xhtml)
122 (defun muse-xhtml-prepare-buffer ()
123 "Prepare this buffer for use with the XHTML publisher."
124 ;; Call the HTML "constructor"
125 (muse-html-prepare-buffer)
126 ;; Be safe by making this buffer-local
127 (make-local-variable 'muse-xhtml-meta-http-equiv)
128 ;; Reset the value of `muse-html-meta-content-type' -- it has
129 ;; already been made buffer local by the HTML constructor.
130 (setq muse-html-meta-content-type
131 (concat muse-xhtml-meta-content-type "; charset="
132 (muse-html-encoding))))
134 ;;; Register the XHTML Publisher
136 (unless (assoc "xhtml" muse-publishing-styles)
137 (muse-derive-style "xhtml" "html"
138 :suffix 'muse-xhtml-extension
139 :strings 'muse-xhtml-markup-strings
140 :header 'muse-xhtml-header
141 :footer 'muse-xhtml-footer
142 :before 'muse-xhtml-prepare-buffer))
144 (provide 'muse-xhtml)
146 ;;; muse-xhtml.el ends here