mirror of
https://github.com/typst/typst
synced 2025-08-20 09:49:02 +08:00
Compare commits
2 Commits
7b629fc45a
...
c15c5d8e21
Author | SHA1 | Date | |
---|---|---|---|
|
c15c5d8e21 | ||
|
bf352e3300 |
@ -870,13 +870,17 @@ cast! {
|
||||
"header" => Self::Header(NonZeroU32::ONE, TableHeaderScope::default()),
|
||||
"footer" => Self::Footer,
|
||||
"data" => Self::Data,
|
||||
// FIXME: this is a little bit implicit.
|
||||
// Make it more obvious that this should be a header.
|
||||
mut dict: Dict => {
|
||||
let level = dict.take("level")?.cast::<Option<_>>()?.unwrap_or(NonZeroU32::ONE);
|
||||
let scope = dict.take("scope")?.cast::<Option<_>>()?.unwrap_or_default();
|
||||
dict.finish(&["amount", "all"])?;
|
||||
Self::Header(level, scope)
|
||||
// TODO: have a `pdf.header` function instead?
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Cast)]
|
||||
enum HeaderKind {
|
||||
Header,
|
||||
}
|
||||
dict.take("kind")?.cast::<HeaderKind>()?;
|
||||
let level = dict.take("level").ok().map(|v| v.cast()).transpose()?;
|
||||
let scope = dict.take("scope").ok().map(|v| v.cast()).transpose()?;
|
||||
dict.finish(&["kind", "level", "scope"])?;
|
||||
Self::Header(level.unwrap_or(NonZeroU32::ONE), scope.unwrap_or_default())
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user