summaryrefslogtreecommitdiff
path: root/publish.el
blob: 91e281fc65ee08d4aa179c4a3bf2a04d9b6f29de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
;; Copyright (C) 2021-2022 Yuchen Pei.

;; This file is part of site generator for libreau.org (libreau for short).

;; libreau is free software: you can redistribute it and/or modify it
;; under the terms of the GNU Affero General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.

;; libreau is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU Affero General Public License for more details.

;; You should have received a copy of the GNU Affero General Public License
;; along with libreau.  If not, see <https://www.gnu.org/licenses/>.

(package-initialize)

(require 'ox-publish)

(defun me/html-preamble (plist)
  (with-temp-buffer
    (insert-file-contents "../html-templates/preamble.html") (buffer-string)))

(defun me/html-postamble (plist)
  (with-temp-buffer
    (insert-file-contents "../html-templates/postamble.html") (buffer-string)))

(setq org-publish-project-alist
      '(("pages"
         :base-directory "pages"
         :base-extension "org"
         :publishing-directory "site"
         :recursive t
         :publishing-function org-html-publish-to-html
	 :html-head "<link rel='stylesheet' href='../css/default.css' type='text/css'/>"
	 :html-prefer-user-labels t
	 :html-mathjax-options nil
	 :html-mathjax-template ""
	 :with-toc nil
	 :section-numbers nil
	 :html-self-link-headlines t
	 :html-preamble me/html-preamble
	 :html-postamble me/html-postamble
	 )
	("pages-html"
	 :base-directory "pages"
	 :base-extension "html"
	 :publishing-directory "site"
	 :recursive t
	 :publishing-function org-publish-attachment)
	("css"
         :base-directory "css"
         :base-extension "css"
         :publishing-directory "site/css"
         :publishing-function org-publish-attachment
         :recursive t
	 )
        ("all" :components ("pages" "pages-html" "css"))))