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 peertube-iframe-format
|
---|
13 | ;; You may want to change your width and height.
|
---|
14 | (concat "<iframe id=\"ivplayer\" type=\"text/html\""
|
---|
15 | "src=\"https://peervideo.ru/videos/embed/%s\""
|
---|
16 | " frameborder=\"0\""
|
---|
17 | " allowfullscreen>%s</iframe>"))
|
---|
18 |
|
---|
19 | (defvar youtube-iframe-format
|
---|
20 | ;; You may want to change your width and height.
|
---|
21 | (concat "<iframe id=\"ivplayer\" type=\"text/html\""
|
---|
22 | "src=\"https://yewtu.be/embed/%s\""
|
---|
23 | " frameborder=\"0\""
|
---|
24 | " allowfullscreen>%s</iframe>"))
|
---|
25 |
|
---|
26 | (defvar local-video-format
|
---|
27 | ;; You may want to change your width and height.
|
---|
28 | (concat "<video controls>"
|
---|
29 | "<source src=\"/public/videos/%s\"> Video are not supported </video>"))
|
---|
30 |
|
---|
31 | (org-add-link-type
|
---|
32 | "peertube"
|
---|
33 | (lambda (handle)
|
---|
34 | (browse-url
|
---|
35 | (concat "https://peervideo.ru/videos/embed/"
|
---|
36 | handle)))
|
---|
37 | (lambda (path desc backend)
|
---|
38 | (cl-case backend
|
---|
39 | (html (format peertube-iframe-format
|
---|
40 | path (or desc "")))
|
---|
41 | (latex (format "\href{%s}{%s}"
|
---|
42 | path (or desc "video"))))))
|
---|
43 |
|
---|
44 | (org-add-link-type
|
---|
45 | "youtube"
|
---|
46 | (lambda (handle)
|
---|
47 | (browse-url
|
---|
48 | (concat "https://invidiou.site/embed/"
|
---|
49 | handle)))
|
---|
50 | (lambda (path desc backend)
|
---|
51 | (cl-case backend
|
---|
52 | (html (format youtube-iframe-format
|
---|
53 | path (or desc "")))
|
---|
54 | (latex (format "\href{%s}{%s}"
|
---|
55 | path (or desc "video"))))))
|
---|
56 |
|
---|
57 | (org-add-link-type
|
---|
58 | "video"
|
---|
59 | (lambda (handle)
|
---|
60 | (browse-url
|
---|
61 | (concat "/"
|
---|
62 | handle)))
|
---|
63 | (lambda (path desc backend)
|
---|
64 | (cl-case backend
|
---|
65 | (html (format local-video-format
|
---|
66 | path (or desc "")))
|
---|
67 | (latex (format "\href{%s}{%s}"
|
---|
68 | path (or desc "video"))))))
|
---|
69 |
|
---|
70 | (setq org-publish-project-alist
|
---|
71 | `(("blog"
|
---|
72 | :components ("blog-content" "blog-styles")
|
---|
73 | :base-directory current-folder)
|
---|
74 | ("blog-styles"
|
---|
75 | :base-directory ,(concat current-folder "public")
|
---|
76 | :base-extension "jpg\\|webp\\|gif\\|svg\\|png\\|ico\\|css\\|txt\\|pdf\\|webm\\|mp4\\|mp3\\|flac\\|mov"
|
---|
77 | :publishing-directory ,(concat current-folder "dist/public")
|
---|
78 | :recursive t
|
---|
79 | :publishing-function org-publish-attachment
|
---|
80 | )
|
---|
81 | ("blog-content"
|
---|
82 | :base-directory ,(concat current-folder "content")
|
---|
83 | :publishing-directory ,(concat current-folder "dist")
|
---|
84 | :recursive t
|
---|
85 | :publishing-function org-html-publish-to-html
|
---|
86 |
|
---|
87 | :html-doctype "html5"
|
---|
88 |
|
---|
89 | :with-title nil
|
---|
90 | :with-author t
|
---|
91 | :with-creator nil
|
---|
92 | :with-date t
|
---|
93 | :with-email t
|
---|
94 | :with-footnotes t
|
---|
95 | :html-html5-fancy t
|
---|
96 | :html-preamble "
|
---|
97 | <header class=\"navbar\">
|
---|
98 | <a href=\"/\" class=\"button logo\">~w96k</a>
|
---|
99 | <a class=\"button\" href=\"/cv.html\">CV</a>
|
---|
100 | </header>"
|
---|
101 |
|
---|
102 | :html-head "
|
---|
103 | <link rel=\"shortcut icon\" href=\"/public/favicon.png\">
|
---|
104 | <link rel=\"stylesheet\" href=\"/public/css/mini.css\" type=\"text/css\"/>
|
---|
105 | <link rel=\"stylesheet\" href=\"/public/css/custom.css\" type=\"text/css\"/>
|
---|
106 | "
|
---|
107 |
|
---|
108 | :html-container "article"
|
---|
109 | :html-postamble "
|
---|
110 | <div class=\"row\">
|
---|
111 |
|
---|
112 | <div id=\"copyright\" class=\"col-sm-12 col-md-4\">
|
---|
113 | <p>Mikhail Kirillov © 2019-2022</p>
|
---|
114 | <p style=\"style=\"opacity: 0.7;\">
|
---|
115 | Works in <a href=\"https://anybrowser.org/campaign/\">any browser</a>
|
---|
116 | </p>
|
---|
117 | </div>
|
---|
118 |
|
---|
119 | <div class=\"col-sm-12 col-md-3\">
|
---|
120 | <p class=\"licenses\">
|
---|
121 | <a href=\"https://creativecommons.org/licenses/by/4.0/\">
|
---|
122 | <img alt=\"Creative Commons License\" src=\"/public/images/cc.png\" />
|
---|
123 | </a>
|
---|
124 | <!--
|
---|
125 | <a href=\"https://www.gnu.org/licenses/gpl-3.0.txt\">
|
---|
126 | <img src=\"/public/images/gpl.png\">
|
---|
127 | </a>
|
---|
128 | -->
|
---|
129 | </p>
|
---|
130 | </div>
|
---|
131 |
|
---|
132 | <div class=\"col-sm-12 col-md-5\" id=\"meta\">
|
---|
133 | <p><span class=\"icon-settings\"></span> %c</p>
|
---|
134 | <p><span class=\"icon-calendar\"></span> %C</p>
|
---|
135 | </div>
|
---|
136 | </div>
|
---|
137 |
|
---|
138 | <br>
|
---|
139 | <div align=\"center\">
|
---|
140 | <small>
|
---|
141 | <p>The content is distributed under license
|
---|
142 | <a href=\"https://creativecommons.org/licenses/by-sa/4.0/deed.en\">
|
---|
143 | Creative Commons «Attribution-ShareAlike» 4.0 International (CC BY-SA 4.0)
|
---|
144 | </a>
|
---|
145 | </p>
|
---|
146 | </small>
|
---|
147 | </div>"
|
---|
148 |
|
---|
149 | :section-numbers nil
|
---|
150 | :with-sub-superscript nil
|
---|
151 |
|
---|
152 | ;; sitemap - list of blog articles
|
---|
153 | :auto-sitemap t
|
---|
154 | :sitemap-filename "sitemap.org"
|
---|
155 | :sitemap-title "@w96k"
|
---|
156 | :sitemap-sort-files chronologically)))
|
---|
157 |
|
---|
158 | ;; Don't ask for block evaluation
|
---|
159 | (setq org-confirm-babel-evaluate nil)
|
---|
160 |
|
---|
161 | ;; Set output folder
|
---|
162 | (setq httpd-root (concat current-folder "/dist/"))
|
---|
163 |
|
---|
164 | ;; Fix image width
|
---|
165 | (setq org-image-actual-width nil)
|
---|
166 |
|
---|
167 | ;; PDF output settings
|
---|
168 | (setq org-latex-listings 'minted)
|
---|
169 | (setq org-latex-tables-centered nil)
|
---|
170 | (add-to-list 'org-latex-packages-alist '("russian" "babel"))
|
---|
171 | (add-to-list 'org-latex-packages-alist '("" "minted"))
|
---|
172 | (add-to-list 'org-latex-packages-alist '("" "nopageno"))
|
---|
173 | (add-to-list 'org-latex-packages-alist '("utf8x" "inputenc"))
|
---|
174 | (add-to-list 'org-latex-packages-alist '("a4paper, margin=0.75in" "geometry"))
|
---|
175 |
|
---|
176 | (setq org-src-fontify-natively t)
|
---|
177 |
|
---|
178 |
|
---|