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\\|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=\"/about.html\">whoami</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 | <div class=\"col-sm-12 col-md-4\">
|
---|
112 | <p class=\"licenses\">
|
---|
113 | <a href=\"https://creativecommons.org/licenses/by/4.0/\">
|
---|
114 | <img alt=\"Лицензия Creative Commons\" src=\"/public/images/cc.png\" />
|
---|
115 | </a>
|
---|
116 | <a href=\"https://www.gnu.org/licenses/gpl-3.0.txt\">
|
---|
117 | <img src=\"/public/images/gpl.png\">
|
---|
118 | </a>
|
---|
119 | </p>
|
---|
120 | </div>
|
---|
121 |
|
---|
122 | <div id=\"copyright\" class=\"col-sm-12 col-md-4\">
|
---|
123 | <p>© 2019-2021 <i>Mikhail Kirillov</i></p>
|
---|
124 | <p>
|
---|
125 | Сайт работает в <a href=\"https://anybrowser.org/campaign/\">любом браузере</a>
|
---|
126 | </p>
|
---|
127 | </div>
|
---|
128 |
|
---|
129 | <div class=\"col-sm-12 col-md-4\" id=\"meta\">
|
---|
130 | <p><span class=\"icon-settings\"></span> %c</p>
|
---|
131 | <p><span class=\"icon-calendar\"></span> %C</p>
|
---|
132 | </div>
|
---|
133 | </div>
|
---|
134 |
|
---|
135 | <br>
|
---|
136 | <div align=\"center\">
|
---|
137 | <small>
|
---|
138 | <p>Содержимое доступно по лицензии
|
---|
139 | <a href=\"https://creativecommons.org/licenses/by-sa/4.0/deed.ru\">
|
---|
140 | Creative Commons «Attribution-ShareAlike» 4.0 Всемирная (CC BY-SA 4.0)
|
---|
141 | </a>
|
---|
142 | </p>
|
---|
143 | <p>Исходный код доступен по лицензии
|
---|
144 | <a href=\"https://www.gnu.org/licenses/gpl-3.0.ru.html\">
|
---|
145 | GNU General Public License Version 3
|
---|
146 | </a>
|
---|
147 | </p>
|
---|
148 | <p><a href=\"/legal.html\">Подробнее о правах</a></p>
|
---|
149 | </small>
|
---|
150 | </div>"
|
---|
151 |
|
---|
152 | :section-numbers nil
|
---|
153 | :with-sub-superscript nil
|
---|
154 |
|
---|
155 | ;; sitemap - list of blog articles
|
---|
156 | :auto-sitemap t
|
---|
157 | :sitemap-filename "sitemap.org"
|
---|
158 | :sitemap-title "@w96k"
|
---|
159 | :sitemap-sort-files chronologically)))
|
---|
160 |
|
---|
161 | ;; Don't ask for block evaluation
|
---|
162 | (setq org-confirm-babel-evaluate nil)
|
---|
163 |
|
---|
164 | ;; Set output folder
|
---|
165 | (setq httpd-root (concat current-folder "/dist/"))
|
---|
166 |
|
---|
167 | ;; Fix image width
|
---|
168 | (setq org-image-actual-width nil)
|
---|
169 |
|
---|
170 | ;; PDF output settings
|
---|
171 | (setq org-latex-listings 'minted)
|
---|
172 | (setq org-latex-tables-centered nil)
|
---|
173 | (add-to-list 'org-latex-packages-alist '("russian" "babel"))
|
---|
174 | (add-to-list 'org-latex-packages-alist '("" "minted"))
|
---|
175 | (add-to-list 'org-latex-packages-alist '("" "nopageno"))
|
---|
176 | (add-to-list 'org-latex-packages-alist '("utf8x" "inputenc"))
|
---|
177 | (add-to-list 'org-latex-packages-alist '("a4paper, margin=0.75in" "geometry"))
|
---|
178 |
|
---|
179 | (setq org-src-fontify-natively t)
|
---|
180 |
|
---|
181 |
|
---|