summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-12-29 15:51:49 +0100
committerVolpeon <git@volpeon.ink>2021-12-29 15:51:49 +0100
commit312015e8f74ca1738e7160e5d66cad9dcb07c6fd (patch)
tree0fa7922b190e22bfd82627d4b65552a981cd0340
parentSupport for more complex layouts (diff)
downloadvolpeon.ink-312015e8f74ca1738e7160e5d66cad9dcb07c6fd.tar.gz
volpeon.ink-312015e8f74ca1738e7160e5d66cad9dcb07c6fd.tar.bz2
volpeon.ink-312015e8f74ca1738e7160e5d66cad9dcb07c6fd.zip
Initial gallery macro
-rw-r--r--assets/css/components/_gallery.scss25
-rw-r--r--assets/css/components/_header.scss9
-rw-r--r--assets/css/objects/_icon.scss2
-rw-r--r--assets/css/style.scss1
-rw-r--r--content/projects/drawings/2021-refsheet/index.md4
-rw-r--r--filters/macros.lua36
-rw-r--r--templates/base.html2
-rw-r--r--templates/layouts/gallery.html11
8 files changed, 72 insertions, 18 deletions
diff --git a/assets/css/components/_gallery.scss b/assets/css/components/_gallery.scss
new file mode 100644
index 0000000..651d873
--- /dev/null
+++ b/assets/css/components/_gallery.scss
@@ -0,0 +1,25 @@
1@include namespace('gallery') {
2 @include store((
3 --dims: (
4 --col-width: 17em
5 )
6 ));
7
8 @include component(namespace()) {
9 margin-top: $line-height * 1rem;
10
11 @include element('items') {
12 display: grid;
13 grid-template-columns: repeat(auto-fill, minmax(#{prop(--dims --col-width)}, 1fr));
14 gap: 20px;
15 }
16
17 @include element('item') {
18 display: block;
19 }
20
21 @include element('img') {
22 display: block;
23 }
24 }
25}
diff --git a/assets/css/components/_header.scss b/assets/css/components/_header.scss
index 56d09cd..60f4e05 100644
--- a/assets/css/components/_header.scss
+++ b/assets/css/components/_header.scss
@@ -70,10 +70,19 @@
70 height: prop(--dims --icon); 70 height: prop(--dims --icon);
71 } 71 }
72 72
73 @include modifier('fixed') {
74 position: fixed;
75 }
76
73 @include media('>=lg') { 77 @include media('>=lg') {
74 position: sticky; 78 position: sticky;
79 z-index: 100;
75 top: 0; 80 top: 0;
76 margin-bottom: calc(-.75 * #{prop(--dims --height)}); 81 margin-bottom: calc(-.75 * #{prop(--dims --height)});
82
83 @include modifier('fixed') {
84 position: fixed;
85 }
77 } 86 }
78 87
79 @media print { 88 @media print {
diff --git a/assets/css/objects/_icon.scss b/assets/css/objects/_icon.scss
index f80f422..53f6f78 100644
--- a/assets/css/objects/_icon.scss
+++ b/assets/css/objects/_icon.scss
@@ -20,7 +20,7 @@
20 20
21 @include modifier('snow') { 21 @include modifier('snow') {
22 position: fixed; 22 position: fixed;
23 z-index: 9999; 23 z-index: 1000;
24 top: -1.2em; 24 top: -1.2em;
25 width: 1em; 25 width: 1em;
26 height: 1em; 26 height: 1em;
diff --git a/assets/css/style.scss b/assets/css/style.scss
index db2d4cb..45b733d 100644
--- a/assets/css/style.scss
+++ b/assets/css/style.scss
@@ -17,6 +17,7 @@
17@import 'components/footer'; 17@import 'components/footer';
18@import 'components/card'; 18@import 'components/card';
19@import 'components/note'; 19@import 'components/note';
20@import 'components/gallery';
20 21
21@import 'layouts/card-list'; 22@import 'layouts/card-list';
22 23
diff --git a/content/projects/drawings/2021-refsheet/index.md b/content/projects/drawings/2021-refsheet/index.md
index 2163fac..696abe5 100644
--- a/content/projects/drawings/2021-refsheet/index.md
+++ b/content/projects/drawings/2021-refsheet/index.md
@@ -4,8 +4,8 @@ date: 2021-10-06
4thumbnail: png 4thumbnail: png
5--- 5---
6 6
7::: gallery
7![](bottom.png) 8![](bottom.png)
8
9![](bottom_cofe.png) 9![](bottom_cofe.png)
10
11![](side.png) 10![](side.png)
11:::
diff --git a/filters/macros.lua b/filters/macros.lua
index 9e9d954..dc04cfd 100644
--- a/filters/macros.lua
+++ b/filters/macros.lua
@@ -1,7 +1,39 @@
1function note(el)
2 el.classes = pandoc.List()
3 el.classes:insert("c-note")
4 return el
5end
6
7function gallery(el)
8 el.classes = pandoc.List()
9 el.classes:insert("c-gallery")
10
11 local cur = pandoc.Div(pandoc.List(), { class = "c-gallery__current" })
12 local imageList = pandoc.Div(pandoc.List(), { class = "c-gallery__items" })
13
14 pandoc.walk_block(el, {
15 Image = function(iel)
16 iel.classes = pandoc.List()
17 iel.classes:insert("c-gallery__img")
18
19 local lel = pandoc.Link(iel, iel.src)
20 lel.classes = pandoc.List()
21 lel.classes:insert("c-gallery__item")
22
23 imageList.content:insert(lel)
24 end,
25 })
26
27 el.content = { cur, imageList }
28
29 return el
30end
31
1function Div(el) 32function Div(el)
2 if el.classes:includes("note") then 33 if el.classes:includes("note") then
3 el.classes = pandoc.List() 34 el = note(el)
4 el.classes:insert("c-note") 35 elseif el.classes:includes("gallery") then
36 el = gallery(el)
5 end 37 end
6 38
7 return el 39 return el
diff --git a/templates/base.html b/templates/base.html
index 252069a..22ff913 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -69,8 +69,6 @@ ${layouts/categorized_list()}
69${layouts/list()} 69${layouts/list()}
70 $elseif(layout.is_redirect)$ 70 $elseif(layout.is_redirect)$
71${layouts/redirect()} 71${layouts/redirect()}
72 $elseif(layout.is_gallery)$
73${layouts/gallery()}
74 $else$ 72 $else$
75${layouts/page()} 73${layouts/page()}
76 $endif$ 74 $endif$
diff --git a/templates/layouts/gallery.html b/templates/layouts/gallery.html
deleted file mode 100644
index 46c47a6..0000000
--- a/templates/layouts/gallery.html
+++ /dev/null
@@ -1,11 +0,0 @@
1<article class="s-body s-colored-links s-headlines $if(intro)$s-intro$endif$">
2 $if(date)$
3 <div class="s-body__meta">
4 $date.long$
5 </div>
6 $endif$
7
8 <h1 class="u-mt0"><span class="s-headlines__title-inner">$title$</span></h1>
9
10$body$
11</article>