generate the summary and the document objects from inside the webpage() function
This commit is contained in:
parent
500a6ad181
commit
f7db139b0d
10 changed files with 234 additions and 144 deletions
|
|
@ -1,12 +1,14 @@
|
|||
#import "@local/template-web:0.0.1": webpage as webpage-org, icons
|
||||
|
||||
#let webpage = webpage-org.with(
|
||||
base-url: "http://test.example.com",
|
||||
logo: image(
|
||||
"/assets/platypus.png",
|
||||
alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.",
|
||||
height: 100pt,
|
||||
width: 100pt, // TODO 0.15 regression? in 0.14 setting the height was enough
|
||||
),
|
||||
author: "Me!",
|
||||
footer: context [
|
||||
|
||||
#sym.copyright #document.date.display("[year]") Histausse \
|
||||
|
|
@ -22,7 +24,7 @@
|
|||
height: 2em,
|
||||
)
|
||||
),*/
|
||||
html.a(href: "http://test.example.com", aria-label: "Home", icons.home-icon), // /!\ aria-label is important for accessibility /!\
|
||||
html.a(href: "/", aria-label: "Home", icons.home-icon), // /!\ aria-label is important for accessibility /!\
|
||||
html.a(href: "/feed.rss", aria-label: "RSS feed", icons.rss-icon),
|
||||
),
|
||||
menu: [
|
||||
|
|
|
|||
|
|
@ -1,26 +1,8 @@
|
|||
#import "@local/template-web:0.0.1": rss
|
||||
|
||||
#import "pages/index.typ": summ as summ-index
|
||||
#document(
|
||||
"index.html",
|
||||
..summ-index.document-args,
|
||||
include "/pages/index.typ"
|
||||
) <index-page>
|
||||
|
||||
#import "pages/pyscript.typ": summ as summ-pyscript
|
||||
#document(
|
||||
"pycript.html",
|
||||
..summ-pyscript.document-args,
|
||||
include "/pages/pyscript.typ"
|
||||
) <pyscript-page>
|
||||
|
||||
#import "pages/cards.typ": summ as summ-cards, summaries
|
||||
#document(
|
||||
"cards.html",
|
||||
..summ-cards.document-args,
|
||||
include "/pages/cards.typ"
|
||||
) <cards-page>
|
||||
#import "@local/template-web:0.0.1": rss, state-page-summaries
|
||||
|
||||
#include "/pages/index.typ"
|
||||
#include "/pages/pyscript.typ"
|
||||
#include "/pages/cards.typ"
|
||||
|
||||
#asset(
|
||||
"/img/platypus.png",
|
||||
|
|
@ -35,14 +17,14 @@
|
|||
read("assets/isn_s_cube-0.1.0-py3-none-any.whl", encoding: none),
|
||||
)
|
||||
|
||||
#asset(
|
||||
#context asset(
|
||||
"feed.rss",
|
||||
rss(
|
||||
"TeTyTe test typst template",
|
||||
"https://test.example.com",
|
||||
"Test of the TTT template",
|
||||
"https://test.example.com/rss.rss",
|
||||
summaries,
|
||||
state-page-summaries.final(),
|
||||
webmaster: "me@example.com (Me)",
|
||||
)
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,23 +1,18 @@
|
|||
#import "@local/template-web:0.0.1": *
|
||||
#import "/lib.typ": webpage
|
||||
|
||||
#let summ = summary(
|
||||
base-url: "http://test.example.com",
|
||||
#let preview-image = image(
|
||||
"/assets/platypus.png",
|
||||
alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.",
|
||||
)
|
||||
#show: webpage.with(
|
||||
path: "/cards.html",
|
||||
title: "Summary cards",
|
||||
page-label: <cards-page>,
|
||||
preview-image: image(
|
||||
"/assets/platypus.png",
|
||||
alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.",
|
||||
),
|
||||
author: "Me!",
|
||||
tags: ("test", "html/css", "typst"),
|
||||
description: "Showcase the summary card system",
|
||||
date: datetime(year: 1942, month: 4, day: 1),
|
||||
)
|
||||
|
||||
#show: webpage.with(
|
||||
..summ.template-args,
|
||||
tags: ("test", "html/css", "typst"),
|
||||
page-label: <cards-page>,
|
||||
preview-image: preview-image,
|
||||
header: [
|
||||
= Summary Cards
|
||||
Showcase summary cards
|
||||
|
|
@ -25,21 +20,20 @@
|
|||
)
|
||||
|
||||
|
||||
#summ.card
|
||||
#context state-page-summaries.at(here()).last().card
|
||||
|
||||
|
||||
#let perm = (17, 6, 20, 19, 15, 5, 13, 11, 14, 12, 16, 10, 2, 3, 1, 9, 7, 4, 18, 8)
|
||||
#let summaries = range(20).map(i =>
|
||||
summary(
|
||||
base-url: "http://test.example.com",
|
||||
path: "/tst/" + str(perm.at(i)),
|
||||
url: "https://example.com/tst/" + str(perm.at(i)),
|
||||
title: "Card " + str(perm.at(i)),
|
||||
tags: if perm.at(i) == 20 {
|
||||
("tag2", "tag5","loooooonnnnnnnnnnnnnng-tag","some-tag","some-other-tag")
|
||||
} else {
|
||||
(2, 3, 5, 7).filter(j => calc.rem(perm.at(i), j) == 0).map(j => "tag" + str(j))
|
||||
},
|
||||
preview-image: summ.preview-image,
|
||||
preview-image: preview-image,
|
||||
img-copyright: if calc.rem(i, 3) == 0 { [Histausse ] } else { none },
|
||||
author: "Me!",
|
||||
description: lorem(10 * calc.rem(i * 123, 10)),
|
||||
|
|
|
|||
|
|
@ -1,29 +1,28 @@
|
|||
#import "@local/template-web:0.0.1": *
|
||||
#import "/lib.typ": webpage
|
||||
|
||||
#let summ = summary(
|
||||
base-url: "http://test.example.com",
|
||||
#show: webpage.with(
|
||||
path: "/index.html",
|
||||
page-label: <index-page>,
|
||||
title: "TeTyTe",
|
||||
description: "Test of the TTT template",
|
||||
date: datetime(year: 1942, month: 4, day: 1),
|
||||
tags: ("test", "html/css", "typst"),
|
||||
page-label: <index-page>,
|
||||
preview-image: image(
|
||||
"/assets/platypus.png",
|
||||
alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.",
|
||||
),
|
||||
author: "Me!",
|
||||
tags: ("test", "html/css", "typst"),
|
||||
description: "Test of the TTT template",
|
||||
date: datetime(year: 1942, month: 4, day: 1),
|
||||
)
|
||||
|
||||
#show: webpage.with(
|
||||
..summ.template-args,
|
||||
header: [
|
||||
= Test TeTyTe
|
||||
Hello World!
|
||||
],
|
||||
)
|
||||
|
||||
#context card-list(
|
||||
min-width: 200,
|
||||
state-page-summaries.final(),
|
||||
)
|
||||
|
||||
|
||||
#lorem(400)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,17 @@
|
|||
#import "@local/template-web:0.0.1": *
|
||||
#import "/lib.typ": webpage
|
||||
|
||||
#let summ = summary(
|
||||
base-url: "http://test.example.com",
|
||||
#show: webpage.with(
|
||||
path: "/pycript.html",
|
||||
title: "TeTyTe",
|
||||
page-label: <pyscript-label>,
|
||||
description: "Demonstrate how to use pyscript to run python in the browser",
|
||||
tags: ("test", "html/css", "typst", "python"),
|
||||
date: datetime(year: 1942, month: 4, day: 1),
|
||||
page-label: <pyscript-page>,
|
||||
preview-image: image(
|
||||
"/assets/platypus.png",
|
||||
alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.",
|
||||
),
|
||||
author: "Me!",
|
||||
tags: ("test", "html/css", "typst", "pyscript"),
|
||||
description: "Demonstrate how to use pyscript to run python in the browser",
|
||||
date: datetime(year: 1942, month: 4, day: 1),
|
||||
)
|
||||
|
||||
#show: webpage.with(
|
||||
..summ.template-args,
|
||||
header: [
|
||||
= Showcase Pyscript
|
||||
Show how to run Python in the browser
|
||||
|
|
@ -109,4 +103,3 @@ pprint([(k, v["title"]) for k, v in data.items()][:10])
|
|||
from isn_s_cube import wasm
|
||||
await wasm()
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue