source: .emacs@ 29d69bd

Last change on this file since 29d69bd was 29d69bd, checked in by Mikhail Kirillov <w96k@…>, on Aug 29, 2022 at 1:21:58 AM

Optimize website even more

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