summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/css/components/_project.scss26
-rw-r--r--assets/css/layouts/_project-grid.scss2
-rwxr-xr-xscripts/build_content.sh6
-rw-r--r--scripts/metadata_filter.lua48
4 files changed, 47 insertions, 35 deletions
diff --git a/assets/css/components/_project.scss b/assets/css/components/_project.scss
index 09dc062..62a7118 100644
--- a/assets/css/components/_project.scss
+++ b/assets/css/components/_project.scss
@@ -21,6 +21,19 @@
21 background-image: linear-gradient(340deg, rgba(#000, .25) 5em, transparent 18em); 21 background-image: linear-gradient(340deg, rgba(#000, .25) 5em, transparent 18em);
22 } 22 }
23 23
24 &:link,
25 &:visited {
26 &:hover {
27 @include element('picture') {
28 opacity: .75;
29 }
30
31 @include element('card') {
32 transform: translateY(-1em);
33 }
34 }
35 }
36
24 @include multi('element' 'picture', '&::after') { 37 @include multi('element' 'picture', '&::after') {
25 display: block; 38 display: block;
26 position: absolute; 39 position: absolute;
@@ -39,18 +52,21 @@
39 right: 1em; 52 right: 1em;
40 bottom: 1em; 53 bottom: 1em;
41 min-width: 15em; 54 min-width: 15em;
55 max-width: calc(100% - 2em);
56 transform: translateY(0);
57 transition: transform .2s;
42 box-shadow: 0 .3em 1em rgba(#000, .25); 58 box-shadow: 0 .3em 1em rgba(#000, .25);
43 } 59 }
44 60
61 @include element('picture') {
62 transition: opacity .2s;
63 opacity: 1;
64 }
65
45 @include media('<=sm') { 66 @include media('<=sm') {
46 &::after { 67 &::after {
47 background-image: linear-gradient(to top, rgba(#000, .25) 1em, transparent 11em); 68 background-image: linear-gradient(to top, rgba(#000, .25) 1em, transparent 11em);
48 } 69 }
49
50 @include element('card') {
51 width: calc(100% - 2em);
52 min-width: 0;
53 }
54 } 70 }
55 } 71 }
56} 72}
diff --git a/assets/css/layouts/_project-grid.scss b/assets/css/layouts/_project-grid.scss
index 612d857..7c67663 100644
--- a/assets/css/layouts/_project-grid.scss
+++ b/assets/css/layouts/_project-grid.scss
@@ -1,7 +1,7 @@
1@include namespace('project-grid') { 1@include namespace('project-grid') {
2 @include store(( 2 @include store((
3 --dims: ( 3 --dims: (
4 --col-width: 26em 4 --col-width: 20em
5 ) 5 )
6 )); 6 ));
7 7
diff --git a/scripts/build_content.sh b/scripts/build_content.sh
index 154a93f..3e4d512 100755
--- a/scripts/build_content.sh
+++ b/scripts/build_content.sh
@@ -30,7 +30,6 @@ get_metadata() {
30 -f markdown \ 30 -f markdown \
31 -t plain \ 31 -t plain \
32 --metadata content_dir="$CONTENT_DIR" \ 32 --metadata content_dir="$CONTENT_DIR" \
33 --metadata output_dir="$OUTPUT_DIR" \
34 --metadata file_in="$1" \ 33 --metadata file_in="$1" \
35 --metadata relative_to="$2" \ 34 --metadata relative_to="$2" \
36 --metadata-file metadata/metadata.yaml \ 35 --metadata-file metadata/metadata.yaml \
@@ -44,7 +43,6 @@ get_content() {
44 -f markdown \ 43 -f markdown \
45 -t markdown \ 44 -t markdown \
46 --metadata content_dir="$CONTENT_DIR" \ 45 --metadata content_dir="$CONTENT_DIR" \
47 --metadata output_dir="$OUTPUT_DIR" \
48 --metadata file_in="$1" \ 46 --metadata file_in="$1" \
49 --metadata-file metadata/metadata.yaml \ 47 --metadata-file metadata/metadata.yaml \
50 --no-highlight \ 48 --no-highlight \
@@ -103,6 +101,7 @@ handle () {
103 if [ "${1#*.}" = "md" ]; then 101 if [ "${1#*.}" = "md" ]; then
104 local included_metadata=$(get_metadata "$1") 102 local included_metadata=$(get_metadata "$1")
105 local file_out=$(echo "$included_metadata" | jq -r .file_out) 103 local file_out=$(echo "$included_metadata" | jq -r .file_out)
104 file_out="$OUTPUT_DIR${file_out#/}"
106 local create_feed=$(echo "$included_metadata" | jq -r .create_feed) 105 local create_feed=$(echo "$included_metadata" | jq -r .create_feed)
107 106
108 mkdir -p $(dirname "$file_out") 107 mkdir -p $(dirname "$file_out")
@@ -127,7 +126,6 @@ handle () {
127 --template "${TEMPLATES_DIR}feed.xml" \ 126 --template "${TEMPLATES_DIR}feed.xml" \
128 -o "${file_out%.html}.xml" \ 127 -o "${file_out%.html}.xml" \
129 --metadata content_dir="$CONTENT_DIR" \ 128 --metadata content_dir="$CONTENT_DIR" \
130 --metadata output_dir="$OUTPUT_DIR" \
131 --metadata file_in="$1" \ 129 --metadata file_in="$1" \
132 --metadata page_type=feed \ 130 --metadata page_type=feed \
133 --metadata-file metadata/metadata.yaml \ 131 --metadata-file metadata/metadata.yaml \
@@ -144,7 +142,6 @@ handle () {
144 --template "${TEMPLATES_DIR}base.html" \ 142 --template "${TEMPLATES_DIR}base.html" \
145 -o "$file_out" \ 143 -o "$file_out" \
146 --metadata content_dir="$CONTENT_DIR" \ 144 --metadata content_dir="$CONTENT_DIR" \
147 --metadata output_dir="$OUTPUT_DIR" \
148 --metadata file_in="$1" \ 145 --metadata file_in="$1" \
149 --metadata-file metadata/metadata.yaml \ 146 --metadata-file metadata/metadata.yaml \
150 --metadata-file "$meta_file" \ 147 --metadata-file "$meta_file" \
@@ -157,7 +154,6 @@ handle () {
157 # --no-highlight \ 154 # --no-highlight \
158 # --template scripts/metadata_tpl.json \ 155 # --template scripts/metadata_tpl.json \
159 # --metadata content_dir="$CONTENT_DIR" \ 156 # --metadata content_dir="$CONTENT_DIR" \
160 # --metadata output_dir="$OUTPUT_DIR" \
161 # --metadata file_in="$1" \ 157 # --metadata file_in="$1" \
162 # --metadata-file metadata/metadata.yaml \ 158 # --metadata-file metadata/metadata.yaml \
163 # --metadata-file "$meta_file" \ 159 # --metadata-file "$meta_file" \
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua
index 21698bd..ad2bb83 100644
--- a/scripts/metadata_filter.lua
+++ b/scripts/metadata_filter.lua
@@ -101,7 +101,7 @@ function apply_path_rewrites(rewrites, str)
101 return str 101 return str
102end 102end
103 103
104function get_file_out(rewrites, content_dir, output_dir, file_in) 104function get_file_out(rewrites, content_dir, file_in)
105 local file_out = file_in:gsub("^" .. content_dir, ""):gsub("%.md$", ".html") 105 local file_out = file_in:gsub("^" .. content_dir, ""):gsub("%.md$", ".html")
106 106
107 if file_out:match(".html$") and not file_out:match("/index%.html$") then 107 if file_out:match(".html$") and not file_out:match("/index%.html$") then
@@ -110,15 +110,21 @@ function get_file_out(rewrites, content_dir, output_dir, file_in)
110 110
111 file_out = apply_path_rewrites(rewrites, file_out) 111 file_out = apply_path_rewrites(rewrites, file_out)
112 112
113 return pandoc.MetaString(output_dir .. file_out) 113 return pandoc.MetaString(file_out)
114end 114end
115 115
116function resolve_url(site_url, output_dir, ref_file, target_file) 116function make_absolute(rel, base)
117 return
118 rel:find("^/") ~= nil and rel or base:gsub("^(.*)/.-$", "%1") .. "/" ..
119 rel
120end
121
122function resolve_url(site_url, ref_file, target_file)
123 target_file = target_file:gsub("/index%.html$", "/")
124
117 local ref_base_dir = ref_file:gsub("^(.*)/.-$", "%1") 125 local ref_base_dir = ref_file:gsub("^(.*)/.-$", "%1")
118 local abs = target_file:gsub("^" .. output_dir, ""):gsub("/index%.html$", 126 local abs = target_file
119 "/") 127 local rel = relative_to(ref_base_dir, abs):gsub("/index%.html$", "/")
120 local rel =
121 relative_to(ref_base_dir, target_file):gsub("/index%.html$", "/")
122 128
123 return pandoc.MetaMap({ 129 return pandoc.MetaMap({
124 abs = pandoc.MetaString(abs), 130 abs = pandoc.MetaString(abs),
@@ -176,10 +182,10 @@ function prep_main_menu(rewrites, section, main_menu)
176 }) 182 })
177end 183end
178 184
179function organize_subpages(site_url, output_dir, ref_file, pages) 185function organize_subpages(site_url, ref_file, pages)
180 for i = 1, #pages do 186 for i = 1, #pages do
181 local page = pages[i] 187 local page = pages[i]
182 page.url = resolve_url(site_url, output_dir, ref_file, 188 page.url = resolve_url(site_url, ref_file,
183 pandoc.utils.stringify(page.file_out)) 189 pandoc.utils.stringify(page.file_out))
184 end 190 end
185 191
@@ -250,7 +256,6 @@ end
250 256
251function Meta(meta) 257function Meta(meta)
252 meta.content_dir = meta.content_dir:gsub("/$", "") 258 meta.content_dir = meta.content_dir:gsub("/$", "")
253 meta.output_dir = meta.output_dir:gsub("/$", "")
254 meta.site.url = pandoc.utils.stringify(meta.site.url):gsub("/$", "") 259 meta.site.url = pandoc.utils.stringify(meta.site.url):gsub("/$", "")
255 meta.rewrites = meta.rewrites or 260 meta.rewrites = meta.rewrites or
256 pandoc.MetaMap({path = pandoc.MetaList({})}) 261 pandoc.MetaMap({path = pandoc.MetaList({})})
@@ -258,19 +263,17 @@ function Meta(meta)
258 meta.layout = resolve_layout(meta.layout) 263 meta.layout = resolve_layout(meta.layout)
259 meta.section = resolve_section(meta.content_dir, meta.file_in) 264 meta.section = resolve_section(meta.content_dir, meta.file_in)
260 265
261 meta.file_out = get_file_out(meta.rewrites, meta.content_dir, 266 meta.file_out = get_file_out(meta.rewrites, meta.content_dir, meta.file_in)
262 meta.output_dir, meta.file_in)
263 if meta.relative_to == nil then meta.relative_to = meta.file_in end 267 if meta.relative_to == nil then meta.relative_to = meta.file_in end
264 meta.relative_to_out = get_file_out(meta.rewrites, meta.content_dir, 268 meta.relative_to_out = get_file_out(meta.rewrites, meta.content_dir,
265 meta.output_dir, meta.relative_to) 269 meta.relative_to)
266 270
267 meta.url = resolve_url(meta.site.url, meta.output_dir, meta.relative_to_out, 271 meta.url = resolve_url(meta.site.url, meta.relative_to_out, meta.file_out)
268 meta.file_out)
269 if meta.preview ~= nil then 272 if meta.preview ~= nil then
270 meta.preview = pandoc.utils.stringify(meta.preview) 273 meta.preview = resolve_url(meta.site.url, meta.relative_to_out,
271 meta.preview = meta.file_out:gsub("/index%.html$", "/" .. meta.preview) 274 make_absolute(
272 meta.preview = resolve_url(meta.site.url, meta.output_dir, 275 pandoc.utils.stringify(meta.preview),
273 meta.relative_to_out, meta.preview) 276 meta.file_out))
274 end 277 end
275 278
276 meta.date = format_date(meta.date) 279 meta.date = format_date(meta.date)
@@ -286,16 +289,14 @@ function Meta(meta)
286 289
287 if meta.page_type == "feed" then 290 if meta.page_type == "feed" then
288 meta.page = pandoc.MetaMap({ 291 meta.page = pandoc.MetaMap({
289 url = resolve_url(meta.site.url, meta.output_dir, 292 url = resolve_url(meta.site.url, meta.relative_to_out,
290 meta.relative_to_out,
291 meta.file_out:gsub("%.xml$", ".html")) 293 meta.file_out:gsub("%.xml$", ".html"))
292 }) 294 })
293 end 295 end
294 296
295 if meta.create_feed then 297 if meta.create_feed then
296 meta.feed = pandoc.MetaMap({ 298 meta.feed = pandoc.MetaMap({
297 url = resolve_url(meta.site.url, meta.output_dir, 299 url = resolve_url(meta.site.url, meta.relative_to_out,
298 meta.relative_to_out,
299 meta.file_out:gsub("%.html$", ".xml")) 300 meta.file_out:gsub("%.html$", ".xml"))
300 }) 301 })
301 end 302 end
@@ -307,7 +308,6 @@ function Meta(meta)
307 308
308 if meta.pages then 309 if meta.pages then
309 local pages, categories = organize_subpages(meta.site.url, 310 local pages, categories = organize_subpages(meta.site.url,
310 meta.output_dir,
311 meta.relative_to_out, 311 meta.relative_to_out,
312 meta.pages) 312 meta.pages)
313 meta.pages = pages 313 meta.pages = pages