From 20c5ad5a7a737d721cb39b75852a79f20502da74 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 31 Jul 2022 10:00:03 +0200 Subject: Simplified "list" list layout code --- scripts/metadata.lua | 2 +- templates/layouts/categorized_list.html | 7 ++++- templates/layouts/list.html | 7 ++++- templates/layouts/page.html | 13 +++------ templates/partials/gallery_card.html | 34 ++++++++++++++++------- templates/partials/grid_card.html | 40 ++++++++++++++++++++------- templates/partials/list_card.html | 48 +++++++++++---------------------- 7 files changed, 85 insertions(+), 66 deletions(-) diff --git a/scripts/metadata.lua b/scripts/metadata.lua index 142cb8b..a451040 100644 --- a/scripts/metadata.lua +++ b/scripts/metadata.lua @@ -297,7 +297,7 @@ function process(global, meta) meta.slug = slug(meta.title) meta.schema_type = (meta.schema_type and pandoc.utils.stringify(meta.schema_type)) or "CreativeWork" if meta.list_order then meta.list_order = pandoc.utils.stringify(meta.list_order) end - meta.list_layout = meta.list_layout and prep_layout(meta.list_layout) + meta.list_layout = prep_layout(meta.list_layout or "list") if meta.list_limit then meta.list_limit = tonumber(pandoc.utils.stringify(meta.list_limit)) end if meta.position then meta.position = tonumber(pandoc.utils.stringify(meta.position)) end diff --git a/templates/layouts/categorized_list.html b/templates/layouts/categorized_list.html index 1a1048a..67dc466 100644 --- a/templates/layouts/categorized_list.html +++ b/templates/layouts/categorized_list.html @@ -47,7 +47,12 @@ $body$ $elseif(it.layout.is_gallery-3)$ $it.items:partials/gallery_card()$ $else$ - $it.items:partials/list_card()$ +
+ $it.items:partials/list_card()$ +
+
+ $it.items:partials/grid_card()$ +
$endif$ $if(it.omitted)$ diff --git a/templates/layouts/list.html b/templates/layouts/list.html index 508ff4c..cf54c4b 100644 --- a/templates/layouts/list.html +++ b/templates/layouts/list.html @@ -24,7 +24,12 @@ $body$ $elseif(list_layout.is_gallery-3)$ $list:partials/gallery_card()$ $else$ - $list:partials/list_card()$ +
+ $list:partials/list_card()$ +
+
+ $list:partials/grid_card()$ +
$endif$ diff --git a/templates/layouts/page.html b/templates/layouts/page.html index 3ba8d54..234e50e 100644 --- a/templates/layouts/page.html +++ b/templates/layouts/page.html @@ -6,22 +6,15 @@ itemid="$url.full$" >
- $if(date)$ - - $endif$ - $if(was_updated)$ + $if(last_update)$ $endif$ $if(draft)$ - - Draft - + Draft $endif$

diff --git a/templates/partials/gallery_card.html b/templates/partials/gallery_card.html index a340148..4728461 100644 --- a/templates/partials/gallery_card.html +++ b/templates/partials/gallery_card.html @@ -1,11 +1,12 @@ -$if(it.thumbnail)$ @@ -32,14 +33,24 @@ $if(it.thumbnail)$ $if(it.subtitle)$
$it.title$ - $if(it.draft)$Draft$endif$ + $if(it.draft)$ + Draft + $endif$
- $it.subtitle$ + + $it.subtitle$ + $elseif(it.category)$ - $it.category$ + + $it.category$ +
- $it.title$ - $if(it.draft)$Draft$endif$ + + $it.title$ + + $if(it.draft)$ + Draft + $endif$
$elseif(it.show_date)$ @@ -49,13 +60,17 @@ $if(it.thumbnail)$
$it.title$ - $if(it.draft)$Draft$endif$ + $if(it.draft)$ + Draft + $endif$
$else$ $it.title$ - $if(it.draft)$Draft$endif$ + $if(it.draft)$ + Draft + $endif$ $endif$ $if(it.post_icon)$ @@ -65,4 +80,3 @@ $if(it.thumbnail)$ $endif$
-$endif$ diff --git a/templates/partials/grid_card.html b/templates/partials/grid_card.html index 170f478..9a0b06e 100644 --- a/templates/partials/grid_card.html +++ b/templates/partials/grid_card.html @@ -4,7 +4,9 @@ itemprop="dataFeedElement" itemscope itemtype="https://schema.org/$it.schema_type$" - $if(it.rel)$rel="$it.rel$"$endif$ + $if(it.rel)$ + rel="$it.rel$" + $endif$ >
$if(it.indicator)$ @@ -18,15 +20,27 @@
$if(it.subtitle)$
- $it.title$ - $if(it.draft)$Draft$endif$ + + $it.title$ + + $if(it.draft)$ + Draft + $endif$
- $it.subtitle$ + + $it.subtitle$ + $elseif(it.category)$ - $it.category$ + + $it.category$ +
- $it.title$ - $if(it.draft)$Draft$endif$ + + $it.title$ + + $if(it.draft)$ + Draft + $endif$
$elseif(it.show_date)$ @@ -35,14 +49,20 @@
- $it.title$ - $if(it.draft)$Draft$endif$ + + $it.title$ + + $if(it.draft)$ + Draft + $endif$
$else$ $it.title$ - $if(it.draft)$Draft$endif$ + $if(it.draft)$ + Draft + $endif$ $endif$
$if(it.post_icon)$ diff --git a/templates/partials/list_card.html b/templates/partials/list_card.html index 24948a6..e12f62f 100644 --- a/templates/partials/list_card.html +++ b/templates/partials/list_card.html @@ -4,7 +4,9 @@ itemprop="dataFeedElement" itemscope itemtype="https://schema.org/$it.schema_type$" - $if(it.rel)$rel="$it.rel$"$endif$ + $if(it.rel)$ + rel="$it.rel$" + $endif$ >
$if(it.indicator)$ @@ -15,42 +17,22 @@ $endif$ -
- $if(it.subtitle)$ - $it.subtitle$ -
- $it.title$ - $if(it.draft)$Draft$endif$ -
- $elseif(it.category)$ - $it.category$ -
- $it.title$ - $if(it.draft)$Draft$endif$ -
- $elseif(it.last_update)$ - - - -
- $it.title$ - $if(it.draft)$Draft$endif$ -
- $else$ - - $it.title$ - - $if(it.draft)$Draft$endif$ +
+ + $it.title$ + + $if(it.draft)$ + Draft $endif$ -
-
- $it.title$ - $if(it.draft)$Draft$endif$
$if(it.subtitle)$ - $it.subtitle$ + + $it.subtitle$ + $elseif(it.category)$ - $it.category$ + + $it.category$ + $elseif(it.show_date)$