mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
feat: mark numbering prefix of heading and outline as Lbl
This commit is contained in:
parent
0df9da7ce6
commit
451b0815ff
@ -275,7 +275,7 @@ const HEADING_RULE: ShowFn<HeadingElem> = |elem, engine, styles| {
|
||||
|
||||
let spacing = HElem::new(SPACING_TO_NUMBERING.into()).with_weak(true).pack();
|
||||
|
||||
realized = numbering + spacing + realized;
|
||||
realized = PdfMarkerTag::Label(numbering) + spacing + realized;
|
||||
}
|
||||
|
||||
let block = if indent != Abs::zero() {
|
||||
@ -477,7 +477,6 @@ const OUTLINE_ENTRY_RULE: ShowFn<OutlineEntry> = |elem, engine, styles| {
|
||||
let context = Context::new(None, Some(styles));
|
||||
let context = context.track();
|
||||
|
||||
// TODO(accessibility): prefix should be wrapped in a `Lbl` structure element
|
||||
let prefix = elem.prefix(engine, context, span)?;
|
||||
let body = elem.body().at(span)?;
|
||||
let page = elem.page(engine, context, span)?;
|
||||
|
@ -21,6 +21,7 @@ use crate::layout::{
|
||||
RepeatElem, Sides,
|
||||
};
|
||||
use crate::model::{HeadingElem, NumberingPattern, ParElem, Refable};
|
||||
use crate::pdf::PdfMarkerTag;
|
||||
use crate::text::{LocalName, SpaceElem, TextElem};
|
||||
|
||||
/// A table of contents, figures, or other elements.
|
||||
@ -493,7 +494,7 @@ impl OutlineEntry {
|
||||
let styles = context.styles().at(span)?;
|
||||
let numbers =
|
||||
outlinable.counter().display_at_loc(engine, loc, styles, numbering)?;
|
||||
Ok(Some(outlinable.prefix(numbers)))
|
||||
Ok(Some(PdfMarkerTag::Label(outlinable.prefix(numbers))))
|
||||
}
|
||||
|
||||
/// Creates the default inner content of the entry.
|
||||
|
@ -138,4 +138,6 @@ pdf_marker_tag! {
|
||||
ListItemLabel,
|
||||
/// `LBody` of the enum item
|
||||
ListItemBody,
|
||||
/// A generic `Lbl`
|
||||
Label,
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ pub(crate) fn handle_start(
|
||||
push_stack(gc, loc, StackEntryKind::ListItemBody)?;
|
||||
return Ok(());
|
||||
}
|
||||
PdfMarkerTagKind::Label => TagKind::Lbl.into(),
|
||||
}
|
||||
} else if let Some(entry) = elem.to_packed::<OutlineEntry>() {
|
||||
push_stack(gc, loc, StackEntryKind::OutlineEntry(entry.clone()))?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user