114 lines
2.9 KiB
Typst
114 lines
2.9 KiB
Typst
#import "@preview/touying:0.7.4": *
|
|
#import "@preview/touying-unistra-pristine:1.4.3": *
|
|
#import "@local/codly:1.3.1"
|
|
|
|
// Adapted from:
|
|
// https://github.com/spidersouris/touying-unistra-pristine/blob/67084e00529991bfbd12152c0f074c582cba0093/src/unistra.typ#L22-L126
|
|
#let slide(
|
|
config: (:),
|
|
repeat: auto,
|
|
setting: body => body,
|
|
composer: auto,
|
|
..bodies,
|
|
) = touying-slide-wrapper(self => {
|
|
let footer(self) = {
|
|
let cell(body) = rect(
|
|
width: 100%,
|
|
height: 100%,
|
|
inset: 0mm,
|
|
outset: 0mm,
|
|
fill: none,
|
|
stroke: none,
|
|
text(size: 0.5em, fill: self.colors.black, body),
|
|
)
|
|
|
|
let author = self.info.author
|
|
let date = self.info.date
|
|
if self.store.footer-hide.contains("author") {
|
|
author = none
|
|
}
|
|
|
|
if self.store.footer-hide.contains("date") {
|
|
date = none
|
|
}
|
|
|
|
set align(center + horizon)
|
|
block(width: 101%, height: -25%, stroke: (top: 0.5pt + self.colors.black), {
|
|
set text(size: 1.5em)
|
|
|
|
// give priority to short, since long is also used in title slide
|
|
let title = self.info.title
|
|
if (self.info.short-title != auto) {
|
|
title = self.info.short-title
|
|
}
|
|
|
|
let first-col-width = 15%
|
|
let second-col-width = 75%
|
|
|
|
grid(
|
|
columns: (first-col-width, second-col-width, 10%),
|
|
rows: 0.5em,
|
|
stroke: (x: 1pt + self.colors.black),
|
|
cell(box(self.info.logo, height: 100%)),
|
|
cell(box(
|
|
width: 100%,
|
|
text(
|
|
title, // either title or short-title
|
|
weight: "bold",
|
|
)
|
|
+ self.store.footer-first-sep
|
|
+ if _is(author) { author }
|
|
+ if _is(date) and _is(author) {
|
|
self.store.footer-second-sep
|
|
} else { "" }
|
|
+ if _is(date) { date },
|
|
)),
|
|
cell(utils.call-or-display(self, context {
|
|
let current = int(utils.slide-counter.display())
|
|
let last = int(utils.last-slide-counter.display())
|
|
if current > last {
|
|
(
|
|
text(self.store.footer-appendix-label, style: "italic")
|
|
+ str(current)
|
|
)
|
|
} else {
|
|
str(current)
|
|
}
|
|
}
|
|
+ " / "
|
|
+ utils.last-slide-number)),
|
|
)
|
|
})
|
|
}
|
|
|
|
let store-header = self.store.show-header
|
|
let store-footer = self.store.show-footer
|
|
|
|
let self = utils.merge-dicts(self, config-page(
|
|
header: if store-header == true {
|
|
unistra-nav-bar(self)
|
|
} else if store-header == false {
|
|
none
|
|
} else {
|
|
store-header
|
|
},
|
|
footer: if store-footer == true {
|
|
footer
|
|
} else if store-footer == false {
|
|
none
|
|
} else {
|
|
store-footer
|
|
},
|
|
// todo: change if no footer/header, etc.
|
|
margin: (x: 3em, y: 2em),
|
|
))
|
|
|
|
touying-slide(
|
|
self: self,
|
|
config: config,
|
|
repeat: repeat,
|
|
setting: setting,
|
|
composer: composer,
|
|
..bodies,
|
|
)
|
|
}) |