This repository has been archived by the owner on May 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
+publish.el
157 lines (146 loc) · 5.75 KB
/
+publish.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
;;; +publish.el -*- lexical-binding:t -*-
;; Prevent excessively large backtraces
(setq debug-on-error nil
no-byte-compile t)
(load-file "lisp/+package.el")
(load-file "lisp/+redefun.el")
(load-file "lisp/+template.el")
(require 'oc)
(require 'oc-csl)
(require 'ox-publish)
(require 'citeproc)
(defun +publish-headline-function (todo todo-type priority text tags info)
"Format a headline with a link to itself."
(let* ((headline (get-text-property 0 :parent text))
(id (or (org-element-property :CUSTOM_ID headline)
(org-export-get-reference headline info)
(org-element-property :ID headline)))
(link (or (and id (format "<a href=\"#%s\">%s</a>" id text) text))))
(org-html-format-headline-default-function todo todo-type priority link tags info)))
(defun +publish-posts-sitemap-formatter (entry style project)
"Format a sitemap entry with its date within the context of the
posts publishing project."
(format "%s - [[file:%s][%s]]"
(format-time-string "%Y-%m-%d" (org-publish-find-date entry project))
entry
(org-publish-find-title entry project)))
(defun +publish-dotfiles-sitemap-formatter (entry style project)
"Format a sitemap entry with its date within the context of the
dotfiles publishing project."
(let* ((title (org-publish-find-title entry project))
(description (org-publish-find-property entry :description project 'html))
(link (format "[[file:%s][%s]]" entry title)))
(if description
(concat link " -- " description "\n")
entry)))
(defun +publish-dotfiles-sitemap-function (title list)
"Custom sitemap function for the dotfiles publishing project."
(concat "#+OPTIONS: html-postamble:nil" "\n"
(org-publish-sitemap-default title list)))
(defun +publish-posts-sitemap-function (title list)
"Custom sitemap function for the posts publishing project."
(concat "#+OPTIONS: html-postamble:nil html-preamble:nil" "\n"
(org-publish-sitemap-default title list)))
(defun +publish-should-lang-confirm? (lang body)
"Return non-nil if LANG is to be evaluated without confirmation."
(not (member lang '("dot" "emacs-lisp" "plantuml"))))
(setq user-full-name "Aziz Ben Ali"
user-mail-address "tahaaziz.benali@esprit.tn"
make-backup-files nil
;; org-fold-core-style 'overlays
org-publish-list-skipped-files nil
org-publish-timestamp-directory ".cache/"
org-export-time-stamp-file nil
org-src-fontify-natively t
org-src-preserve-indentation t
org-confirm-babel-evaluate #'+publish-should-lang-confirm?
org-plantuml-exec-mode 'plantuml
org-plantuml-args '("-headless")
org-html-doctype "html5"
org-html-html5-fancy t
org-html-htmlize-output-type 'css
org-html-footnotes-section +template-footnotes-section
org-html-head-include-default-style nil
org-html-prefer-user-labels t
org-cite-global-bibliography (list (expand-file-name "assets/bibliography.bib"))
org-cite-csl-styles-dir "assets/csl/styles"
org-cite-csl-locales-dir "assets/csl/locales"
org-cite-export-processors '((html . (csl "ieee.csl"))
(latex . biblatex)
(t . simple)))
(setq org-publish-project-alist
(list
(list "content"
:base-extension "org"
:base-directory "src"
:publishing-directory "public"
:publishing-function 'org-html-publish-to-html
:section-numbers nil
:with-toc nil
:with-title t
:html-head-extra +template-metadata
:html-preamble +template-main-navbar
:html-postamble nil)
(list "posts"
:base-extension "org"
:base-directory "src/posts"
:publishing-directory "public/posts"
:publishing-function 'org-html-publish-to-html
:auto-sitemap t
:sitemap-sort-files 'anti-chronologically
:sitemap-format-entry '+publish-posts-sitemap-formatter
:sitemap-function '+publish-dotfiles-sitemap-function
:sitemap-title "Posts"
:with-title t
:with-toc nil
:html-preamble +template-main-navbar
:html-postamble
(concat +template-posts-footer
+template-main-footer)
:html-head-extra
(concat +template-metadata
(+template-stylesheet "/css/blog.css")))
(list "dotfiles"
:base-extension "org"
:base-directory "src/dotfiles"
:publishing-directory "public/dotfiles"
:publishing-function 'org-html-publish-to-html
:exclude (regexp-opt '("README.org"))
:recursive t
:auto-sitemap t
:sitemap-title "Peek into the inner workings of my system"
:sitemap-style 'list
:sitemap-format-entry '+publish-dotfiles-sitemap-formatter
:sitemap-function '+publish-dotfiles-sitemap-function
:section-numbers t
:with-title t
:with-toc t
:html-preamble +template-dotfiles-navbar
:html-postamble +template-main-footer
:html-head-extra +template-metadata)
(list "images"
:base-extension (regexp-opt '("png" "jpg" "jpeg" "svg"))
:base-directory "assets/images"
:publishing-directory "public/assets/images"
:publishing-function 'org-publish-attachment
:recursive t)
(list "data"
:base-extension ".*"
:base-directory "assets"
:publishing-directory "public/assets"
:publishing-function 'org-publish-attachment)
(list "stylesheets"
:base-extension "css"
:base-directory "src/css"
:publishing-directory "public/css"
:publishing-function 'org-publish-attachment)
(list "javascripts"
:base-extension "js"
:base-directory "src/js"
:exclude "grunt.js"
:publishing-directory "public/js"
:publishing-function 'org-publish-attachment)
(list "all"
:components
'("content" "posts" "dotfiles" "stylesheets"
"javascripts" "images" "data"))))