Manual: Initial documentation effort for ikiwiki example.
[muse-el.git] / examples / ikiwiki / muse-init.el
blob8e058d12b8d602107eca7b0b0895510c39d00cc2
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
13 (require 'muse-project) ; load support for projects
14 (require 'muse-wiki) ; load Wiki support
16 ;;; Settings
18 ;; Styles
19 (muse-derive-style "ikiwiki" "xhtml"
20 :header ""
21 :footer "")
23 ;; New variables
24 (defvar muse-ikiwiki-project "HCoopWiki"
25 "Name of the project to publish using ikiwiki.")
26 (defvar muse-ikiwiki-source "/afs/hcoop.net/common/ikiwiki/repo"
27 "Source directory for Muse files.")
28 (defvar muse-ikiwiki-dest "/afs/hcoop.net/common/ikiwiki/dest"
29 "Destination directory for published files.")
31 ;; Project listing
32 (setq muse-project-alist
33 `((,muse-ikiwiki-project
34 (,@(muse-project-alist-dirs muse-ikiwiki-source))
35 ;; Publish this directory and its subdirectories. Arguments
36 ;; are as follows. The above `muse-project-alist-dirs' part
37 ;; is also needed.
38 ;; 1. Source directory
39 ;; 2. Output directory
40 ;; 3. Publishing style
41 ;; remainder: Other things to put in every generated style
42 ,@(muse-project-alist-styles muse-ikiwiki-source
43 muse-ikiwiki-dest
44 "ikiwiki"))))
46 ;; Wiki settings
47 (setq muse-wiki-allow-nonexistent-wikiword t
48 muse-wiki-match-all-project-files t
49 muse-wiki-interwiki-delimiter "::")
50 (add-to-list 'muse-publish-desc-transforms 'muse-wiki-publish-pretty-interwiki)
51 (add-to-list 'muse-publish-desc-transforms 'muse-wiki-publish-pretty-title)
52 (setq muse-wiki-interwiki-alist
53 '(("EmacsWiki" . "http://www.emacswiki.org/cgi-bin/wiki/")
54 ("UbuntuLinux" . "http://ubuntulinux.org/")))
56 ;; Permitted modes for <src> to colorize
57 (setq muse-html-src-allowed-modes
58 '("ada" "apache" "asm" "awk" "c++" "c" "cc" "change-log" "context"
59 "css" "diary" "diff" "dns" "domtool" "emacs-lisp" "f90" "fortran"
60 "fundamental" "html" "java" "jython" "latex" "lisp" "lua" "m4"
61 "makefile" "markdown" "matlab" "maxima" "message" "modula-2" "muse"
62 "nroff" "octave" "org" "outline" "pascal" "perl" "ps" "python" "rst"
63 "ruby" "scheme" "sgml" "sh" "slang" "sml" "sml-cm" "sml-lex" "sml-yacc"
64 "sql" "tcl" "tex" "texinfo" "xml" "zone"))
65 ;; In case someone does <src lang="muse">
66 (setq muse-colors-evaluate-lisp-tags nil
67 muse-colors-inline-images nil)
68 ;; In case someone does <src lang="org">
69 (require 'org)
70 (setq org-inhibit-startup t
71 org-table-formula-evaluate-inline nil)
73 ;; Don't allow dangerous tags to be published
74 (setq muse-publish-enable-dangerous-tags nil)
76 ;;; Functions
78 (defun muse-ikiwiki-publish (file &optional force)
79 "Publish a single file for ikiwiki."
80 (if (not (stringp file))
81 (message "Error: No file given to publish")
82 (let* ((project (muse-project muse-ikiwiki-project))
83 (styles (and project (cddr project)))
84 (muse-current-project project)
85 (muse-batch-publishing-p t))
86 (if (not project)
87 (message "Error: project `%s' does not exist" muse-ikiwiki-project)
88 (muse-project-publish-file file styles force)))))
90 ;;; Custom variables
92 (custom-set-variables
93 '(muse-html-charset-default "utf-8")
94 '(muse-html-encoding-default (quote utf-8))
95 '(muse-html-meta-content-encoding (quote utf-8))
96 '(muse-publish-comments-p t)
97 '(muse-publish-date-format "%b. %e, %Y"))
98 (custom-set-faces
99 '(muse-bad-link ((t (:foreground "DeepPink" :underline "DeepPink" :weight bold)))))
101 ;;; Start server
103 (require 'server)
104 (server-start)
106 ;;; muse-init.el ends here