mirror of
https://github.com/typst/typst
synced 2025-08-18 17:08:33 +08:00
Compare commits
No commits in common. "451b0815ff356c4d13b29c528e389e253d61dfe5" and "4b57373653903478bf8e8b3494796053a11fea3e" have entirely different histories.
451b0815ff
...
4b57373653
@ -179,9 +179,9 @@ const TERMS_RULE: ShowFn<TermsElem> = |elem, _, styles| {
|
|||||||
for child in elem.children.iter() {
|
for child in elem.children.iter() {
|
||||||
let mut seq = vec![];
|
let mut seq = vec![];
|
||||||
seq.extend(unpad.clone());
|
seq.extend(unpad.clone());
|
||||||
seq.push(PdfMarkerTag::ListItemLabel(child.term.clone().strong()));
|
seq.push(child.term.clone().strong());
|
||||||
seq.push(separator.clone());
|
seq.push(separator.clone());
|
||||||
seq.push(PdfMarkerTag::ListItemBody(child.description.clone()));
|
seq.push(child.description.clone());
|
||||||
|
|
||||||
// Text in wide term lists shall always turn into paragraphs.
|
// Text in wide term lists shall always turn into paragraphs.
|
||||||
if !tight {
|
if !tight {
|
||||||
@ -275,7 +275,7 @@ const HEADING_RULE: ShowFn<HeadingElem> = |elem, engine, styles| {
|
|||||||
|
|
||||||
let spacing = HElem::new(SPACING_TO_NUMBERING.into()).with_weak(true).pack();
|
let spacing = HElem::new(SPACING_TO_NUMBERING.into()).with_weak(true).pack();
|
||||||
|
|
||||||
realized = PdfMarkerTag::Label(numbering) + spacing + realized;
|
realized = numbering + spacing + realized;
|
||||||
}
|
}
|
||||||
|
|
||||||
let block = if indent != Abs::zero() {
|
let block = if indent != Abs::zero() {
|
||||||
@ -477,6 +477,7 @@ const OUTLINE_ENTRY_RULE: ShowFn<OutlineEntry> = |elem, engine, styles| {
|
|||||||
let context = Context::new(None, Some(styles));
|
let context = Context::new(None, Some(styles));
|
||||||
let context = context.track();
|
let context = context.track();
|
||||||
|
|
||||||
|
// TODO(accessibility): prefix should be wrapped in a `Lbl` structure element
|
||||||
let prefix = elem.prefix(engine, context, span)?;
|
let prefix = elem.prefix(engine, context, span)?;
|
||||||
let body = elem.body().at(span)?;
|
let body = elem.body().at(span)?;
|
||||||
let page = elem.page(engine, context, span)?;
|
let page = elem.page(engine, context, span)?;
|
||||||
|
@ -21,7 +21,6 @@ use crate::layout::{
|
|||||||
RepeatElem, Sides,
|
RepeatElem, Sides,
|
||||||
};
|
};
|
||||||
use crate::model::{HeadingElem, NumberingPattern, ParElem, Refable};
|
use crate::model::{HeadingElem, NumberingPattern, ParElem, Refable};
|
||||||
use crate::pdf::PdfMarkerTag;
|
|
||||||
use crate::text::{LocalName, SpaceElem, TextElem};
|
use crate::text::{LocalName, SpaceElem, TextElem};
|
||||||
|
|
||||||
/// A table of contents, figures, or other elements.
|
/// A table of contents, figures, or other elements.
|
||||||
@ -494,7 +493,7 @@ impl OutlineEntry {
|
|||||||
let styles = context.styles().at(span)?;
|
let styles = context.styles().at(span)?;
|
||||||
let numbers =
|
let numbers =
|
||||||
outlinable.counter().display_at_loc(engine, loc, styles, numbering)?;
|
outlinable.counter().display_at_loc(engine, loc, styles, numbering)?;
|
||||||
Ok(Some(PdfMarkerTag::Label(outlinable.prefix(numbers))))
|
Ok(Some(outlinable.prefix(numbers)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates the default inner content of the entry.
|
/// Creates the default inner content of the entry.
|
||||||
|
@ -138,6 +138,4 @@ pdf_marker_tag! {
|
|||||||
ListItemLabel,
|
ListItemLabel,
|
||||||
/// `LBody` of the enum item
|
/// `LBody` of the enum item
|
||||||
ListItemBody,
|
ListItemBody,
|
||||||
/// A generic `Lbl`
|
|
||||||
Label,
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ use typst_library::introspection::Location;
|
|||||||
use typst_library::layout::RepeatElem;
|
use typst_library::layout::RepeatElem;
|
||||||
use typst_library::model::{
|
use typst_library::model::{
|
||||||
Destination, EnumElem, FigureCaption, FigureElem, HeadingElem, ListElem, Outlinable,
|
Destination, EnumElem, FigureCaption, FigureElem, HeadingElem, ListElem, Outlinable,
|
||||||
OutlineEntry, TableCell, TableElem, TermsElem,
|
OutlineEntry, TableCell, TableElem,
|
||||||
};
|
};
|
||||||
use typst_library::pdf::{ArtifactElem, ArtifactKind, PdfMarkerTag, PdfMarkerTagKind};
|
use typst_library::pdf::{ArtifactElem, ArtifactKind, PdfMarkerTag, PdfMarkerTagKind};
|
||||||
use typst_library::visualize::ImageElem;
|
use typst_library::visualize::ImageElem;
|
||||||
@ -69,7 +69,6 @@ pub(crate) fn handle_start(
|
|||||||
push_stack(gc, loc, StackEntryKind::ListItemBody)?;
|
push_stack(gc, loc, StackEntryKind::ListItemBody)?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
PdfMarkerTagKind::Label => TagKind::Lbl.into(),
|
|
||||||
}
|
}
|
||||||
} else if let Some(entry) = elem.to_packed::<OutlineEntry>() {
|
} else if let Some(entry) = elem.to_packed::<OutlineEntry>() {
|
||||||
push_stack(gc, loc, StackEntryKind::OutlineEntry(entry.clone()))?;
|
push_stack(gc, loc, StackEntryKind::OutlineEntry(entry.clone()))?;
|
||||||
@ -82,10 +81,6 @@ pub(crate) fn handle_start(
|
|||||||
let numbering = ListNumbering::Decimal; // TODO: infer numbering from `enum.numbering`
|
let numbering = ListNumbering::Decimal; // TODO: infer numbering from `enum.numbering`
|
||||||
push_stack(gc, loc, StackEntryKind::List(ListCtx::new(numbering)))?;
|
push_stack(gc, loc, StackEntryKind::List(ListCtx::new(numbering)))?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else if let Some(_enumeration) = elem.to_packed::<TermsElem>() {
|
|
||||||
let numbering = ListNumbering::None;
|
|
||||||
push_stack(gc, loc, StackEntryKind::List(ListCtx::new(numbering)))?;
|
|
||||||
return Ok(());
|
|
||||||
} else if let Some(_) = elem.to_packed::<FigureElem>() {
|
} else if let Some(_) = elem.to_packed::<FigureElem>() {
|
||||||
// Wrap the figure tag and the sibling caption in a container, if the
|
// Wrap the figure tag and the sibling caption in a container, if the
|
||||||
// caption is contained within the figure like recommended for tables
|
// caption is contained within the figure like recommended for tables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user