Handle remote paths correctly in muse-project-alist-styles.
[muse-el.git] / lisp / muse-ikiwiki.el
blob8565977bcedbefa9490c337b1d4246d677c84e97
1 ;;; muse-ikiwiki.el --- integrate with Ikiwiki
3 ;; Copyright (C) 2008 Free Software Foundation, Inc.
5 ;; This file is part of Emacs Muse. It is not part of GNU Emacs.
7 ;; Emacs Muse is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; Emacs Muse is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with Emacs Muse; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ;; Boston, MA 02110-1301, USA.
22 ;;; Commentary:
24 ;;; Contributors:
26 ;;; Code:
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 ;; Muse Ikiwiki Integration
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34 (require 'muse)
35 (require 'muse-html)
36 (require 'muse-publish)
38 (defgroup muse-ikiwiki nil
39 "Options controlling the behavior of Muse integration with Ikiwiki."
40 :group 'muse-publish)
42 (defcustom muse-ikiwiki-header ""
43 "Header used for publishing Ikiwiki output files.
44 This may be text or a filename."
45 :type 'string
46 :group 'muse-ikiwiki)
48 (defcustom muse-ikiwiki-footer ""
49 "Footer used for publishing Ikiwiki output files.
50 This may be text or a filename."
51 :type 'string
52 :group 'muse-ikiwiki)
54 (defun muse-ikiwiki-publish-file (file name &optional style)
55 "Publish a single file for Ikiwiki.
56 The name of the style is given by STYLE. It defaults to \"ikiwiki\".
57 The name of the real file is NAME, and the name of the temporary
58 file containing the content is FILE."
59 (if (not (stringp file))
60 (message "Error: No file given to publish")
61 (unless style
62 (setq style "ikiwiki"))
63 (let ((muse-batch-publishing-p t)
64 (title (muse-page-name name))
65 (output-path file)
66 (target file)
67 (muse-publishing-current-file file)
68 (muse-publishing-current-output-path file)
69 muse-current-output-style)
70 ;; don't activate VC when publishing files
71 (setq vc-handled-backends nil)
72 (setq muse-current-output-style (list :base style :path file))
73 (setq auto-mode-alist
74 (delete (cons (concat "\\." muse-file-extension "\\'")
75 'muse-mode-choose-mode)
76 auto-mode-alist))
77 (muse-with-temp-buffer
78 (muse-insert-file-contents file)
79 (run-hooks 'muse-before-publish-hook)
80 (let ((muse-inhibit-before-publish-hook t))
81 (muse-publish-markup-buffer title style))
82 (when (muse-write-file output-path)
83 (muse-style-run-hooks :final style file output-path target))))))
85 ;; Styles
86 (muse-derive-style "ikiwiki" "xhtml"
87 :header 'muse-ikiwiki-header
88 :footer 'muse-ikiwiki-footer)
90 (provide 'muse-ikiwiki)
92 ;;; muse-ikiwiki.el ends here