diff options
| -rw-r--r-- | content/notebook/scrap/design-test.md | 2 | ||||
| -rw-r--r-- | filters/emojis.lua | 6 | ||||
| -rw-r--r-- | scripts/metadata.lua | 22 | ||||
| -rw-r--r-- | templates/partials/gallery_card.html | 6 | ||||
| -rw-r--r-- | templates/partials/grid_card.html | 6 | ||||
| -rw-r--r-- | templates/partials/list_card.html | 10 |
6 files changed, 25 insertions, 27 deletions
diff --git a/content/notebook/scrap/design-test.md b/content/notebook/scrap/design-test.md index c7c05ca..d618085 100644 --- a/content/notebook/scrap/design-test.md +++ b/content/notebook/scrap/design-test.md | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | --- | 1 | --- |
| 2 | schema_type: DigitalDocument | 2 | schema_type: DigitalDocument |
| 3 | title: Markdown Test Page | 3 | title: Markdown Test Page |
| 4 | last_update: 2021-12-16 | 4 | date: 2021-12-16 |
| 5 | --- | 5 | --- |
| 6 | 6 | ||
| 7 | - [Headings](#headings) | 7 | - [Headings](#headings) |
diff --git a/filters/emojis.lua b/filters/emojis.lua index 5eb9d4b..427d04b 100644 --- a/filters/emojis.lua +++ b/filters/emojis.lua | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | local common = require 'filters.lib.common' | ||
| 2 | |||
| 3 | function Str(el) | 1 | function Str(el) |
| 4 | local prefix, emojiref, suffix = el.text:match('^(.*):([^ ]+):(.*)$') | 2 | local prefix, emojiref, suffix = el.text:match('^(.*):([^ ]+):(.*)$') |
| 5 | 3 | ||
| 6 | if emojiref then | 4 | if emojiref then |
| 7 | local els = pandoc.List() | 5 | local els = pandoc.List() |
| 8 | 6 | ||
| 9 | els:insert(pandoc.Str(prefix)) | 7 | els:insert(pandoc.Str(prefix)) |
| 10 | els:insert(pandoc.Image(emojiref, "/emojis/" .. emojiref .. ".png", emojiref, { class = 'o-emoji' })) | 8 | els:insert(pandoc.Image(emojiref, "/emojis/" .. emojiref .. ".png", emojiref, { class = 'o-emoji' })) |
| 11 | els:insert(pandoc.Str(suffix)) | 9 | els:insert(pandoc.Str(suffix)) |
| 12 | 10 | ||
| 13 | return els | 11 | return els |
| 14 | end | 12 | end |
| 15 | 13 | ||
diff --git a/scripts/metadata.lua b/scripts/metadata.lua index 8f32bd4..4b77541 100644 --- a/scripts/metadata.lua +++ b/scripts/metadata.lua | |||
| @@ -187,8 +187,8 @@ function d1_page_to_list_item(meta, p) | |||
| 187 | return { | 187 | return { |
| 188 | title = p.title, | 188 | title = p.title, |
| 189 | subtitle = p.subtitle, | 189 | subtitle = p.subtitle, |
| 190 | date = p.date, | 190 | date = meta.list_order == "date_desc" and p.date, |
| 191 | last_update = p.last_update, | 191 | last_update = meta.list_order == "date_desc" and p.last_update, |
| 192 | schema_type = p.schema_type, | 192 | schema_type = p.schema_type, |
| 193 | position = p.position, | 193 | position = p.position, |
| 194 | url = p.url, | 194 | url = p.url, |
| @@ -206,8 +206,8 @@ function d2_page_to_list_item(meta, cat, p, set_cat_title) | |||
| 206 | title = p.title, | 206 | title = p.title, |
| 207 | subtitle = p.subtitle, | 207 | subtitle = p.subtitle, |
| 208 | category = set_cat_title and cat.title, | 208 | category = set_cat_title and cat.title, |
| 209 | date = p.date, | 209 | date = cat.list_order == "date_desc" and p.date, |
| 210 | last_update = p.last_update, | 210 | last_update = cat.list_order == "date_desc" and p.last_update, |
| 211 | schema_type = p.schema_type, | 211 | schema_type = p.schema_type, |
| 212 | position = p.position, | 212 | position = p.position, |
| 213 | url = p.url, | 213 | url = p.url, |
| @@ -316,18 +316,18 @@ function process(global, meta) | |||
| 316 | meta.depth = find_depth(meta.pages) | 316 | meta.depth = find_depth(meta.pages) |
| 317 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) | 317 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) |
| 318 | 318 | ||
| 319 | if meta.date then | ||
| 320 | meta.date = format_date(meta.date) | ||
| 321 | elseif meta.pages and #meta.pages.date_desc ~= 0 then | ||
| 322 | meta.date = meta.pages.date_desc[1].date | ||
| 323 | end | ||
| 324 | |||
| 325 | if meta.last_update then | 319 | if meta.last_update then |
| 326 | meta.last_update = format_date(meta.last_update) | 320 | meta.last_update = format_date(meta.last_update) |
| 327 | elseif meta.pages and #meta.pages.date_desc ~= 0 then | 321 | elseif meta.pages and #meta.pages.date_desc ~= 0 then |
| 328 | meta.last_update = meta.pages.date_desc[1].last_update | 322 | meta.last_update = meta.pages.date_desc[1].last_update |
| 329 | elseif meta.date then | 323 | elseif meta.date then |
| 330 | meta.last_update = meta.date | 324 | meta.last_update = format_date(meta.date) |
| 325 | end | ||
| 326 | |||
| 327 | if meta.date then | ||
| 328 | meta.date = format_date(meta.date) | ||
| 329 | elseif meta.last_update then | ||
| 330 | meta.date = meta.last_update | ||
| 331 | end | 331 | end |
| 332 | 332 | ||
| 333 | meta.list = generate_list(meta) | 333 | meta.list = generate_list(meta) |
diff --git a/templates/partials/gallery_card.html b/templates/partials/gallery_card.html index 4aa274a..3020c2d 100644 --- a/templates/partials/gallery_card.html +++ b/templates/partials/gallery_card.html | |||
| @@ -36,10 +36,10 @@ $if(it.thumbnail)$ | |||
| 36 | $elseif(it.category)$ | 36 | $elseif(it.category)$ |
| 37 | <small class="u-d-block">$it.category$</small> | 37 | <small class="u-d-block">$it.category$</small> |
| 38 | <strong class="u-d-block">$it.title$</strong> | 38 | <strong class="u-d-block">$it.title$</strong> |
| 39 | $elseif(it.date)$ | 39 | $elseif(it.last_update)$ |
| 40 | <small class="u-d-block"> | 40 | <small class="u-d-block"> |
| 41 | <time datetime="$it.date.yyyy_mm_dd$" itemprop="dateCreated"> | 41 | <time datetime="$it.last_update.yyyy_mm_dd$" itemprop="dateCreated"> |
| 42 | $it.date.long$ | 42 | $it.last_update.long$ |
| 43 | </time> | 43 | </time> |
| 44 | </small> | 44 | </small> |
| 45 | <strong class="u-d-block">$it.title$</strong> | 45 | <strong class="u-d-block">$it.title$</strong> |
diff --git a/templates/partials/grid_card.html b/templates/partials/grid_card.html index 4120169..abcd923 100644 --- a/templates/partials/grid_card.html +++ b/templates/partials/grid_card.html | |||
| @@ -23,10 +23,10 @@ $if(it.url)$ | |||
| 23 | $elseif(it.category)$ | 23 | $elseif(it.category)$ |
| 24 | <small class="u-d-block">$it.category$</small> | 24 | <small class="u-d-block">$it.category$</small> |
| 25 | <strong class="u-d-block">$it.title$</strong> | 25 | <strong class="u-d-block">$it.title$</strong> |
| 26 | $elseif(it.date)$ | 26 | $elseif(it.last_update)$ |
| 27 | <small class="u-d-block"> | 27 | <small class="u-d-block"> |
| 28 | <time datetime="$it.date.yyyy_mm_dd$" itemprop="dateCreated"> | 28 | <time datetime="$it.last_update.yyyy_mm_dd$" itemprop="dateCreated"> |
| 29 | $it.date.long$ | 29 | $it.last_update.long$ |
| 30 | </time> | 30 | </time> |
| 31 | </small> | 31 | </small> |
| 32 | <strong class="u-d-block">$it.title$</strong> | 32 | <strong class="u-d-block">$it.title$</strong> |
diff --git a/templates/partials/list_card.html b/templates/partials/list_card.html index 539b7d3..755686f 100644 --- a/templates/partials/list_card.html +++ b/templates/partials/list_card.html | |||
| @@ -23,9 +23,9 @@ $if(it.url)$ | |||
| 23 | $elseif(it.category)$ | 23 | $elseif(it.category)$ |
| 24 | <small class="u-d-block">$it.category$</small> | 24 | <small class="u-d-block">$it.category$</small> |
| 25 | <strong class="u-d-block">$it.title$</strong> | 25 | <strong class="u-d-block">$it.title$</strong> |
| 26 | $elseif(it.date)$ | 26 | $elseif(it.last_update)$ |
| 27 | <small> | 27 | <small> |
| 28 | <time datetime="$it.date.yyyy_mm_dd$">$it.date.long$</time> | 28 | <time datetime="$it.last_update.yyyy_mm_dd$">$it.last_update.long$</time> |
| 29 | </small> | 29 | </small> |
| 30 | <strong class="u-d-block">$it.title$</strong> | 30 | <strong class="u-d-block">$it.title$</strong> |
| 31 | $else$ | 31 | $else$ |
| @@ -45,10 +45,10 @@ $if(it.url)$ | |||
| 45 | <small class="l-media__block u-d-none@sm-lo"> | 45 | <small class="l-media__block u-d-none@sm-lo"> |
| 46 | $it.category$ | 46 | $it.category$ |
| 47 | </small> | 47 | </small> |
| 48 | $elseif(it.date)$ | 48 | $elseif(it.last_update)$ |
| 49 | <small class="l-media__block u-d-none@sm-lo"> | 49 | <small class="l-media__block u-d-none@sm-lo"> |
| 50 | <time datetime="$it.date.yyyy_mm_dd$" itemprop="dateCreated"> | 50 | <time datetime="$it.last_update.yyyy_mm_dd$" itemprop="dateCreated"> |
| 51 | $it.date.short$ | 51 | $it.last_update.short$ |
| 52 | </time> | 52 | </time> |
| 53 | </small> | 53 | </small> |
| 54 | $endif$ | 54 | $endif$ |
