New XHTML style, add more examples to my sample muse config
[muse-el.git] / muse-blosxom.el
blobbfc25ca083f46ce92713912c61314ba1c2ff1566
1 ;;; muse-blosxom.el --- Publish a document tree for serving by (py)Blosxom
3 ;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 ;; Emacs Lisp Archive Entry
6 ;; Filename: muse-blosxom.el
7 ;; Version: 3.00
8 ;; Date: Wed, 23 March 2005
9 ;; Keywords: hypermedia
10 ;; Author: Gary V. Vaughan (gary AT gnu DOT org)
11 ;; Maintainer: Michael Olson (mwolson AT gnu DOT org)
12 ;; Description: Publish a document tree for serving by (py)Blosxom
13 ;; URL: http://www.mwolson.org/projects/MuseMode.html
14 ;; Compatibility: Emacs21
16 ;; This file is not part of GNU Emacs.
18 ;; This is free software; you can redistribute it and/or modify it under
19 ;; the terms of the GNU General Public License as published by the Free
20 ;; Software Foundation; either version 2, or (at your option) any later
21 ;; version.
23 ;; This is distributed in the hope that it will be useful, but WITHOUT
24 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 ;; for more details.
28 ;; You should have received a copy of the GNU General Public License
29 ;; along with GNU Emacs; see the file COPYING. If not, write to the
30 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
31 ;; MA 02111-1307, USA.
33 ;;; Commentary:
35 ;; Blosxom publishes a tree of categorised files to a mirrored tree of
36 ;; blosxom stories to be served by blosxom.cgi or pyblosxom.cgi.
38 ;; Each Blosxom file must include `#date yyyy-mm-dd', or optionally
39 ;; the longer `#date yyyy-mm-dd-hh-mm', plus whatever normal content
40 ;; is desired.
42 ;; This date directive is not used directly by (py)blosxom or this
43 ;; program. You need to find two additional items to make use of this
44 ;; feature.
46 ;; 1. A script to gather date directives from the entire blog tree
47 ;; into a single file. The file must associate a blog entry with
48 ;; a date.
50 ;; 2. A plugin for (py)blosxom that reads this file.
52 ;; These 2 things are provided for pyblosxom in the contrib/pyblosxom
53 ;; subdirectory. `getstamps.py' provides the 1st service, while
54 ;; `hardcodedates.py' provides the second service. Eventually it is
55 ;; hoped that a blosxom plugin and script will be found/written.
57 ;;; Contributors:
59 ;; Gary Vaughan (gary AT gnu DOT org) is the original author of
60 ;; `emacs-wiki-blosxom.el', which is the ancestor of this file.
62 ;; Brad Collins (brad AT chenla DOT org) ported this file to Muse.
64 ;; Michael Olson (mwolson AT gnu DOT org) further adapted this file to
65 ;; Muse and continues to maintain it.
67 ;;; Code:
69 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
71 ;; Muse Blosxom Publishing
73 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
75 (require 'muse-publish)
76 (require 'muse-html)
78 (defgroup muse-blosxom nil
79 "Options controlling the behaviour of Muse BLOSXOM publishing.
80 See `muse-blosxom' for more information."
81 :group 'muse-publish)
83 (defcustom muse-blosxom-extension ".txt"
84 "Default file extension for publishing BLOSXOM files."
85 :type 'string
86 :group 'muse-blosxom)
88 (defcustom muse-blosxom-header
89 "<lisp>(muse-publishing-directive \"title\")</lisp>\n"
90 "Header used for publishing BLOSXOM files."
91 :type '(choice string file)
92 :group 'muse-blosxom)
94 (defcustom muse-blosxom-footer "\n"
95 "Footer used for publishing BLOSXOM files."
96 :type '(choice string file)
97 :group 'muse-blosxom)
99 (defcustom muse-blosxom-markup-regexps
100 `(;; join together the parts of a list or table
101 (10000 "</\\([oud]l\\)>\\s-*<\\1>\\s-*" 0 "")
102 (10100 ,(concat " </t\\(body\\|head\\|foot\\)>\\s-*</table>\\s-*"
103 "<table[^>]*>\\s-*<t\\1>\n") 0 "")
104 (10200 "</table>\\s-*<table[^>]*>\n" 0 "")
106 ;; the beginning of the buffer begins the first paragraph
107 (10300 "\\`\n*\\([^<-]\\|<\\(em\\|strong\\|code\\)>\\|<a \\)" 0
108 "<p class=\"first\">\\1")
109 ;; plain paragraph separator
110 (10400 ,(concat "\\(\n</\\(blockquote\\|center\\)>\\)?\n"
111 "\\(["
112 muse-regexp-blank
113 "]*\n\\)+\\(<\\(blockquote\\|center\\)>\n\\)?")
114 0 muse-html-markup-paragraph)
115 (10500 ,(concat "\\([^>"
116 muse-regexp-space
117 "]\\)\\s-*\\'")
118 0 "\\1</p>\n")
119 ;; planner stuff
120 (10600 "^#\\([A-C]\\)\\([0-9]*\\)\\s-*\\([_oX>CP]\\)\\s-*\\(.+\\)"
121 0 planner-markup-task)
122 (10700 "^\\.#\\([0-9]+\\)" 0 planner-markup-note)
123 ;; date directive
124 (10800 "^#date\\s-+\\(.+\\)\n+" 0 muse-blosxom-markup-date-directive))
125 "List of markup rules for publishing a Muse page to BLOSXOM.
126 For more on the structure of this list, see `muse-publish-markup-regexps'."
127 :type '(repeat (choice
128 (list :tag "Markup rule"
129 (choice regexp symbol)
130 integer
131 (choice string function symbol))
132 function))
133 :group 'muse-blosxom)
135 ;;; Register the BLOSXOM Publisher
137 (unless (assoc "blosxom" muse-publishing-styles)
138 (muse-derive-style "blosxom-html" "html"
139 :suffix 'muse-blosxom-extension
140 :regexps 'muse-blosxom-markup-regexps
141 :header 'muse-blosxom-header
142 :footer 'muse-blosxom-footer)
144 (muse-derive-style "blosxom-xhtml" "xhtml"
145 :suffix 'muse-blosxom-extension
146 :regexps 'muse-blosxom-markup-regexps
147 :header 'muse-blosxom-header
148 :footer 'muse-blosxom-footer))
150 ;;; Maintain (published-file . date) alist
152 (defvar muse-blosxom-page-date-alist nil)
154 ;; This isn't really used for anything, but it may be someday
155 (defun muse-blosxom-markup-date-directive ()
156 "Add a date entry to `muse-blosxom-page-date-alist' for this page."
157 (let ((date (match-string 1)))
158 (save-match-data
159 (add-to-list
160 'muse-blosxom-page-date-alist
161 `(,buffer-file-name . ,date))))
164 (provide 'muse-blosxom)
166 ;;; muse-blosxom.el ends here