Compare commits

..

2 Commits

Author SHA1 Message Date
Tobias Schmitz
7b629fc45a
WIP [no ci] 2025-07-02 23:47:34 +02:00
Tobias Schmitz
da5ed2e6ee
feat: [no ci] generate headers attribute table cells
- fix marking repeated headers/footers as artifacts
- fix table row grouping with empty cells
2025-07-02 23:47:34 +02:00

View File

@ -870,17 +870,13 @@ 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 => {
// 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())
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)
},
}