mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
feat: generate tags for terms
This commit is contained in:
parent
4b57373653
commit
0df9da7ce6
@ -179,9 +179,9 @@ const TERMS_RULE: ShowFn<TermsElem> = |elem, _, styles| {
|
||||
for child in elem.children.iter() {
|
||||
let mut seq = vec![];
|
||||
seq.extend(unpad.clone());
|
||||
seq.push(child.term.clone().strong());
|
||||
seq.push(PdfMarkerTag::ListItemLabel(child.term.clone().strong()));
|
||||
seq.push(separator.clone());
|
||||
seq.push(child.description.clone());
|
||||
seq.push(PdfMarkerTag::ListItemBody(child.description.clone()));
|
||||
|
||||
// Text in wide term lists shall always turn into paragraphs.
|
||||
if !tight {
|
||||
|
@ -18,7 +18,7 @@ use typst_library::introspection::Location;
|
||||
use typst_library::layout::RepeatElem;
|
||||
use typst_library::model::{
|
||||
Destination, EnumElem, FigureCaption, FigureElem, HeadingElem, ListElem, Outlinable,
|
||||
OutlineEntry, TableCell, TableElem,
|
||||
OutlineEntry, TableCell, TableElem, TermsElem,
|
||||
};
|
||||
use typst_library::pdf::{ArtifactElem, ArtifactKind, PdfMarkerTag, PdfMarkerTagKind};
|
||||
use typst_library::visualize::ImageElem;
|
||||
@ -81,6 +81,10 @@ pub(crate) fn handle_start(
|
||||
let numbering = ListNumbering::Decimal; // TODO: infer numbering from `enum.numbering`
|
||||
push_stack(gc, loc, StackEntryKind::List(ListCtx::new(numbering)))?;
|
||||
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>() {
|
||||
// Wrap the figure tag and the sibling caption in a container, if the
|
||||
// caption is contained within the figure like recommended for tables
|
||||
|
Loading…
x
Reference in New Issue
Block a user