Initial version of ikiwiki plug-in. Start with simpler non-project publishing.
[muse-el.git] / examples / ikiwiki / muse-init-simple.el
blob11ba81cd3c1680e90476fb9fa266bff5c929b48c
1 ;;; muse-init.el --- Use Emacs Muse to publish ikiwiki documents
3 ;; The code in this file may be used, distributed, and modified
4 ;; without restriction.
6 ;;; Setup
8 (add-to-list 'load-path (expand-file-name "~ikiwiki/elisp/muse/lisp"))
10 ;; Initialize
11 (require 'muse) ; load generic module
12 (require 'muse-html) ; load (X)HTML publishing style
14 ;;; Settings
16 ;; Styles
17 (muse-derive-style "ikiwiki" "xhtml"
18 :header ""
19 :footer "")
21 ;; Permitted modes for <src> to colorize
22 (setq muse-html-src-allowed-modes
23 '("ada" "apache" "asm" "awk" "c++" "c" "cc" "change-log" "context"
24 "css" "diary" "diff" "dns" "domtool" "emacs-lisp" "f90" "fortran"
25 "fundamental" "html" "java" "jython" "latex" "lisp" "lua" "m4"
26 "makefile" "markdown" "matlab" "maxima" "message" "modula-2" "muse"
27 "nroff" "octave" "org" "outline" "pascal" "perl" "ps" "python" "rst"
28 "ruby" "scheme" "sgml" "sh" "slang" "sml" "sml-cm" "sml-lex" "sml-yacc"
29 "sql" "tcl" "tex" "texinfo" "xml" "zone"))
30 ;; In case someone does <src lang="muse">
31 (setq muse-colors-evaluate-lisp-tags nil
32 muse-colors-inline-images nil)
33 ;; In case someone does <src lang="org">
34 (require 'org)
35 (setq org-inhibit-startup t
36 org-table-formula-evaluate-inline nil)
38 ;; Don't allow dangerous tags to be published
39 (setq muse-publish-enable-dangerous-tags nil)
41 ;;; Functions
43 (defun muse-ikiwiki-publish (file)
44 "Publish a single file for ikiwiki."
45 (if (not (stringp file))
46 (message "Error: No file given to publish")
47 (let ((muse-batch-publishing-p t)
48 (title "Unknown file from ikiwiki")
49 (style "ikiwiki")
50 (muse-publishing-current-file file)
51 (muse-publishing-current-output-path file)
52 muse-current-output-style)
53 ;; don't activate VC when publishing files
54 (setq vc-handled-backends nil)
55 (setq muse-current-output-style (list :base style :path file))
56 (setq auto-mode-alist
57 (delete (cons (concat "\\." muse-file-extension "\\'")
58 'muse-mode-choose-mode)
59 auto-mode-alist))
60 (muse-with-temp-buffer
61 (muse-insert-file-contents file)
62 (run-hooks 'muse-before-publish-hook)
63 (let ((muse-inhibit-before-publish-hook t))
64 (muse-publish-markup-buffer title style))
65 (when (muse-write-file output-path)
66 (muse-style-run-hooks :final style file output-path target))))))
68 ;;; Custom variables
70 (custom-set-variables
71 '(muse-html-charset-default "utf-8")
72 '(muse-html-encoding-default (quote utf-8))
73 '(muse-html-meta-content-encoding (quote utf-8))
74 '(muse-publish-comments-p t)
75 '(muse-publish-date-format "%b. %e, %Y"))
76 (custom-set-faces)
78 ;;; Start server
80 (require 'server)
81 (server-start)
83 ;;; muse-init.el ends here