From f9a52508e518c9973f66186efc43b1ad24ea7289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Mon, 30 Dec 2024 23:35:06 +0100 Subject: [PATCH 01/13] fix: Markdown is no longer supported in listings (>= 1.7.5) Fixes #11758 --- .../projects/website/listing/_filter.ejs.md | 31 +++--- .../projects/website/listing/_metadata.ejs.md | 2 + .../website/listing/_pagination.ejs.md | 8 +- .../website/listing/item-default.ejs.md | 64 +++++++---- .../projects/website/listing/item-grid.ejs.md | 102 ++++++++++-------- .../website/listing/listing-default.ejs.md | 6 +- .../website/listing/listing-grid.ejs.md | 6 +- .../website/listing/listing-table.ejs.md | 4 +- 8 files changed, 132 insertions(+), 91 deletions(-) diff --git a/src/resources/projects/website/listing/_filter.ejs.md b/src/resources/projects/website/listing/_filter.ejs.md index c72ec41fad..5dc37fa3b0 100644 --- a/src/resources/projects/website/listing/_filter.ejs.md +++ b/src/resources/projects/website/listing/_filter.ejs.md @@ -10,32 +10,29 @@ const sortUi = listing['sort-ui']; <% const sortableFields = listing.utilities.sortableFieldData(); %> <% if (sortUi && sortableFields.length > 0) { %>
- - " + aria-label="<%- listing.utilities.localizedString("listing-page-order-by") %>" onChange="window['quarto-listings']['listing-<%- listing.id %>'].sort(this.options[this.selectedIndex].value, { order: this.options[this.selectedIndex].getAttribute('data-direction')})" > - - - <% for (const sortData of sortableFields) { %> - - <% } %> - + + + <% for (const sortData of sortableFields) { %> + + <% } %> +
- - <% } %> - <% if (filterUi) { %>
- " /> + " />
<% } %> diff --git a/src/resources/projects/website/listing/_metadata.ejs.md b/src/resources/projects/website/listing/_metadata.ejs.md index 45d19c4a7e..7c26782f35 100644 --- a/src/resources/projects/website/listing/_metadata.ejs.md +++ b/src/resources/projects/website/listing/_metadata.ejs.md @@ -2,7 +2,9 @@ const categories = item.categories !== undefined ? item.categories.join(',') : undefined; %> +```{=html}
<% if (categories !== undefined) { %><% } %>
+``` diff --git a/src/resources/projects/website/listing/_pagination.ejs.md b/src/resources/projects/website/listing/_pagination.ejs.md index 046b3f0818..5ec6d25200 100644 --- a/src/resources/projects/website/listing/_pagination.ejs.md +++ b/src/resources/projects/website/listing/_pagination.ejs.md @@ -1,8 +1,10 @@ -
<%- listing.utilities.localizedString("listing-page-no-matches")%>
-<% if (listing["page-size"] < items.length) { %> ```{=html} +
+<%- listing.utilities.localizedString("listing-page-no-matches") %> +
+<% if (listing["page-size"] < items.length) { %> -``` <% } %> +``` diff --git a/src/resources/projects/website/listing/item-default.ejs.md b/src/resources/projects/website/listing/item-default.ejs.md index edaebc664f..a433061c83 100644 --- a/src/resources/projects/website/listing/item-default.ejs.md +++ b/src/resources/projects/website/listing/item-default.ejs.md @@ -31,44 +31,64 @@ return value; let value = readField(item, field); if (value !== undefined) { -print(`
${listing.utilities.outputLink(item, field, value)}
`); +print(`
${listing.utilities.outputLink(item, field, value)}
`); } } %> -
> +::: {.quarto-post .image-<%= imageAlign %> <%= listing.utilities.metadataAttrs(item) %>} + <% if (fields.includes('image')) { %> -
- +` +`
`{=html} <% } %> -
+ +::: {.body} + <% if (fields.includes('title')) { %> -

<%= item.title %>

- +`

`{=html} <%= item.title %> `

`{=html} +<% if (fields.includes('subtitle')) { %> +``{=html} +<% } %> <% } %> -<% if (fields.includes('categories') && item.categories) { %> -
+ +<% if (fields.includes('categories') && item.categories) { %> +`
`{=html} <% for (const category of item.categories) { %> -
<%= category %>
+`
`{=html} <%= category %> `
`{=html} +<% } %> +`
`{=html} <% } %> -
-<% } %> + <% if (fields.includes('description')) { %> - +``{=html} +<% } %> + +::: + +::: {.metadata} +``{=html} +<% if (fields.includes('date') && item.date) { %> +`
`{=html} <%= item.date %> `
`{=html} +<% } %> + +<% if (fields.includes('author') && item.author) { %> +`
`{=html} <%= item.author %> `
`{=html} <% } %> -
-
-<% if (fields.includes('date') && item.date) { %>
<%= item.date %>
<% } %> -<% if (fields.includes('author') && item.author) { %>
<%= item.author %>
<% } %> -<% if (fields.includes('reading-time') && item['reading-time']) { %>
<%= item['reading-time'] %>
<% } %> + +<% if (fields.includes('reading-time') && item['reading-time']) { %> +`
`{=html} <%= item['reading-time'] %> `
`{=html} +<% } %> + <% for (const field of otherFields) { %> -<% outputMetadata(item, field) %><% } %>
+<% outputMetadata(item, field) %> +<% } %> +``{=html} +::: -
+::: diff --git a/src/resources/projects/website/listing/item-grid.ejs.md b/src/resources/projects/website/listing/item-grid.ejs.md index a584349734..8c49b15150 100644 --- a/src/resources/projects/website/listing/item-grid.ejs.md +++ b/src/resources/projects/website/listing/item-grid.ejs.md @@ -37,17 +37,18 @@ return !["title", "image", "image-alt", "date", "author", "subtitle", "descripti }); %> -
> +::: {.g-col-1 <%= listing.utilities.metadataAttrs(item) %> } + +```{=html} -
+
+``` <% if (fields.includes('image')) { %> - <% if (item.image) { %> - -

+`

`{=html} <%= listing.utilities.img(itemNumber, item.image, "thumbnail-image card-img", item['image-alt'], item['image-lazy-loading'] ?? listing['image-lazy-loading']) %> -

+`

`{=html} <% } else { %> <%= listing.utilities.imgPlaceholder(listing.id, itemNumber, item.outputHref) %> <% } %> @@ -55,65 +56,82 @@ return !["title", "image", "image-alt", "date", "author", "subtitle", "descripti <% } %> <% if (showField('title') || showField('subtitle') || showField('description') || showField('author') || showField('date') || otherFields.length > 0) { %> -
-<% if (showField('title')) { %>
<%= item.title %>
<% } %> -<% if (showField('subtitle')) { %>
<%= item.subtitle %>
<% } %> -<% if (showField('reading-time')) { %>
<%= item['reading-time'] %>
<% } %> +`
`{=html} + +<% if (showField('title')) { %> +`
`{=html} <%= item.title %> `
`{=html} +<% } %> + +<% if (showField('subtitle')) { %> +`
`{=html} <%= item.subtitle %> `
`{=html} +<% } %> + +<% if (showField('reading-time')) { %> +`
`{=html} <%= item['reading-time'] %> `
`{=html} +<% } %> <% if (fields.includes('categories') && item.categories) { %> +`
`{=html} -
- <% for (const category of item.categories) { %> -
<%= category %>
- <% } %> -
+<% for (const category of item.categories) { %> +`
`{=html} <%= category %> `
`{=html} +<% } %> +`
`{=html} <% } %> -<% if (showField('description')) { %> - +<% if (showField('description')) { %> +``{=html} <% } %> -<% + +<% const flexJustify = showField('author') && showField('date') ? "justify" : showField('author') ? "start" : "end"; %> + <% if (showField('author') || showField('date')) { %> -
-<% if (showField('author')) { %>
<%= item.author %>
<% } %> -<% if (showField('date')) { %>
<%= item.date %>
<% } %> -
+`
`{=html} + +<% if (showField('author')) { %> +`
`{=html} <%= item.author %> `
`{=html} <% } %> -<% if (otherFields.length > 0) { %> +<% if (showField('date')) { %> +`
`{=html} <%= item.date %> `
`{=html} +<% } %> - -<% for (const field of otherFields) { -let value = readField(item, field); -%> - - - - +``{=html} <% } %> -
<%= listing.utilities.fieldName(field) %><%= listing.utilities.outputLink(item, field, value) %>
+<% if (otherFields.length > 0) { %> +``{=html} +<% for (const field of otherFields) { +let value = readField(item, field); +%> +``{=html} +``{=html} +``{=html} +``{=html} +<% } %> +`
`{=html} <%= listing.utilities.fieldName(field) %> ``{=html} <%= listing.utilities.outputLink(item, field, value) %> `
`{=html} <% } %> -
+`
`{=html} <% } %> <% if (fields.includes('filename') || fields.includes('file-modified')) { %> -`{=html} <% } %> -
+`
`{=html} + +::: diff --git a/src/resources/projects/website/listing/listing-default.ejs.md b/src/resources/projects/website/listing/listing-default.ejs.md index c95f18c77d..4ffe8c2213 100644 --- a/src/resources/projects/website/listing/listing-default.ejs.md +++ b/src/resources/projects/website/listing/listing-default.ejs.md @@ -1,7 +1,7 @@ -:::{.list .quarto-listing-default} -``````{=html} +::: {.list .quarto-listing-default} + <% for (const item of items) { %> <% partial('item-default.ejs.md', {listing, item, utils }) %> <% } %> -`````` + ::: diff --git a/src/resources/projects/website/listing/listing-grid.ejs.md b/src/resources/projects/website/listing/listing-grid.ejs.md index f049b94bb3..19d7382972 100644 --- a/src/resources/projects/website/listing/listing-grid.ejs.md +++ b/src/resources/projects/website/listing/listing-grid.ejs.md @@ -2,10 +2,10 @@ const cols = listing['grid-columns']; %> -:::{.list .grid .quarto-listing-cols-<%=cols%>} -```{=html} +::: {.list .grid .quarto-listing-cols-<%= cols %>} + <% for (const item of items) { %> <% partial('item-grid.ejs.md', {listing, item, utils }) %> <% } %> -``` + ::: diff --git a/src/resources/projects/website/listing/listing-table.ejs.md b/src/resources/projects/website/listing/listing-table.ejs.md index 864a26f70f..a5d78321ac 100644 --- a/src/resources/projects/website/listing/listing-table.ejs.md +++ b/src/resources/projects/website/listing/listing-table.ejs.md @@ -84,11 +84,13 @@ return listing.utilities.outputLink(item, field, value, `listing-${field}`); <%= onclick(item) %>> <% for (const field of fields){ %> +``` <%= outputValue(itemNumber, field) %> +```{=html} <% } %> <% } %> -``` \ No newline at end of file +``` From 4b4c36b8f1e05221de0587b237b15fd9c44e17dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Mon, 30 Dec 2024 23:41:51 +0100 Subject: [PATCH 02/13] revert: unwanted change --- src/resources/projects/website/listing/_filter.ejs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/projects/website/listing/_filter.ejs.md b/src/resources/projects/website/listing/_filter.ejs.md index 5dc37fa3b0..7e39a22d7e 100644 --- a/src/resources/projects/website/listing/_filter.ejs.md +++ b/src/resources/projects/website/listing/_filter.ejs.md @@ -23,7 +23,7 @@ const sortUi = listing['sort-ui']; <% } %> From 0f779cf95845d3cd550d6adaa9b6f03ee12a0da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:43:37 +0100 Subject: [PATCH 03/13] fix: use markdown div thus no raw block --- .../projects/website/listing/_pagination.ejs.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/resources/projects/website/listing/_pagination.ejs.md b/src/resources/projects/website/listing/_pagination.ejs.md index 5ec6d25200..c4db479dfa 100644 --- a/src/resources/projects/website/listing/_pagination.ejs.md +++ b/src/resources/projects/website/listing/_pagination.ejs.md @@ -1,10 +1,13 @@ -```{=html} -
+::: {.listing-no-matching .d-none} <%- listing.utilities.localizedString("listing-page-no-matches") %> -
+::: + <% if (listing["page-size"] < items.length) { %> + +```{=html} -<% } %> ``` + +<% } %> From 911207e1c1761f7fca002471f200d183e085c0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:46:56 +0100 Subject: [PATCH 04/13] refactor: use markdown syntax --- .../projects/website/listing/_metadata.ejs.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/resources/projects/website/listing/_metadata.ejs.md b/src/resources/projects/website/listing/_metadata.ejs.md index 7c26782f35..25ad0a5700 100644 --- a/src/resources/projects/website/listing/_metadata.ejs.md +++ b/src/resources/projects/website/listing/_metadata.ejs.md @@ -2,9 +2,9 @@ const categories = item.categories !== undefined ? item.categories.join(',') : undefined; %> -```{=html} -
- -<% if (categories !== undefined) { %><% } %> -
-``` +::: {.quarto-listing-item-metadata" style-"display:none;"} +[]{.original-value data-original-value="${itemNumber}" style="display:none;"} +<% if (categories !== undefined) { %> +[]{.categories data-categories="${categories}" style="display:none;"} +<% } %> +::: From 8463bc7200ac86d87282a6f3981be8d178433a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:54:36 +0100 Subject: [PATCH 05/13] revert: use raw block to avoid "p" --- .../projects/website/listing/_metadata.ejs.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/resources/projects/website/listing/_metadata.ejs.md b/src/resources/projects/website/listing/_metadata.ejs.md index 25ad0a5700..7c26782f35 100644 --- a/src/resources/projects/website/listing/_metadata.ejs.md +++ b/src/resources/projects/website/listing/_metadata.ejs.md @@ -2,9 +2,9 @@ const categories = item.categories !== undefined ? item.categories.join(',') : undefined; %> -::: {.quarto-listing-item-metadata" style-"display:none;"} -[]{.original-value data-original-value="${itemNumber}" style="display:none;"} -<% if (categories !== undefined) { %> -[]{.categories data-categories="${categories}" style="display:none;"} -<% } %> -::: +```{=html} +
+ +<% if (categories !== undefined) { %><% } %> +
+``` From 0af2dd7a61c82cb704a8f8c031f0a6757553e5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:54:53 +0100 Subject: [PATCH 06/13] fix: typo in div code --- src/resources/projects/website/listing/_metadata.ejs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/projects/website/listing/_metadata.ejs.md b/src/resources/projects/website/listing/_metadata.ejs.md index 7c26782f35..725c37df0c 100644 --- a/src/resources/projects/website/listing/_metadata.ejs.md +++ b/src/resources/projects/website/listing/_metadata.ejs.md @@ -3,7 +3,7 @@ const categories = item.categories !== undefined ? item.categories.join(',') : u %> ```{=html} -
+ From 5d1ef85a00739ff669d72e735f12e781a5234c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:57:56 +0100 Subject: [PATCH 07/13] refactor: put if/else inside code block --- src/resources/projects/website/listing/_pagination.ejs.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/resources/projects/website/listing/_pagination.ejs.md b/src/resources/projects/website/listing/_pagination.ejs.md index c4db479dfa..d391b4a48a 100644 --- a/src/resources/projects/website/listing/_pagination.ejs.md +++ b/src/resources/projects/website/listing/_pagination.ejs.md @@ -2,12 +2,10 @@ <%- listing.utilities.localizedString("listing-page-no-matches") %> ::: -<% if (listing["page-size"] < items.length) { %> - ```{=html} +<% if (listing["page-size"] < items.length) { %> -``` - <% } %> +``` From 0aafe422f28cf9a29bdd9120160aa0bb5abea8c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:09:21 +0100 Subject: [PATCH 08/13] fix: use raw block for localizedString and don't escape content --- src/resources/projects/website/listing/_filter.ejs.md | 8 ++++---- src/resources/projects/website/listing/_pagination.ejs.md | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/resources/projects/website/listing/_filter.ejs.md b/src/resources/projects/website/listing/_filter.ejs.md index 7e39a22d7e..2f2948c46a 100644 --- a/src/resources/projects/website/listing/_filter.ejs.md +++ b/src/resources/projects/website/listing/_filter.ejs.md @@ -14,11 +14,11 @@ const sortUi = listing['sort-ui']; " /> + " />
<% } %>
diff --git a/src/resources/projects/website/listing/_pagination.ejs.md b/src/resources/projects/website/listing/_pagination.ejs.md index d391b4a48a..e8c89eff8c 100644 --- a/src/resources/projects/website/listing/_pagination.ejs.md +++ b/src/resources/projects/website/listing/_pagination.ejs.md @@ -1,8 +1,5 @@ -::: {.listing-no-matching .d-none} -<%- listing.utilities.localizedString("listing-page-no-matches") %> -::: - ```{=html} +
<%= listing.utilities.localizedString("listing-page-no-matches") %>
<% if (listing["page-size"] < items.length) { %>