-
Notifications
You must be signed in to change notification settings - Fork 35
/
build-site.el
executable file
·144 lines (135 loc) · 6.49 KB
/
build-site.el
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
;; build site
(package-initialize)
(require 'ox-publish)
(require 'htmlize)
(org-babel-do-load-languages
'org-babel-load-languages
'((dot . t)
(ditaa . t)
(R . t)))
(setq-default buffer-file-coding-system 'utf-8)
(defvar sacha/emacs-notes-html-head
"<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/foundation.min.css\"></link>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'></link>
<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/org-export.css\"></link>
<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/style.css\"></link>
<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/emacs-notes.css\"></link>
<script src=\"./js/jquery.min.js\"></script>
<script src=\"./js/emacs-notes.js\"></script>")
(defvar sacha/emacs-notes-postamble "<div class=\"back-to-top\"><a href=\"#top\">Back to top</a> | <a href=\"mailto:[email protected]\">E-mail me</a></div>")
(defvar sacha/emacs-notes-directory (file-name-directory (or load-file-name buffer-file-name))
"Location of files.")
(defun sacha/emacs-notes-org-publish-project (project &optional force async)
"Override some variables."
(interactive
(list
(assoc (org-icompleting-read
"Publish project: "
org-publish-project-alist nil t)
org-publish-project-alist)
current-prefix-arg))
(let ((buffer-file-coding-system 'utf-8)
(select-safe-coding-system-accept-default-p t)
org-confirm-babel-evaluate
make-backup-files
org-html-validation-link)
(org-publish-project project force async)))
(defun sacha/emacs-notes-org-publish-current-file (&optional force async)
"Override some variables."
(interactive)
(let ((buffer-file-coding-system 'utf-8)
(select-safe-coding-system-accept-default-p t)
org-confirm-babel-evaluate
make-backup-files
org-html-validation-link)
(org-publish-current-file force async)))
(defun sacha/emacs-notes-org-html-publish-to-html (plist filename pub-dir)
"Publish without saving backup files."
(let ((buffer-file-coding-system 'utf-8)
(select-safe-coding-system-accept-default-p t)
org-confirm-babel-evaluate
make-backup-files org-html-validation-link)
(condition-case nil
(org-html-publish-to-html plist filename pub-dir)
(error (message "Error publishing %s" filename)))))
(unless (assoc "emacs-notes-base" org-publish-project-alist)
(add-to-list 'org-publish-project-alist
`("emacs-notes-base"
:base-directory ,sacha/emacs-notes-directory
:base-extension "org"
:exclude "tasks.org" ; regexp
:publishing-directory ,sacha/emacs-notes-directory
:publishing-function sacha/emacs-notes-org-html-publish-to-html
:html-head-include-default-style nil
:html-head-include-scripts nil
:html-head ,sacha/emacs-notes-html-head
:auto-sitemap t ; Generate sitemap.org automagically...
:sitemap-filename "sitemap.org" ; Call it sitemap.org (it's the default)...
:sitemap-title "Sitemap" ; With title 'Sitemap'.
:makeindex t
:with-timestamp t
:section-numbers nil
:html-preamble ""
:html-postamble ,sacha/emacs-notes-postamble
:htmlized-source t
)))
(unless (assoc "emacs-notes-blog-posts" org-publish-project-alist)
(add-to-list 'org-publish-project-alist
`("emacs-notes-blog-posts"
:base-directory ,(expand-file-name "blog-posts" sacha/emacs-notes-directory)
:base-extension "org"
:exclude "tasks.org" ; regexp
:publishing-directory ,(expand-file-name "blog-posts" sacha/emacs-notes-directory)
:publishing-function sacha/emacs-notes-org-html-publish-to-html
:html-head-include-default-style nil
:html-head-include-scripts nil
:html-head ,(replace-regexp-in-string "\\./" "../" sacha/emacs-notes-html-head)
:auto-sitemap t ; Generate sitemap.org automagically...
:sitemap-filename "sitemap.org" ; Call it sitemap.org (it's the default)...
:sitemap-title "Sitemap" ; With title 'Sitemap'.
:section-numbers nil
:html-preamble ""
:html-postamble ,sacha/emacs-notes-postamble
:makeindex t
:with-timestamp t
:htmlized-source)))
(unless (assoc "read-lisp-tweak-emacs" org-publish-project-alist)
(add-to-list 'org-publish-project-alist
`("read-lisp-tweak-emacs"
:base-directory ,(expand-file-name "read-lisp-tweak-emacs" sacha/emacs-notes-directory)
:base-extension "txt"
:publishing-directory ,(expand-file-name "read-lisp-tweak-emacs" sacha/emacs-notes-directory)
:publishing-function sacha/emacs-notes-org-html-publish-to-html
:html-head-include-default-style nil
:html-head-include-scripts nil
:html-head ,(replace-regexp-in-string "\\./" "../" sacha/emacs-notes-html-head)
:auto-sitemap t ; Generate sitemap.org automagically...
:sitemap-filename "sitemap.org" ; Call it sitemap.org (it's the default)...
:sitemap-title "Sitemap" ; With title 'Sitemap'.
:section-numbers nil
:html-preamble ""
:html-postamble ,sacha/emacs-notes-postamble
:makeindex t
:with-timestamp t
:htmlized-source)))
(unless (assoc "emacs-notes-transcripts" org-publish-project-alist)
(add-to-list 'org-publish-project-alist
`("emacs-notes-transcripts"
:base-directory ,(expand-file-name "transcripts" sacha/emacs-notes-directory)
:publishing-directory ,(expand-file-name "transcripts" sacha/emacs-notes-directory)
:publishing-function sacha/emacs-notes-org-html-publish-to-html
:html-head-include-default-style nil
:html-head-include-scripts nil
:html-head ,(replace-regexp-in-string "\\./" "../" sacha/emacs-notes-html-head)
:auto-sitemap t ; Generate sitemap.org automagically...
:sitemap-filename "sitemap.org" ; Call it sitemap.org (it's the default)...
:sitemap-title "Sitemap" ; With title 'Sitemap'.
:section-numbers nil
:html-preamble ""
:html-postamble ,sacha/emacs-notes-postamble
:makeindex t
:with-timestamp t
:htmlized-source)))
(unless (assoc "sacha/emacs-notes" org-publish-project-alist)
(add-to-list 'org-publish-project-alist '("sacha/emacs-notes"
:components ("emacs-notes-base" "emacs-notes-blog-posts" "emacs-notes-transcripts"))))