90 lines
2.8 KiB
Typst
90 lines
2.8 KiB
Typst
#import "./html_head.typ": html-head
|
|
#import "./html_body.typ": html-body
|
|
#import "./html_utils.typ": html-show
|
|
#import "./summary.typ": summary, card-list
|
|
#import "./pyscript.typ": state-use-pyscript, state-pyscript-data-list, state-pyscript-version, state-pyscript-interpreters, state-pyscript-default-interpreter, pyscript-show, pyscript-data
|
|
#import "./rss.typ": rss
|
|
#import "./icons.typ"
|
|
|
|
|
|
/// Mail template function
|
|
#let webpage(
|
|
/// Page url
|
|
url: none,
|
|
/// Title of the page, default to document.title
|
|
title: none,
|
|
/// Use only for html 'lang' attribute.
|
|
lang: "en",
|
|
//-- <head> only args --
|
|
/// Website icon, *needs* to be path (TODO: fix when typst support multi-file out)
|
|
icon: none,
|
|
/// Type of the page for open-graph data
|
|
og-type: "website",
|
|
/// Name of the site for metadata of the page
|
|
site-name: none,
|
|
/// Description of the site for metadata, default to document.description
|
|
description: none,
|
|
/// Author of the site for metadata, default to document.author
|
|
author: none,
|
|
/// Tags describing the content of the page
|
|
tags: (),
|
|
/// Additional stylesheet for the page: must be a list of url
|
|
stylesheets: (),
|
|
/// List of related sites for metadata
|
|
me-links: (),
|
|
/// Dictionnary of available pyscript-data for each versions of pyscript
|
|
/// expected in the form of ("<version>": pyscript-data-list("<url>", { html.link(...) }), ...)
|
|
pyscript-data-list: (:),
|
|
/// Dictionnary of available python version to add in header for each pyscript interpreter
|
|
pyscript-interpreters: (:),
|
|
/// Pyscript version to use
|
|
pyscript-version: none,
|
|
/// Default python version to use for selecting the pyscript interpreter
|
|
pyscript-default-interpreter: none,
|
|
//-- Body --
|
|
/// Array of element to add on the top left of the page
|
|
nav-elements: none,
|
|
/// Navigation menu content, css style expect a list of links, but it can
|
|
/// be anything
|
|
menu: none,
|
|
/// Logo in page header
|
|
logo: none,
|
|
/// Page header
|
|
header: none,
|
|
/// Page footer
|
|
footer: none,
|
|
/// Body of the page
|
|
body
|
|
) = {
|
|
assert(type(url) == str, message: "A page must have an url")
|
|
context {
|
|
state-pyscript-data-list.update(x => pyscript-data-list)
|
|
state-pyscript-interpreters.update(x => pyscript-interpreters)
|
|
state-pyscript-version.update(x => pyscript-version)
|
|
state-pyscript-default-interpreter.update(x => pyscript-default-interpreter)
|
|
}
|
|
show: html-show
|
|
show raw.where(block: true, lang: "python-run"): pyscript-show
|
|
html.html(lang: lang, {
|
|
html-head(
|
|
url,
|
|
title,
|
|
icon: icon,
|
|
og-type: og-type,
|
|
site-name: site-name,
|
|
description: description,
|
|
author: author,
|
|
tags: tags,
|
|
stylesheets: stylesheets,
|
|
me-links: me-links
|
|
)
|
|
html-body(
|
|
logo: logo,
|
|
header: header,
|
|
footer: footer,
|
|
nav-elements: nav-elements,
|
|
menu: menu,
|
|
body
|
|
)
|
|
})
|
|
}
|