1 | ;;; Emacs configuration for building a project
|
---|
2 |
|
---|
3 | (require 'org)
|
---|
4 | (require 'ox-publish)
|
---|
5 | (require 'ox-latex)
|
---|
6 | (require 'org-webring)
|
---|
7 | (require 's)
|
---|
8 | (require 'simple-httpd)
|
---|
9 |
|
---|
10 | (setq current-folder (file-truename "./"))
|
---|
11 |
|
---|
12 | (defvar youtube-iframe-format
|
---|
13 | ;; You may want to change your width and height.
|
---|
14 | (concat "<iframe id=\"ivplayer\" type=\"text/html\""
|
---|
15 | "src=\"https://youtube.host.w96k.dev/embed/%s\""
|
---|
16 | " frameborder=\"0\""
|
---|
17 | " allowfullscreen>%s</iframe>"))
|
---|
18 |
|
---|
19 | (defvar local-video-format
|
---|
20 | ;; You may want to change your width and height.
|
---|
21 | (concat "<video controls>"
|
---|
22 | "<source src=\"/public/videos/%s\"> Video are not supported </video>"))
|
---|
23 |
|
---|
24 | (org-add-link-type
|
---|
25 | "youtube"
|
---|
26 | (lambda (handle)
|
---|
27 | (browse-url
|
---|
28 | (concat "https://invidiou.site/embed/"
|
---|
29 | handle)))
|
---|
30 | (lambda (path desc backend)
|
---|
31 | (cl-case backend
|
---|
32 | (html (format youtube-iframe-format
|
---|
33 | path (or desc "")))
|
---|
34 | (latex (format "\href{%s}{%s}"
|
---|
35 | path (or desc "video"))))))
|
---|
36 |
|
---|
37 | (org-add-link-type
|
---|
38 | "video"
|
---|
39 | (lambda (handle)
|
---|
40 | (browse-url
|
---|
41 | (concat "/"
|
---|
42 | handle)))
|
---|
43 | (lambda (path desc backend)
|
---|
44 | (cl-case backend
|
---|
45 | (html (format local-video-format
|
---|
46 | path (or desc "")))
|
---|
47 | (latex (format "\href{%s}{%s}"
|
---|
48 | path (or desc "video"))))))
|
---|
49 |
|
---|
50 | (setq org-publish-project-alist
|
---|
51 | `(("blog"
|
---|
52 | :components ("blog-content" "blog-styles")
|
---|
53 | :base-directory current-folder)
|
---|
54 | ("blog-styles"
|
---|
55 | :base-directory ,(concat current-folder "public")
|
---|
56 | :base-extension "jpg\\|webp\\|gif\\|svg\\|png\\|ico\\|css\\|txt\\|pdf\\|webm\\|mp4\\|mp3\\|flac\\|mov"
|
---|
57 | :publishing-directory ,(concat current-folder "dist/public")
|
---|
58 | :recursive t
|
---|
59 | :publishing-function org-publish-attachment
|
---|
60 | )
|
---|
61 | ("blog-content"
|
---|
62 | :base-directory ,(concat current-folder "content")
|
---|
63 | :publishing-directory ,(concat current-folder "dist")
|
---|
64 | :recursive t
|
---|
65 | :publishing-function org-html-publish-to-html
|
---|
66 |
|
---|
67 | :html-doctype "html5"
|
---|
68 |
|
---|
69 | :with-title nil
|
---|
70 | :with-author t
|
---|
71 | :with-creator nil
|
---|
72 | :with-date t
|
---|
73 | :with-email t
|
---|
74 | :with-footnotes t
|
---|
75 | :html-html5-fancy t
|
---|
76 | :html-preamble "
|
---|
77 | <div class=\"navbar\">
|
---|
78 | <a href=\"/\" class=\"button logo\">~w96k</a>
|
---|
79 | <a class=\"button\" href=\"/articles.html\">Articles</a>
|
---|
80 | <a class=\"button\" href=\"/projects.html\">Projects</a>
|
---|
81 | <a class=\"button\" href=\"/music.html\">Music</a>
|
---|
82 | <a class=\"button\" href=\"/emacs.html\">Emacs</a>
|
---|
83 | <a class=\"button\" href=\"/guix.html\">Guix</a>
|
---|
84 | </div>"
|
---|
85 |
|
---|
86 | :html-head "
|
---|
87 | <link rel=\"shortcut icon\" href=\"/public/favicon.png\">
|
---|
88 | <link rel=\"stylesheet\" href=\"/public/css/mini.css\" type=\"text/css\"/>
|
---|
89 | <link rel=\"stylesheet\" href=\"/public/css/custom.css\" type=\"text/css\"/>
|
---|
90 | "
|
---|
91 |
|
---|
92 | :html-container "article"
|
---|
93 | :html-postamble "
|
---|
94 | <div class=\"row\">
|
---|
95 |
|
---|
96 | <div id=\"copyright\" class=\"col-sm-12 col-md-5\">
|
---|
97 | <p>Mikhail Kirillov © 2019-2022</p>
|
---|
98 | <p>
|
---|
99 | Works in <a href=\"https://anybrowser.org/campaign/\">any browser</a>
|
---|
100 | </p>
|
---|
101 | </div>
|
---|
102 |
|
---|
103 | <div align=\"center\" class=\"col-sm-12\ col-md-2\">
|
---|
104 | <p class=\"licenses\">
|
---|
105 | <a href=\"https://creativecommons.org/licenses/by/4.0/\">
|
---|
106 | <img alt=\"Creative Commons License\" src=\"/public/images/cc.png\" />
|
---|
107 | </a>
|
---|
108 | </p>
|
---|
109 | </div>
|
---|
110 |
|
---|
111 | <div class=\"col-sm-12 col-md-5\" id=\"meta\">
|
---|
112 | <p><span class=\"icon-settings\"></span> %c</p>
|
---|
113 | <p><span class=\"icon-calendar\"></span> %C</p>
|
---|
114 | </div>
|
---|
115 | </div>"
|
---|
116 |
|
---|
117 | :section-numbers nil
|
---|
118 | :with-sub-superscript nil
|
---|
119 |
|
---|
120 | ;; sitemap - list of blog articles
|
---|
121 | :auto-sitemap t
|
---|
122 | :sitemap-filename "sitemap.org"
|
---|
123 | :sitemap-title "@w96k"
|
---|
124 | :sitemap-sort-files chronologically)))
|
---|
125 |
|
---|
126 | ;; Don't ask for block evaluation
|
---|
127 | (setq org-confirm-babel-evaluate nil)
|
---|
128 |
|
---|
129 | ;; Set output folder
|
---|
130 | (setq httpd-root (concat current-folder "/dist/"))
|
---|
131 |
|
---|
132 | ;; Fix image width
|
---|
133 | (setq org-image-actual-width nil)
|
---|
134 |
|
---|
135 | ;; PDF output settings
|
---|
136 | (setq org-latex-listings 'minted)
|
---|
137 | (setq org-latex-tables-centered nil)
|
---|
138 | (add-to-list 'org-latex-packages-alist '("russian" "babel"))
|
---|
139 | (add-to-list 'org-latex-packages-alist '("" "minted"))
|
---|
140 | (add-to-list 'org-latex-packages-alist '("" "nopageno"))
|
---|
141 | (add-to-list 'org-latex-packages-alist '("utf8x" "inputenc"))
|
---|
142 | (add-to-list 'org-latex-packages-alist '("a4paper, margin=0.75in" "geometry"))
|
---|
143 |
|
---|
144 | (setq org-src-fontify-natively t)
|
---|
145 |
|
---|
146 |
|
---|