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 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 | "peertube"
|
---|
26 | (lambda (handle)
|
---|
27 | (browse-url
|
---|
28 | (concat "https://peervideo.ru/videos/embed/"
|
---|
29 | handle)))
|
---|
30 | (lambda (path desc backend)
|
---|
31 | (cl-case backend
|
---|
32 | (html (format peertube-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\\|gif\\|svg\\|png\\|ico\\|css\\|txt\\|pdf\\|webm\\|mp4"
|
---|
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 | <header class=\"navbar\">
|
---|
78 | <a href=\"/\" class=\"logo\">@w96k</a>
|
---|
79 | <a class=\"button\" href=\"/about.html\">Обо мне</a>
|
---|
80 | </header>"
|
---|
81 |
|
---|
82 | :html-head "
|
---|
83 | <link rel=\"shortcut icon\" href=\"/public/favicon.png\">
|
---|
84 | <link rel=\"stylesheet\" href=\"/public/css/mini.css\" type=\"text/css\"/>
|
---|
85 | <link rel=\"stylesheet\" href=\"/public/css/custom.css\" type=\"text/css\"/>
|
---|
86 | "
|
---|
87 |
|
---|
88 | :html-container "article"
|
---|
89 | :html-postamble "
|
---|
90 | <div class=\"row\">
|
---|
91 | <div class=\"col-sm-12 col-md-4\">
|
---|
92 | <p class=\"licenses\">
|
---|
93 | <a href=\"https://creativecommons.org/licenses/by/4.0/\">
|
---|
94 | <img alt=\"Лицензия Creative Commons\" src=\"/public/images/cc.png\" />
|
---|
95 | </a>
|
---|
96 | <a href=\"https://www.gnu.org/licenses/gpl-3.0.txt\">
|
---|
97 | <img src=\"/public/images/gpl.png\">
|
---|
98 | </a>
|
---|
99 | </p>
|
---|
100 | </div>
|
---|
101 |
|
---|
102 | <div id=\"copyright\" class=\"col-sm-12 col-md-4\">
|
---|
103 | <p>© 2019-2021 <i>Mikhail Kirillov</i></p>
|
---|
104 | <p>
|
---|
105 | Сайт работает в <a href=\"https://anybrowser.org/campaign/\">любом браузере</a>
|
---|
106 | </p>
|
---|
107 | </div>
|
---|
108 |
|
---|
109 | <div class=\"col-sm-12 col-md-4\" id=\"meta\">
|
---|
110 | <p><span class=\"icon-settings\"></span> %c</p>
|
---|
111 | <p><span class=\"icon-calendar\"></span> %C</p>
|
---|
112 | </div>
|
---|
113 | </div>
|
---|
114 |
|
---|
115 | <br>
|
---|
116 | <div align=\"center\">
|
---|
117 | <small>
|
---|
118 | <p>Содержимое доступно по лицензии
|
---|
119 | <a href=\"https://creativecommons.org/licenses/by-sa/4.0/deed.ru\">
|
---|
120 | Creative Commons «Attribution-ShareAlike» («Атрибуция — На тех же условиях») 4.0 Всемирная (CC BY-SA 4.0)
|
---|
121 | </a>
|
---|
122 | </p>
|
---|
123 | <p>Исходный код доступен по лицензии GNU General Public License Version 3</p>
|
---|
124 | <p><a href=\"/legal.html\">Подробнее о правах</a></p>
|
---|
125 | </small>
|
---|
126 | </div>"
|
---|
127 |
|
---|
128 | :section-numbers nil
|
---|
129 | :with-sub-superscript nil
|
---|
130 |
|
---|
131 | ;; sitemap - list of blog articles
|
---|
132 | :auto-sitemap t
|
---|
133 | :sitemap-filename "sitemap.org"
|
---|
134 | :sitemap-title "@w96k"
|
---|
135 | :sitemap-sort-files chronologically)))
|
---|
136 |
|
---|
137 | ;; Don't ask for block evaluation
|
---|
138 | (setq org-confirm-babel-evaluate nil)
|
---|
139 |
|
---|
140 | ;; Set output folder
|
---|
141 | (setq httpd-root (concat current-folder "/dist/"))
|
---|
142 |
|
---|
143 | ;; Fix image width
|
---|
144 | (setq org-image-actual-width nil)
|
---|
145 |
|
---|
146 | ;; PDF output settings
|
---|
147 | (setq org-latex-listings 'minted)
|
---|
148 | (setq org-latex-tables-centered nil)
|
---|
149 | (add-to-list 'org-latex-packages-alist '("russian" "babel"))
|
---|
150 | (add-to-list 'org-latex-packages-alist '("" "minted"))
|
---|
151 | (add-to-list 'org-latex-packages-alist '("" "nopageno"))
|
---|
152 | (add-to-list 'org-latex-packages-alist '("utf8x" "inputenc"))
|
---|
153 | (add-to-list 'org-latex-packages-alist '("a4paper, margin=0.75in" "geometry"))
|
---|
154 |
|
---|
155 | (setq org-src-fontify-natively t)
|
---|
156 |
|
---|
157 |
|
---|