Ensure par and align interrupt cite groups and lists (#5526)

This commit is contained in:
PgBiel 2024-12-08 13:25:47 -03:00 committed by GitHub
parent 50dcacea9a
commit a1a5215234
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 68 additions and 2 deletions

View File

@ -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>,
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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