summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-01-08 11:45:30 +0100
committerVolpeon <git@volpeon.ink>2021-01-08 11:45:30 +0100
commit8f373e6c6d3f9d322041ba4d949c1b0c39ae8ea0 (patch)
tree3e4bd8c26b65a073d4580bc9f0076caceb234ce8
parentOptimized CSS for code blocks (diff)
downloadvolpeon.ink-8f373e6c6d3f9d322041ba4d949c1b0c39ae8ea0.tar.gz
volpeon.ink-8f373e6c6d3f9d322041ba4d949c1b0c39ae8ea0.tar.bz2
volpeon.ink-8f373e6c6d3f9d322041ba4d949c1b0c39ae8ea0.zip
Added section link to the header in regular pages, improved template structure, improved CSS variable names, keep prefix for specific page items on mobile
-rw-r--r--.stylelintrc.json2
-rw-r--r--assets/css/_vars.scss9
-rw-r--r--assets/css/components/_nav.scss2
-rw-r--r--assets/css/components/_page.scss95
-rw-r--r--assets/css/layouts/_container.scss8
-rw-r--r--scripts/metadata_filter.lua14
-rw-r--r--templates/base.html14
-rw-r--r--templates/layouts/dated_list.html37
-rw-r--r--templates/layouts/index.html28
-rw-r--r--templates/layouts/page.html32
10 files changed, 145 insertions, 96 deletions
diff --git a/.stylelintrc.json b/.stylelintrc.json
index 49f4e7f..58d0137 100644
--- a/.stylelintrc.json
+++ b/.stylelintrc.json
@@ -3,7 +3,7 @@
3 "rules": { 3 "rules": {
4 "indentation": 4, 4 "indentation": 4,
5 "number-leading-zero": "never", 5 "number-leading-zero": "never",
6 "max-nesting-depth": 3, 6 "max-nesting-depth": 4,
7 "selector-class-pattern": [ 7 "selector-class-pattern": [
8 "^[closu](-[a-z0-9]+)+(__[a-z0-9]+(-[a-z0-9]+)*)*(--[a-z0-9]+(-[a-z0-9]+)*)*(\\@[a-z0-9]+(-[a-z0-9]+)*)?$", 8 "^[closu](-[a-z0-9]+)+(__[a-z0-9]+(-[a-z0-9]+)*)*(--[a-z0-9]+(-[a-z0-9]+)*)*(\\@[a-z0-9]+(-[a-z0-9]+)*)?$",
9 { "resolveNestedSelectors": true } 9 { "resolveNestedSelectors": true }
diff --git a/assets/css/_vars.scss b/assets/css/_vars.scss
index 1c46660..77b59b9 100644
--- a/assets/css/_vars.scss
+++ b/assets/css/_vars.scss
@@ -10,13 +10,13 @@ $content--h1--font-size: $font-size + 1;
10$subcontent--indent: 4ch; 10$subcontent--indent: 4ch;
11 11
12$container--pad-h: 2rem; 12$container--pad-h: 2rem;
13$container--pad-h-sm: 1rem; 13$container--pad-h--sm: 1rem;
14$container--pad-v: $line-height * 2rem; 14$container--pad-v: $line-height * 2rem;
15$container--pad-v-sm: $line-height * 1rem; 15$container--pad-v--sm: $line-height * 1rem;
16 16
17$nav--font-size: $font-size - 1; 17$nav--font-size: $font-size - 1;
18$nav--item--spacing: 4ch; 18$nav--item--spacing: 4ch;
19$nav--item--spacing-sm: 3ch; 19$nav--item--spacing--sm: 3ch;
20$nav--item--pad-h: 1ch; 20$nav--item--pad-h: 1ch;
21$nav--item--pad-v: .9em; 21$nav--item--pad-v: .9em;
22 22
@@ -24,6 +24,9 @@ $page--item-prefix--max-chars: 3ch;
24$page--item-prefix--pad: 2ch; 24$page--item-prefix--pad: 2ch;
25$page--item-prefix--width: $page--item-prefix--max-chars + $page--item-prefix--pad; 25$page--item-prefix--width: $page--item-prefix--max-chars + $page--item-prefix--pad;
26 26
27$page--item-prefix--max-chars--sm: 2ch;
28$page--item-prefix--width--sm: $page--item-prefix--max-chars--sm + $page--item-prefix--pad;
29
27$breakpoints: ( 30$breakpoints: (
28 xs: 380px, 31 xs: 380px,
29 sm: 700px, 32 sm: 700px,
diff --git a/assets/css/components/_nav.scss b/assets/css/components/_nav.scss
index 6d087ad..dc33d1e 100644
--- a/assets/css/components/_nav.scss
+++ b/assets/css/components/_nav.scss
@@ -50,7 +50,7 @@
50 50
51 @media (max-width: map-get($breakpoints, 'sm')) { 51 @media (max-width: map-get($breakpoints, 'sm')) {
52 &__item { 52 &__item {
53 margin-left: $nav--item--spacing-sm - $nav--item--pad-h; 53 margin-left: $nav--item--spacing--sm - $nav--item--pad-h;
54 } 54 }
55 } 55 }
56 56
diff --git a/assets/css/components/_page.scss b/assets/css/components/_page.scss
index a55bcb4..435d696 100644
--- a/assets/css/components/_page.scss
+++ b/assets/css/components/_page.scss
@@ -1,34 +1,4 @@
1.c-page { 1.c-page {
2 &__header {
3 margin-bottom: $line-height * 1em;
4
5 &::after {
6 content: '--';
7 display: block;
8 margin-bottom: $line-height * -1em;
9 color: var(--fg-hi);
10 line-height: 2 * $line-height;
11 }
12
13 &__title {
14 margin-top: 0;
15 }
16
17 &__meta {
18 margin-top: 0;
19 color: var(--fg-hi);
20 font-weight: normal;
21 }
22 }
23
24 &__content {
25 padding-left: $page--item-prefix--width;
26
27 > :first-child {
28 margin-top: 0;
29 }
30 }
31
32 &__prefixed { 2 &__prefixed {
33 position: relative; 3 position: relative;
34 margin-left: -1 * $page--item-prefix--width; 4 margin-left: -1 * $page--item-prefix--width;
@@ -92,22 +62,75 @@
92 } 62 }
93 63
94 &--ref::before { 64 &--ref::before {
95 content: '->'; 65 content: '|>';
66 }
67
68 &--backref::before {
69 content: '<|';
96 } 70 }
97 } 71 }
98 72
99 @media (max-width: map-get($breakpoints, 'sm')) { 73 &__header {
100 &__content { 74 margin-bottom: $line-height * 1em;
101 padding-left: 0; 75
76 &__title {
77 margin-top: 0;
78 }
79
80 &__backlink__link {
81 &:link,
82 &:visited {
83 color: var(--fg-hi);
84
85 &:hover {
86 color: var(--link--hover--fg);
87 }
88 }
89 }
90
91 &__backlink + &__title {
92 margin-top: $line-height * 1em;
93 }
94
95 &__meta {
96 margin-top: 0;
97 color: var(--fg-hi);
98 font-weight: normal;
99 }
100 }
101
102 &__content {
103 padding-left: $page--item-prefix--width;
104
105 > :first-child {
106 margin-top: 0;
102 } 107 }
108 }
103 109
110 @media (max-width: map-get($breakpoints, 'sm')) {
104 &__prefixed { 111 &__prefixed {
105 margin-left: 0; 112 margin-left: 0;
106 padding-left: 0; 113 padding-left: $page--item-prefix--width--sm;
107 114
108 &::before { 115 &::before {
109 display: none; 116 width: $page--item-prefix--width--sm;
117 margin-left: -1 * $page--item-prefix--width--sm;
118 }
119
120 &--h1,
121 &--h2,
122 &--h3,
123 &--pre {
124 padding-left: 0;
125
126 &::before {
127 display: none;
128 }
110 } 129 }
111 } 130 }
131
132 &__content {
133 padding-left: 0;
134 }
112 } 135 }
113} 136}
diff --git a/assets/css/layouts/_container.scss b/assets/css/layouts/_container.scss
index f0544f7..e99c62f 100644
--- a/assets/css/layouts/_container.scss
+++ b/assets/css/layouts/_container.scss
@@ -14,12 +14,12 @@
14 } 14 }
15 15
16 @media (max-width: map-get($breakpoints, 'sm')) { 16 @media (max-width: map-get($breakpoints, 'sm')) {
17 padding-right: $container--pad-h-sm; 17 padding-right: $container--pad-h--sm;
18 padding-left: $container--pad-h-sm; 18 padding-left: $container--pad-h--sm;
19 19
20 &--pad-v { 20 &--pad-v {
21 padding-top: $container--pad-v-sm; 21 padding-top: $container--pad-v--sm;
22 padding-bottom: $container--pad-v-sm; 22 padding-bottom: $container--pad-v--sm;
23 } 23 }
24 } 24 }
25} 25}
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua
index 4abb716..fb7b3c9 100644
--- a/scripts/metadata_filter.lua
+++ b/scripts/metadata_filter.lua
@@ -137,15 +137,23 @@ function resolve_category(categories, category)
137end 137end
138 138
139function create_main_menu_state(section, main_menu) 139function create_main_menu_state(section, main_menu)
140 local active_item = nil
141
140 for i = 1, #main_menu do 142 for i = 1, #main_menu do
141 local item = main_menu[i] 143 local item = main_menu[i]
142 local active = pandoc.utils.stringify(item.id) == section.id 144 local active = pandoc.utils.stringify(item.id) == section.id
143 item.active = pandoc.MetaBool(active) 145 item.active = pandoc.MetaBool(active)
146 if active then
147 active_item = item
148 end
144 end 149 end
145 150
146 return main_menu:filter(function(item) 151 return pandoc.MetaMap({
147 return not item.hidden or item.active 152 items = main_menu:filter(function(item)
148 end) 153 return not item.hidden or item.active
154 end),
155 active = active_item
156 })
149end 157end
150 158
151function organize_subpages(pages) 159function organize_subpages(pages)
diff --git a/templates/base.html b/templates/base.html
index da3dec9..8682125 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -36,23 +36,19 @@
36 <nav class="c-nav"> 36 <nav class="c-nav">
37 <div class="c-nav__items l-container"> 37 <div class="c-nav__items l-container">
38 <a class="c-nav__logo" href="/" title="$site.title$">$site.logo$</a> 38 <a class="c-nav__logo" href="/" title="$site.title$">$site.logo$</a>
39 $for(menus.main)$ 39 $for(menus.main.items)$
40 <a class="c-nav__item $if(it.active)$c-nav__item--active$endif$" href="$it.url$">$it.label$</a> 40 <a class="c-nav__item $if(it.active)$c-nav__item--active$endif$" href="$it.url$">$it.label$</a>
41 $endfor$ 41 $endfor$
42 </div> 42 </div>
43 </nav> 43 </nav>
44 44
45 <main class="c-page s-page l-container l-container--content l-container--pad-v"> 45 $if(section.is_index)$
46 <div class="c-page__content">
47 $if(section.is_index)$
48${layouts/index()} 46${layouts/index()}
49 $elseif(layout.is_dated_list)$ 47 $elseif(layout.is_dated_list)$
50${layouts/dated_list()} 48${layouts/dated_list()}
51 $else$ 49 $else$
52${layouts/page()} 50${layouts/page()}
53 $endif$ 51 $endif$
54 </div>
55 </main>
56</body> 52</body>
57 53
58</html> 54</html>
diff --git a/templates/layouts/dated_list.html b/templates/layouts/dated_list.html
index 0a279f0..8c5de69 100644
--- a/templates/layouts/dated_list.html
+++ b/templates/layouts/dated_list.html
@@ -1,22 +1,25 @@
1<h1 class="c-page__prefixed c-page__prefixed--h1">$title$</h1> 1<main class="c-page s-page l-container l-container--content l-container--pad-v">
2 2 <div class="c-page__content">
3 <h1 class="c-page__prefixed c-page__prefixed--h1">$title$</h1>
3$body$ 4$body$
4 5
5$if(categories)$ 6 $if(categories)$
6 <ul class="c-hlist"> 7 <ul class="c-hlist">
7 $for(categories)$ 8 $for(categories)$
8 <li class="c-hlist__item"><strong>$it.key/uppercase$</strong> $it.value.name$</li> 9 <li class="c-hlist__item"><strong>$it.key/uppercase$</strong> $it.value.name$</li>
9 $endfor$ 10 $endfor$
10 </ul> 11 </ul>
11$endif$ 12 $endif$
12 13
13$for(pages.by_year)$ 14 $for(pages.by_year)$
14 <ul> 15 <ul>
15 $for(it.value)$ 16 $for(it.value)$
16 <li class="c-page__prefixed c-page__prefixed--ref"> 17 <li class="c-page__prefixed c-page__prefixed--ref">
17 <a href="$it.url.rel$">$it.category.id/uppercase$ $it.date.yyyy_mm_dd$ - $it.title$</a> 18 <a href="$it.url.rel$">$it.category.id/uppercase$ $it.date.yyyy_mm_dd$ - $it.title$</a>
18 </li> 19 </li>
20 $endfor$
21 </ul>
19 $endfor$ 22 $endfor$
20 </ul> 23 </div>
21$endfor$ 24</main>
22 25
diff --git a/templates/layouts/index.html b/templates/layouts/index.html
index 144d1ed..a1410f1 100644
--- a/templates/layouts/index.html
+++ b/templates/layouts/index.html
@@ -1,14 +1,16 @@
1<header class="c-hero u-hidden@sm-down" role="presentation"> 1<main class="c-page s-page l-container l-container--content l-container--pad-v">
2 $-- ' | ' ' ' ' ' | | | ' ' 2 <div class="c-page__content">
3 $-- | ' ' ' //\_ ' | ' . | ' ' 3 <header class="c-hero u-hidden@sm-down" role="presentation">
4 $-- .| ' ____,...,______..,_~`` -`.., ' | ' | ' ' 4 $-- ' | ' ' ' ' ' | | | ' '
5 $-- | _,~´"' , . ,~--´ ' _| | . |~~.__ ' ' 5 $-- | ' ' ' //\_ ' | ' . | ' '
6 $-- | | ,-" _.-|~/ |..,____,) ,/,,"' '_( | ' |) ) ' ' 6 $-- .| ' ____,...,______..,_~`` -`.., ' | ' | ' '
7 $-- '| \__,~"´ /:) / |:\ \ ,~( ) . | | ) `, ' _,--. 7 $-- | _,~´"' , . ,~--´ ' _| | . |~~.__ ' '
8 $-- ___\___.___:____(:/\_-,______\:.\_-,____.__\_.\______.__:___\__.___)_.___,/_____ 8 $-- | | ,-" _.-|~/ |..,____,) ,/,,"' '_( | ' |) ) ' '
9 $-- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 9 $-- '| \__,~"´ /:) / |:\ \ ,~( ) . | | ) `, ' _,--.
10 10 $-- ___\___.___:____(:/\_-,______\:.\_-,____.__\_.\______.__:___\__.___)_.___,/_____
11 <pre class="c-hero__pre c-page__prefixed c-page__prefixed--pre u-mt0 u-hidden@sm-down"> 11 $-- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
12
13 <pre class="c-hero__pre c-page__prefixed c-page__prefixed--pre u-mt0 u-hidden@sm-down">
12' | ' ' ' ' ' | | | ' ' 14' | ' ' ' ' ' | | | ' '
13 | ' ' ' <strong>//\_</strong> ' | ' . | ' ' 15 | ' ' ' <strong>//\_</strong> ' | ' . | ' '
14 .| ' <strong>____,...,______..,_~`` -`..,</strong> ' | ' | ' ' 16 .| ' <strong>____,...,______..,_~`` -`..,</strong> ' | ' | ' '
@@ -17,9 +19,11 @@
17 '| <strong>\__,~"´ /:) / |:\ \</strong> ,~( ) . | | ) `, ' _,--. 19 '| <strong>\__,~"´ /:) / |:\ \</strong> ,~( ) . | | ) `, ' _,--.
18 \ . : <strong>(:/\_-, \:.\_-,</strong> . \ .\ . : \ . ) . ' ,/ </pre> 20 \ . : <strong>(:/\_-, \:.\_-,</strong> . \ .\ . : \ . ) . ' ,/ </pre>
19 21
20</header> 22 </header>
21 23
22$body$ 24$body$
25 </div>
26</main>
23 27
24<template id="header-sm"> 28<template id="header-sm">
25 $-- .| //\__ ' .' | . | ' . ' 29 $-- .| //\__ ' .' | . | ' . '
diff --git a/templates/layouts/page.html b/templates/layouts/page.html
index 332a846..ee1a816 100644
--- a/templates/layouts/page.html
+++ b/templates/layouts/page.html
@@ -1,12 +1,24 @@
1<header class="c-page__header"> 1<main class="c-page l-container l-container--content l-container--pad-v">
2 <h1 class="c-page__prefixed c-page__prefixed--h1 c-page__header__title">$title$</h1> 2 <div class="c-page__content">
3 $if(date)$ 3 <header class="c-page__header">
4 <h2 class="c-page__header__meta">$date.yyyy_mm_dd$$if(category)$ in $category.name$$endif$</h2> 4 $if(menus.main.active)$
5 $elseif(category)$ 5 <div class="c-page__prefixed c-page__prefixed--backref c-page__header__backlink">
6 <h2 class="c-page__header__meta">in $category.name$</h2> 6 <a class="c-page__header__backlink__link" href="$menus.main.active.url$">
7 $endif$ 7 $menus.main.active.label$
8</header> 8 </a>
9 </div>
10 $endif$
11 <h1 class="c-page__prefixed c-page__prefixed--h1 c-page__header__title">$title$</h1>
12 $if(date)$
13 <h2 class="c-page__header__meta">$date.yyyy_mm_dd$$if(category)$ in $category.name$$endif$</h2>
14 $elseif(category)$
15 <h2 class="c-page__header__meta">in $category.name$</h2>
16 $endif$
17 </header>
9 18
10<section> 19 <section class="s-page">
11$body$ 20$body$
12</section> 21 </section>
22 </div>
23</main>
24