#let tag = tagname => [ #metadata(tagname) ] #let wl(path, txt, frag) = { let fragtext = if frag == none { "" } else { "#" + frag } let texttext = if txt == none { path.split("/").at(-1) } else { txt } link(path + ".html" + fragtext, texttext) } #let conf( page-title: "", title-override: none, subtitle: none, notoc: false, nofoot: false, page-script: none, doc, ) = { let sitename = [Annwan's Wiki] // matches [[path|text!fragments]] with opt texts and fragment let link-re = regex( "\\[\\[([^\\]\\|!]+)(?:\\|([^\\]\\|!]+))?(?:!([^\\]\\|!]+))?\\]\\]", ) let actual-title = if title-override != none { title-override } else { page-title } show figure.where(kind: "gloss"): set figure(supplement: [Example]) show figure.where(kind: "gloss"): set figure.caption(position: top) show figure: it => { html.details(open: it.kind == image or it.kind == table, { html.summary[*#it.caption.supplement #it.caption.counter.display(it.numbering)*: #it.caption.body] it.body }) } show regex("%[a-z0-9/-]+"): it => tag(it.text.slice(1)) show link-re: it => wl(..it.text.match(link-re).captures) set table(stroke: none) set raw(theme: "/templates/gruvbox.tmTheme") html.head({ html.link(rel: "stylesheet", href: "/assets/style/common.css") html.meta(charset: "utf-8") html.meta(name: "viewport", content: "width=device-width, initial-scale=1") html.meta(name: "search-title", content: actual-title, id: "search-title") context html.meta( content: { let t = query().map(it => it.value).join(" ") if type(t) != str { "" } else { t } }, name: "search-tags", id: "search-tags", ) html.title(sitename + " — " + actual-title) html.script(src: "/assets/scripts/fuse.min.js") html.script(src: "/assets/scripts/search.js") if page-script != none { html.script(src: "/assets/scripts/pages/" + page-script + ".js") } }) html.header({ html.h1(html.a(href: "/", sitename)) html.nav(html.input(id: "searchbox", type: "text", placeholder: "Search...")) }) html.div(id: "results")[] html.div(id: "main-body", { html.main({ html.h1(page-title) html.hr() doc }) if (not notoc) { html.aside(outline()) } }) if (not nofoot) { html.footer[ #import sym: * Source code available on #link("https://git.annwan.me/worldbuilding/wiki")[my gitea instance]\ #actual-title on #sitename #copyright Annwan. This work is licensed under #link( "https://creativecommons.org/licenses/by-nc-sa/4.0/", )[CC BY-NC-SA 4.0] #cc #cc.by #cc.nc #cc.sa ] } } #let sitename = [Annwan's Wiki] #let s(script, body) = { html.span(class: "scr-" + script, body) } #let sc = smallcaps