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