[a8435cf] | 1 | ;;; Emacs configuration for building a project
|
---|
| 2 |
|
---|
| 3 | (require 'org)
|
---|
| 4 | (require 'ox-publish)
|
---|
[54096f7] | 5 | (require 'ox-latex)
|
---|
[eb2627e] | 6 | ;; (require 'org-webring)
|
---|
[a8435cf] | 7 | (require 's)
|
---|
| 8 | (require 'simple-httpd)
|
---|
| 9 |
|
---|
[29d69bd] | 10 |
|
---|
| 11 | (setq org-html-head-include-default-style nil)
|
---|
[c721284] | 12 |
|
---|
[545c76e] | 13 | (setq current-folder (file-truename "./"))
|
---|
| 14 |
|
---|
[35e1834] | 15 | (defvar youtube-iframe-format
|
---|
| 16 | ;; You may want to change your width and height.
|
---|
| 17 | (concat "<iframe id=\"ivplayer\" type=\"text/html\""
|
---|
[6596178] | 18 | "src=\"https://youtube.host.w96k.dev/embed/%s\""
|
---|
[35e1834] | 19 | " frameborder=\"0\""
|
---|
| 20 | " allowfullscreen>%s</iframe>"))
|
---|
| 21 |
|
---|
[e66c095] | 22 | (defvar local-video-format
|
---|
| 23 | ;; You may want to change your width and height.
|
---|
| 24 | (concat "<video controls>"
|
---|
| 25 | "<source src=\"/public/videos/%s\"> Video are not supported </video>"))
|
---|
| 26 |
|
---|
[35e1834] | 27 | (org-add-link-type
|
---|
| 28 | "youtube"
|
---|
| 29 | (lambda (handle)
|
---|
| 30 | (browse-url
|
---|
| 31 | (concat "https://invidiou.site/embed/"
|
---|
| 32 | handle)))
|
---|
| 33 | (lambda (path desc backend)
|
---|
| 34 | (cl-case backend
|
---|
| 35 | (html (format youtube-iframe-format
|
---|
| 36 | path (or desc "")))
|
---|
| 37 | (latex (format "\href{%s}{%s}"
|
---|
| 38 | path (or desc "video"))))))
|
---|
| 39 |
|
---|
[e66c095] | 40 | (org-add-link-type
|
---|
| 41 | "video"
|
---|
| 42 | (lambda (handle)
|
---|
| 43 | (browse-url
|
---|
| 44 | (concat "/"
|
---|
| 45 | handle)))
|
---|
| 46 | (lambda (path desc backend)
|
---|
| 47 | (cl-case backend
|
---|
| 48 | (html (format local-video-format
|
---|
| 49 | path (or desc "")))
|
---|
| 50 | (latex (format "\href{%s}{%s}"
|
---|
| 51 | path (or desc "video"))))))
|
---|
| 52 |
|
---|
[a8435cf] | 53 | (setq org-publish-project-alist
|
---|
| 54 | `(("blog"
|
---|
| 55 | :components ("blog-content" "blog-styles")
|
---|
[545c76e] | 56 | :base-directory current-folder)
|
---|
[a8435cf] | 57 | ("blog-styles"
|
---|
[545c76e] | 58 | :base-directory ,(concat current-folder "public")
|
---|
[fc511b3] | 59 | :base-extension "jpg\\|webp\\|gif\\|svg\\|png\\|ico\\|css\\|txt\\|pdf\\|webm\\|mp4\\|mp3\\|flac\\|mov\\|html"
|
---|
[545c76e] | 60 | :publishing-directory ,(concat current-folder "dist/public")
|
---|
[a8435cf] | 61 | :recursive t
|
---|
| 62 | :publishing-function org-publish-attachment
|
---|
| 63 | )
|
---|
| 64 | ("blog-content"
|
---|
[545c76e] | 65 | :base-directory ,(concat current-folder "content")
|
---|
| 66 | :publishing-directory ,(concat current-folder "dist")
|
---|
[a8435cf] | 67 | :recursive t
|
---|
| 68 | :publishing-function org-html-publish-to-html
|
---|
| 69 |
|
---|
[e66c095] | 70 | :html-doctype "html5"
|
---|
[962709f] | 71 | :exclude ".*/logsec/.*"
|
---|
[a8435cf] | 72 |
|
---|
| 73 | :with-title nil
|
---|
| 74 | :with-author t
|
---|
| 75 | :with-creator nil
|
---|
| 76 | :with-date t
|
---|
| 77 | :with-email t
|
---|
| 78 | :with-footnotes t
|
---|
| 79 | :html-preamble "
|
---|
[8ff16b8] | 80 | <div class=\"navbar\">
|
---|
[1d577b1] | 81 | <a href=\"/\">~w96k</a>
|
---|
[0fd65e0] | 82 | <a href=\"/about.html\">About</a>
|
---|
[1d577b1] | 83 | <a href=\"/articles.html\">Articles</a>
|
---|
[df6c052] | 84 | <a href=\"/donate.html\">Donations</a>
|
---|
[8ff16b8] | 85 | </div>"
|
---|
[a8435cf] | 86 |
|
---|
| 87 | :html-head "
|
---|
[1d577b1] | 88 | <link rel=\"shortcut icon\" href=\"/public/favicon_w96k.ico\">
|
---|
[a8435cf] | 89 | <link rel=\"stylesheet\" href=\"/public/css/custom.css\" type=\"text/css\"/>
|
---|
| 90 | "
|
---|
| 91 |
|
---|
| 92 | :html-container "article"
|
---|
| 93 | :html-postamble "
|
---|
[1d577b1] | 94 |
|
---|
[0e7db91] | 95 | <p>No rights reserved</p>
|
---|
[1d577b1] | 96 |
|
---|
[5d02e41] | 97 | <ul>
|
---|
| 98 | <li>
|
---|
| 99 | <a href=\"/legal.html\">
|
---|
| 100 | License
|
---|
| 101 | </a>
|
---|
| 102 | </li>
|
---|
| 103 | <li>
|
---|
| 104 | <a href=\"/sitemap.html\">
|
---|
| 105 | Sitemap
|
---|
| 106 | </a>
|
---|
| 107 | </li>
|
---|
| 108 | </ul>
|
---|
[a8435cf] | 109 |
|
---|
[1d577b1] | 110 |
|
---|
| 111 | <p id=\"meta\">
|
---|
| 112 | %C
|
---|
| 113 | </p>"
|
---|
[a8435cf] | 114 |
|
---|
| 115 | :section-numbers nil
|
---|
| 116 | :with-sub-superscript nil
|
---|
| 117 |
|
---|
| 118 | ;; sitemap - list of blog articles
|
---|
| 119 | :auto-sitemap t
|
---|
| 120 | :sitemap-filename "sitemap.org"
|
---|
| 121 | :sitemap-title "@w96k"
|
---|
[9742500] | 122 | :sitemap-sort-files chronologically)))
|
---|
[a8435cf] | 123 |
|
---|
| 124 | ;; Don't ask for block evaluation
|
---|
| 125 | (setq org-confirm-babel-evaluate nil)
|
---|
| 126 |
|
---|
| 127 | ;; Set output folder
|
---|
[545c76e] | 128 | (setq httpd-root (concat current-folder "/dist/"))
|
---|
[c43e516] | 129 |
|
---|
[54096f7] | 130 | ;; Fix image width
|
---|
[c43e516] | 131 | (setq org-image-actual-width nil)
|
---|
[54096f7] | 132 |
|
---|
| 133 | ;; PDF output settings
|
---|
| 134 | (setq org-latex-listings 'minted)
|
---|
| 135 | (setq org-latex-tables-centered nil)
|
---|
| 136 | (add-to-list 'org-latex-packages-alist '("russian" "babel"))
|
---|
| 137 | (add-to-list 'org-latex-packages-alist '("" "minted"))
|
---|
| 138 | (add-to-list 'org-latex-packages-alist '("" "nopageno"))
|
---|
| 139 | (add-to-list 'org-latex-packages-alist '("utf8x" "inputenc"))
|
---|
| 140 | (add-to-list 'org-latex-packages-alist '("a4paper, margin=0.75in" "geometry"))
|
---|
| 141 |
|
---|
[e66c095] | 142 | (setq org-src-fontify-natively t)
|
---|
| 143 |
|
---|
| 144 |
|
---|