source: .emacs@ 1d577b1

Last change on this file since 1d577b1 was 1d577b1, checked in by Mikhail Kirillov <w96k@…>, on Aug 29, 2022 at 12:53:28 AM

Optimize website

  • 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(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-preamble "
76<div class=\"navbar\">
77<a href=\"/\">~w96k</a>
78<a href=\"/articles.html\">Articles</a>
79<a href=\"/projects.html\">Projects</a>
80<a href=\"/music.html\">Music</a>
81<a href=\"/emacs.html\">Emacs</a>
82<a href=\"/guix.html\">Guix</a>
83</div>"
84
85 :html-head "
86<link rel=\"shortcut icon\" href=\"/public/favicon_w96k.ico\">
87<link rel=\"stylesheet\" href=\"/public/css/custom.css\" type=\"text/css\"/>
88"
89
90 :html-container "article"
91 :html-postamble "
92
93 <p>Mikhail Kirillov © 2019-2022</p>
94
95 <p>
96 <a href=\"/legal.html\">
97 License
98 </a>
99 </p>
100
101
102 <p id=\"meta\">
103 %C
104 </p>"
105
106 :section-numbers nil
107 :with-sub-superscript nil
108
109 ;; sitemap - list of blog articles
110 :auto-sitemap t
111 :sitemap-filename "sitemap.org"
112 :sitemap-title "@w96k"
113 :sitemap-sort-files chronologically)))
114
115;; Don't ask for block evaluation
116(setq org-confirm-babel-evaluate nil)
117
118;; Set output folder
119(setq httpd-root (concat current-folder "/dist/"))
120
121;; Fix image width
122(setq org-image-actual-width nil)
123
124;; PDF output settings
125(setq org-latex-listings 'minted)
126(setq org-latex-tables-centered nil)
127(add-to-list 'org-latex-packages-alist '("russian" "babel"))
128(add-to-list 'org-latex-packages-alist '("" "minted"))
129(add-to-list 'org-latex-packages-alist '("" "nopageno"))
130(add-to-list 'org-latex-packages-alist '("utf8x" "inputenc"))
131(add-to-list 'org-latex-packages-alist '("a4paper, margin=0.75in" "geometry"))
132
133(setq org-src-fontify-natively t)
134
135
Note: See TracBrowser for help on using the repository browser.