summaryrefslogtreecommitdiffstats
path: root/publish.el
blob: 76019f506a0ed8770334e73297f72fe7ffc68201 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
(require 'package)
(package-initialize)

(require 'org)
(require 'org-id)
(require 'ox-publish)
(require 'ox-html)
(require 'oc)
(require 'oc-basic)
(require 'cl-lib)
(require 'gnuplot)
(require 'gnuplot-mode)
(require 'ob)
(require 'ob-gnuplot)

(org-babel-do-load-languages
 'org-babel-load-languages '((gnuplot . t)))

(setq org-confirm-babel-evaluate nil)

(setq org-html-coding-system 'utf-8-unix)

(defconst ymhg-notes-dir (file-name-directory (or load-file-name buffer-file-name)))

(defconst site-attachments
      (regexp-opt '("jpg" "jpeg" "gif" "png" "svg"
                    "ico" "cur" "css" "js" "woff" "html" "pdf" "js")))

(setq org-publish-project-alist
      (list
       (list "ymhg-notes-org"
             :base-directory (concat ymhg-notes-dir "notes")
             :base-extension "org"
             :publishing-function #'org-html-publish-to-html
             :publishing-directory (concat ymhg-notes-dir "public")
             :exclude (regexp-opt '("README" "draft"))
             :auto-sitemap t
             :sitemap-filename (concat ymhg-notes-dir "notes/index.org")
             :sitemap-file-entry-format "%d *%t*"
             :sitemap-title "Yann's Notes"
             :html-html5-fancy t
             :html-divs '((preamble "header" "header")
                      (content "article" "content")
                      (postamble "footer" "postamble"))
             :html-container "section"
             :html-metadata-timestamp-format "%Y-%m-%d"
             :html-checkbox-type 'html
             :html-doctype "html5"
             :html-head-include-default-style nil
             :html-table-caption-above t
             :html-postamble "<ul>
<li>© 2022 <a href=\"https://yannherklotz.com\">Yann Herklotz</a></li>
<li><a href=\"https://creativecommons.org/licenses/by-sa/4.0/\">CC BY-SA 4.0</a></li></ul>"
             :html-head "<style>
body { margin: 0; font-family: monospace; }
.title {
  text-align:center;
  font-size:2.5em;
}
.outline-text-2 {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  background-color: #d3d5ef;
  text-align: center;
  padding: 2rem 10rem;
}
.outline-text-2 > * {
  margin: 1rem auto;
}
table { border-collapse: collapse; }
img { max-width:100%; }
table {
  margin-top:2rem;
  margin-right:2rem;
}
table > :is(thead, tbody) > tr > :is(th, td) {
  padding: 3px;
  text-align: left;
}
table > thead > tr > :is(th, td) {
  border-top: 2px solid;
  border-bottom: 1px solid;
}
table > tbody > tr:last-child > :is(th, td) { border-bottom: 2px solid; }
h2, h3, h4, h5, h6, p, ul {
  max-width: 50rem;
  margin: 1rem auto;
}
#postamble { padding: 1.5rem 0; text-align: center; }
#postamble ul li { display: inline-block; }
#postamble ul { padding: 0; }
#postamble li { margin-right: 2em; }</style>")
       (list "ymhg-notes-static"
             :base-directory (concat ymhg-notes-dir "notes/static")
             :include '()
             :exclude "assets/\\|public/\\|README.md"
             :base-extension site-attachments
             :publishing-directory (concat ymhg-notes-dir "public/static")
             :publishing-function #'org-publish-attachment
             :recursive t)
       (list "ymhg-notes" :components '("ymhg-notes-org" "ymhg-notes-static"))))