mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Ensure par and align interrupt cite groups and lists (#5526)
This commit is contained in:
parent
50dcacea9a
commit
a1a5215234
@ -836,7 +836,9 @@ static CITES: GroupingRule = GroupingRule {
|
||||
tags: false,
|
||||
trigger: |content, _| content.elem() == CiteElem::elem(),
|
||||
inner: |content| content.elem() == SpaceElem::elem(),
|
||||
interrupt: |elem| elem == CiteGroup::elem(),
|
||||
interrupt: |elem| {
|
||||
elem == CiteGroup::elem() || elem == ParElem::elem() || elem == AlignElem::elem()
|
||||
},
|
||||
finish: finish_cites,
|
||||
};
|
||||
|
||||
@ -859,7 +861,7 @@ const fn list_like_grouping<T: ListLike>() -> GroupingRule {
|
||||
let elem = content.elem();
|
||||
elem == SpaceElem::elem() || elem == ParbreakElem::elem()
|
||||
},
|
||||
interrupt: |elem| elem == T::elem(),
|
||||
interrupt: |elem| elem == T::elem() || elem == AlignElem::elem(),
|
||||
finish: finish_list_like::<T>,
|
||||
}
|
||||
}
|
||||
|
BIN
tests/ref/issue-5503-cite-group-interrupted-by-par-align.png
Normal file
BIN
tests/ref/issue-5503-cite-group-interrupted-by-par-align.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
tests/ref/issue-5503-cite-in-align.png
Normal file
BIN
tests/ref/issue-5503-cite-in-align.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 393 B |
BIN
tests/ref/issue-5503-enum-interrupted-by-par-align.png
Normal file
BIN
tests/ref/issue-5503-enum-interrupted-by-par-align.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1004 B |
BIN
tests/ref/issue-5503-list-interrupted-by-par-align.png
Normal file
BIN
tests/ref/issue-5503-list-interrupted-by-par-align.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 415 B |
BIN
tests/ref/issue-5503-terms-interrupted-by-par-align.png
Normal file
BIN
tests/ref/issue-5503-terms-interrupted-by-par-align.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 569 B |
@ -114,6 +114,28 @@ B #cite(<netwok>) #cite(<arrgh>).
|
||||
#show bibliography: none
|
||||
#bibliography("/assets/bib/works.bib", style: "chicago-author-date")
|
||||
|
||||
--- issue-5503-cite-in-align ---
|
||||
// The two aligned elements should be displayed in separate lines.
|
||||
#align(right)[@netwok]
|
||||
#align(right)[b]
|
||||
|
||||
#show bibliography: none
|
||||
#bibliography("/assets/bib/works.bib")
|
||||
|
||||
--- issue-5503-cite-group-interrupted-by-par-align ---
|
||||
// `par` and `align` are block-level and should interrupt a cite group
|
||||
@netwok
|
||||
@arrgh
|
||||
#par(leading: 5em)[@netwok]
|
||||
#par[@arrgh]
|
||||
@netwok
|
||||
@arrgh
|
||||
#align(right)[@netwok]
|
||||
@arrgh
|
||||
|
||||
#show bibliography: none
|
||||
#bibliography("/assets/bib/works.bib")
|
||||
|
||||
--- cite-type-error-hint ---
|
||||
// Test hint for cast error from str to label
|
||||
// Error: 7-15 expected label, found string
|
||||
|
@ -163,3 +163,15 @@ a + 0.
|
||||
// Enum item (pre-emptive)
|
||||
#enum.item(none)[Hello]
|
||||
#enum.item(17)[Hello]
|
||||
|
||||
--- issue-5503-enum-interrupted-by-par-align ---
|
||||
// `align` is block-level and should interrupt an enum
|
||||
// but not a `par`
|
||||
+ a
|
||||
+ b
|
||||
#par(leading: 5em)[+ par]
|
||||
+ d
|
||||
#par[+ par]
|
||||
+ f
|
||||
#align(right)[+ align]
|
||||
+ h
|
||||
|
@ -218,3 +218,18 @@ World
|
||||
part($ x $ + parbreak() + list[A])
|
||||
part($ x $ + parbreak() + parbreak() + list[A])
|
||||
}
|
||||
|
||||
--- issue-5503-list-interrupted-by-par-align ---
|
||||
// `align` is block-level and should interrupt a list
|
||||
// but not a `par`
|
||||
#show list: [List]
|
||||
- a
|
||||
- b
|
||||
#par(leading: 5em)[- c]
|
||||
- d
|
||||
- e
|
||||
#par[- f]
|
||||
- g
|
||||
- h
|
||||
#align(right)[- i]
|
||||
- j
|
||||
|
@ -75,3 +75,18 @@ Not in list
|
||||
--- issue-2530-term-item-panic ---
|
||||
// Term item (pre-emptive)
|
||||
#terms.item[Hello][World!]
|
||||
|
||||
--- issue-5503-terms-interrupted-by-par-align ---
|
||||
// `align` is block-level and should interrupt a `terms`
|
||||
// but not a `par`
|
||||
#show terms: [Terms]
|
||||
/ a: a
|
||||
/ b: b
|
||||
#par(leading: 5em)[/ c: c]
|
||||
/ d: d
|
||||
/ e: e
|
||||
#par[/ f: f]
|
||||
/ g: g
|
||||
/ h: h
|
||||
#align(right)[/ i: i]
|
||||
/ j: j
|
||||
|
Loading…
x
Reference in New Issue
Block a user