From 16d17f7ed7ceb862ec04a10b1259f18b095353c7 Mon Sep 17 00:00:00 2001 From: Jean-Marie 'Histausse' Mineau Date: Fri, 1 May 2026 18:44:23 +0200 Subject: [PATCH] add option to indicate image copyright for summary preview --- lib/summary.typ | 14 +++++++++++--- test_template/main.typ | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/summary.typ b/lib/summary.typ index 568f5e3..84bb9f8 100644 --- a/lib/summary.typ +++ b/lib/summary.typ @@ -23,10 +23,12 @@ } summary-card-preview { - display: block; + display: flex; + flex-direction: column; width: 100%; img { + display: block; width: 100%; height: 100%; object-fit: contain; @@ -54,9 +56,12 @@ } ``` chtml.summary-card({ - chtml.summary-card-preview( + chtml.summary-card-preview({ html.a(href: summ.template-args.url, summ.preview-image) - ) + if summ.img-copyright != none { + html.small[Image: #sym.copyright #summ.img-copyright] + } + }) chtml.summary-card-description({ heading(level: 2, html.a(href: summ.template-args.url, summ.document-args.title)) @@ -79,6 +84,8 @@ /// Right now, this cannot be used for link preview because open graph expect an url for the image, and typst inline /// the images directly in the html file in base64. preview-image: none, + /// The copyright for the image + img-copyright: none, /// The author or authors of the page author: none, /// A description of the page @@ -104,6 +111,7 @@ url: url, ), preview-image: preview-image, + img-copyright: img-copyright, card: [] ) summ.card = gen_summary_card(summ) diff --git a/test_template/main.typ b/test_template/main.typ index f684e0d..4d66161 100644 --- a/test_template/main.typ +++ b/test_template/main.typ @@ -172,6 +172,7 @@ thead { url: "http://test.example.com", title: "Card " + str(perm.at(i)), preview-image: summ.preview-image, + img-copyright: if calc.rem(i, 3) == 0 { [Histausse ] } else { none }, author: "Me!", description: lorem(10 * calc.rem(i * 123, 10)), date: datetime(year: 2000, month: 12, day: perm.at(i)),