summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/css/_vars.scss10
-rw-r--r--assets/css/components/_outer-button.scss2
-rw-r--r--assets/css/components/_post-list.scss56
-rw-r--r--assets/css/scopes/_colored-links.scss4
-rw-r--r--assets/css/scopes/_headlines.scss3
-rw-r--r--assets/css/style.scss1
-rw-r--r--scripts/metadata_filter.lua67
-rw-r--r--templates/layouts/categorized_list.html35
8 files changed, 114 insertions, 64 deletions
diff --git a/assets/css/_vars.scss b/assets/css/_vars.scss
index 0df3a61..78a451b 100644
--- a/assets/css/_vars.scss
+++ b/assets/css/_vars.scss
@@ -26,7 +26,7 @@ $content--width: 42rem;
26 26
27$gray0: hsl(220, 7%, 7%); 27$gray0: hsl(220, 7%, 7%);
28$gray1: hsl(220, 7%, 11%); 28$gray1: hsl(220, 7%, 11%);
29$gray2: hsl(220, 7%, 18%); 29$gray2: hsl(220, 7%, 17%);
30$gray3: hsl(220, 7%, 23%); 30$gray3: hsl(220, 7%, 23%);
31$gray4: hsl(220, 7%, 38%); 31$gray4: hsl(220, 7%, 38%);
32$gray5: hsl(220, 7%, 60%); 32$gray5: hsl(220, 7%, 60%);
@@ -57,7 +57,7 @@ $gray7: hsl(220, 7%, 100%);
57 --color: hsl(var(--colors--accent--h), var(--colors--accent--s), var(--colors--accent--l)), 57 --color: hsl(var(--colors--accent--h), var(--colors--accent--s), var(--colors--accent--l)),
58 ), 58 ),
59 59
60 --focus-ring: var(--colors--accent--color), 60 --focus-ring: var(--colors--fg-lo),
61 61
62 --select: ( 62 --select: (
63 --bg: rgba($gray7, .996), 63 --bg: rgba($gray7, .996),
@@ -67,7 +67,11 @@ $gray7: hsl(220, 7%, 100%);
67 67
68 --link: ( 68 --link: (
69 --idle: var(--colors--fg-lo), 69 --idle: var(--colors--fg-lo),
70 ) 70 --colored: (
71 --idle: hsl(210, 90%, 72%), // hsl(354, 100%, 66%),
72 --visited: hsl(270, 60%, 75%), // hsl(354, 50%, 66%),
73 )
74 ),
71 ) 75 )
72)); 76));
73 77
diff --git a/assets/css/components/_outer-button.scss b/assets/css/components/_outer-button.scss
index e54c83d..21f78f4 100644
--- a/assets/css/components/_outer-button.scss
+++ b/assets/css/components/_outer-button.scss
@@ -26,7 +26,7 @@
26 color: prop(--colors --fg); 26 color: prop(--colors --fg);
27 font-size: 1rem; 27 font-size: 1rem;
28 font-weight: 700; 28 font-weight: 700;
29 letter-spacing: 1px; 29 letter-spacing: .5px;
30 text-decoration: none; 30 text-decoration: none;
31 text-transform: uppercase; 31 text-transform: uppercase;
32 32
diff --git a/assets/css/components/_post-list.scss b/assets/css/components/_post-list.scss
new file mode 100644
index 0000000..7787efd
--- /dev/null
+++ b/assets/css/components/_post-list.scss
@@ -0,0 +1,56 @@
1@include namespace('post-list') {
2 @include store((
3 --colors: (
4 --cat: (
5 --fg: prop(--colors --fg-lo, $global: true),
6 ),
7 --post: (
8 --bg: prop(--colors --bg-lo, $global: true),
9 --border: prop(--colors --obj-hi, $global: true),
10 ),
11 --meta: (
12 --fg: prop(--colors --fg-hi, $global: true),
13 )
14 ),
15 --dims: (
16 --pad-x: 1em,
17 --pad-y: .6em,
18 )
19 ));
20
21 @include component(namespace()) {
22 @include element('category-header') {
23 color: prop(--colors --cat --fg);
24 font-size: 1 / 16 * 14em;
25 letter-spacing: 1px;
26 text-transform: uppercase;
27
28 @include next-element('post') {
29 margin-top: $line-height * .5rem;
30 }
31 }
32
33 @include element('post') {
34 display: flex;
35 align-items: baseline;
36 padding: prop(--dims --pad-y) prop(--dims --pad-x);
37 background-color: prop(--colors --post --bg);
38
39 @include next-twin-element {
40 border-top: 1px solid prop(--colors --post --border);
41 }
42 }
43
44 @include element('post-title') {
45 margin-right: 1em;
46 font-size: 1 / 16 * 17em;
47 }
48
49 @include element('post-date') {
50 flex: 0 0 auto;
51 margin-left: auto;
52 color: prop(--colors --meta --fg);
53 font-size: 1 / 16 * 14em;
54 }
55 }
56}
diff --git a/assets/css/scopes/_colored-links.scss b/assets/css/scopes/_colored-links.scss
index 25ed289..9be0f93 100644
--- a/assets/css/scopes/_colored-links.scss
+++ b/assets/css/scopes/_colored-links.scss
@@ -2,8 +2,8 @@
2 @include store(( 2 @include store((
3 --colors: ( 3 --colors: (
4 --link: ( 4 --link: (
5 --idle: hsl(210, 90%, 72%), // hsl(354, 100%, 66%), 5 --idle: prop(--colors --link --colored --idle, $global: true),
6 --visited: hsl(270, 60%, 75%), // hsl(354, 50%, 66%), 6 --visited: prop(--colors --link --colored --visited, $global: true),
7 ) 7 )
8 ) 8 )
9 )); 9 ));
diff --git a/assets/css/scopes/_headlines.scss b/assets/css/scopes/_headlines.scss
index 8b75708..367e093 100644
--- a/assets/css/scopes/_headlines.scss
+++ b/assets/css/scopes/_headlines.scss
@@ -38,7 +38,6 @@
38 h3 { 38 h3 {
39 @include iro-responsive-modular-scale(font-size, 1, $responsive-mod-scale); 39 @include iro-responsive-modular-scale(font-size, 1, $responsive-mod-scale);
40 40
41 letter-spacing: .05em;
42 text-transform: uppercase; 41 text-transform: uppercase;
43 } 42 }
44 43
@@ -47,7 +46,7 @@
47 h6 { 46 h6 {
48 @include iro-responsive-modular-scale(font-size, 0, $responsive-mod-scale); 47 @include iro-responsive-modular-scale(font-size, 0, $responsive-mod-scale);
49 48
50 letter-spacing: .1em; 49 letter-spacing: .5px;
51 text-transform: uppercase; 50 text-transform: uppercase;
52 } 51 }
53 52
diff --git a/assets/css/style.scss b/assets/css/style.scss
index e4a36b0..30878fe 100644
--- a/assets/css/style.scss
+++ b/assets/css/style.scss
@@ -23,6 +23,7 @@
23@import 'components/footer'; 23@import 'components/footer';
24@import 'components/card'; 24@import 'components/card';
25@import 'components/project'; 25@import 'components/project';
26@import 'components/post-list';
26 27
27@import 'scopes/colored-links'; 28@import 'scopes/colored-links';
28@import 'scopes/headlines'; 29@import 'scopes/headlines';
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua
index b8a9059..5f2d9af 100644
--- a/scripts/metadata_filter.lua
+++ b/scripts/metadata_filter.lua
@@ -6,20 +6,24 @@ function format_date(date)
6 if not year then return nil end 6 if not year then return nil end
7 7
8 local time = os.time({year = tonumber(year), month = tonumber(month), day = tonumber(day)}) 8 local time = os.time({year = tonumber(year), month = tonumber(month), day = tonumber(day)})
9 return pandoc.MetaMap({ 9 return {
10 yyyy_mm_dd = os.date("%F", time), 10 yyyy_mm_dd = os.date("%F", time),
11 yyyy = os.date("%Y", time), 11 yyyy = os.date("%Y", time),
12 mm = os.date("%m", time), 12 mm = os.date("%m", time),
13 dd = os.date("%d", time), 13 dd = os.date("%d", time),
14 rfc3339 = os.date("%FT%T+00:00", time), 14 rfc3339 = os.date("%FT%T+00:00", time),
15 long = os.date("%B %d, %Y", time), 15 long = os.date("%B %d, %Y", time),
16 }) 16 }
17end 17end
18 18
19function table_to_list(t, cmp) 19function table_to_list(t, kv, cmp)
20 local l = pandoc.List() 20 local l = pandoc.List()
21 21
22 for key, value in pairs(t) do l:insert(pandoc.MetaMap({key = key, value = value})) end 22 if kv then
23 for key, value in pairs(t) do l:insert({key = key, value = value}) end
24 else
25 for _, value in pairs(t) do l:insert(value) end
26 end
23 27
24 l:sort(cmp or function(i1, i2) return i1.key < i2.key end) 28 l:sort(cmp or function(i1, i2) return i1.key < i2.key end)
25 29
@@ -96,13 +100,13 @@ function resolve_url(site_url, ref_file, target_file)
96 local abs = target_file 100 local abs = target_file
97 local rel = relative_to(ref_base_dir, abs):gsub("/index%.html$", "/") 101 local rel = relative_to(ref_base_dir, abs):gsub("/index%.html$", "/")
98 102
99 return pandoc.MetaMap({abs = abs, rel = rel, full = (site_url .. abs)}) 103 return {abs = abs, rel = rel, full = (site_url .. abs)}
100end 104end
101 105
102function resolve_layout(layout) 106function resolve_layout(layout)
103 if layout then 107 if layout then
104 layout = pandoc.utils.stringify(layout) 108 layout = pandoc.utils.stringify(layout)
105 return pandoc.MetaMap({id = layout, ["is_" .. layout] = pandoc.MetaBool(true)}) 109 return {id = layout, ["is_" .. layout] = true}
106 end 110 end
107end 111end
108 112
@@ -112,16 +116,13 @@ function resolve_namespace(namespace)
112 local root = "index" 116 local root = "index"
113 if namespace ~= "" then root = namespace:gsub("^/([^/]*).*$", "%1") end 117 if namespace ~= "" then root = namespace:gsub("^/([^/]*).*$", "%1") end
114 118
115 return pandoc.MetaMap({ 119 return {root = {id = root, ["is_" .. root] = true}, full = namespace}
116 root = pandoc.MetaMap({id = root, ["is_" .. root] = pandoc.MetaBool(true)}),
117 full = namespace,
118 })
119end 120end
120 121
121function resolve_category(categories, category) 122function resolve_category(categories, category)
122 if categories and category then 123 if categories and category then
123 category = pandoc.utils.stringify(category) 124 category = pandoc.utils.stringify(category)
124 data = pandoc.MetaMap(categories[category]) 125 data = categories[category]
125 data.id = category 126 data.id = category
126 return data 127 return data
127 end 128 end
@@ -133,14 +134,14 @@ function prep_menu(active_id, main_menu)
133 for i = 1, #main_menu do 134 for i = 1, #main_menu do
134 local item = main_menu[i] 135 local item = main_menu[i]
135 local active = pandoc.utils.stringify(item.id) == active_id 136 local active = pandoc.utils.stringify(item.id) == active_id
136 item.active = pandoc.MetaBool(active) 137 item.active = active
137 if active then active_item = item end 138 if active then active_item = item end
138 end 139 end
139 140
140 return pandoc.MetaMap({ 141 return {
141 items = main_menu:filter(function(item) return not item.hidden or item.active end), 142 items = main_menu:filter(function(item) return not item.hidden or item.active end),
142 active = active_item, 143 active = active_item,
143 }) 144 }
144end 145end
145 146
146function process_pages(global, pages_by_id) 147function process_pages(global, pages_by_id)
@@ -167,33 +168,23 @@ function process_pages(global, pages_by_id)
167 end 168 end
168 end) 169 end)
169 170
170 local pages_categorized = pages_list:filter(function(p) return p.category ~= nil end) 171 local pages_by_category = pages_list:filter(function(p) return p.category ~= nil end)
171 172 pages_by_category = group_by(pages_by_category, function(p) return p.category.id end,
172 local pages_by_category = group_by(pages_categorized, function(p) return p.category.id end) 173 function(data, _, p)
173 pages_by_category = 174 if not data then
174 table_to_list(pages_by_category, function(i1, i2) return i1.key < i2.key end) 175 local l = pandoc.List()
175 176 l:insert(p)
176 local pages_data = pandoc.MetaMap({ 177 return {name = pandoc.utils.stringify(p.category.name), pages = l}
177 all = pages_list,
178 by_id = pages_by_id,
179 by_category = pages_by_category,
180 })
181
182 local categories_data = group_by(pages_categorized,
183 function(p) return p.category and p.category.id end, function(stats, _, p)
184 if not stats then
185 return {name = p.category.name, count = 1}
186 else 178 else
187 stats.count = stats.count + 1 179 data.pages:insert(p)
188 end 180 end
189 end) 181 end)
190 categories_data = table_to_list(categories_data) 182 pages_by_category = table_to_list(pages_by_category, false,
183 function(i1, i2) return i1.name < i2.name end)
191 184
192 for i = 1, #categories_data do 185 local pages_data = {all = pages_list, by_id = pages_by_id, by_category = pages_by_category}
193 categories_data[i].value.count = ("%d"):format(categories_data[i].value.count)
194 end
195 186
196 return pages_data, categories_data 187 return pages_data
197end 188end
198 189
199function process(global, meta) 190function process(global, meta)
@@ -222,9 +213,7 @@ function process(global, meta)
222 meta.menus.main = prep_menu(meta.namespace.root.id, meta.menus.main) 213 meta.menus.main = prep_menu(meta.namespace.root.id, meta.menus.main)
223 end 214 end
224 215
225 local pages, local_categories = process_pages(global, meta.pages) 216 meta.pages = process_pages(global, meta.pages)
226 meta.pages = pages
227 meta.local_categories = local_categories
228 217
229 return meta 218 return meta
230end 219end
diff --git a/templates/layouts/categorized_list.html b/templates/layouts/categorized_list.html
index 5e2d4a5..0b445ee 100644
--- a/templates/layouts/categorized_list.html
+++ b/templates/layouts/categorized_list.html
@@ -1,30 +1,31 @@
1<section class="l-section l-section--fullscreen l-section--no-head"> 1<section class="l-section l-section--fullscreen l-section--no-head">
2 <div class="l-container l-container--pad-x l-container--pad-y l-container--content s-colored-links"> 2 <div class="l-container l-container--pad-x l-container--pad-y l-container--content s-colored-links">
3 <div class="s-headlines s-body"> 3 <div class="s-headlines">
4 <h1 class="u-mt0"><span class="s-headlines__title-inner">$title$</span></h1> 4 <h1 class="u-mt0"><span class="s-headlines__title-inner">$title$</span></h1>
5 5
6$body$ 6$body$
7 </div> 7 </div>
8 8
9 $for(pages.by_category)$ 9 <div class="c-post-list">
10 <h2 class="s-body__h3"> 10 $for(pages.by_category)$
11 $for(it.value/first/first)$ 11 <h2 class="c-post-list__category-header">
12 $it.category.name$ 12 $it.name$
13 $endfor$ 13 </h2>
14 </h2> 14 $for(it.pages)$
15 <ul> 15 <div class="c-post-list__post">
16 $for(it.value)$ 16 <a href="$it.url.rel$" class="c-post-list__post-title">
17 <li>
18 $if(it.category.show_date)$
19 $it.date.yyyy_mm_dd$:
20 $endif$
21 <a href="$it.url.rel$">
22 $it.title$ 17 $it.title$
23 </a> 18 </a>
24 </li> 19
20 $if(it.category.show_date)$
21 <time datetime="$it.date.yyyy_mm_dd$" class="c-post-list__post-date">
22 $it.date.long$
23 </time>
24 $endif$
25 </div>
25 $endfor$ 26 $endfor$
26 </ul> 27 $endfor$
27 $endfor$ 28 </div>
28 </div> 29 </div>
29</section> 30</section>
30 31