parent
b23914fca9
commit
c641044380
@ -750,8 +750,10 @@ impl Default for ListBuilder<'_> {
|
||||
/// Accepts citations.
|
||||
#[derive(Default)]
|
||||
struct CiteGroupBuilder<'a> {
|
||||
/// The styles.
|
||||
styles: StyleChain<'a>,
|
||||
/// The citations.
|
||||
items: StyleVecBuilder<'a, CiteElem>,
|
||||
items: Vec<CiteElem>,
|
||||
/// Trailing content for which it is unclear whether it is part of the list.
|
||||
staged: Vec<(&'a Content, StyleChain<'a>)>,
|
||||
}
|
||||
@ -766,8 +768,11 @@ impl<'a> CiteGroupBuilder<'a> {
|
||||
}
|
||||
|
||||
if let Some(citation) = content.to::<CiteElem>() {
|
||||
if self.items.is_empty() {
|
||||
self.styles = styles;
|
||||
}
|
||||
self.staged.retain(|(elem, _)| !elem.is::<SpaceElem>());
|
||||
self.items.push(citation.clone(), styles);
|
||||
self.items.push(citation.clone());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -775,9 +780,7 @@ impl<'a> CiteGroupBuilder<'a> {
|
||||
}
|
||||
|
||||
fn finish(self) -> (Content, StyleChain<'a>) {
|
||||
let (items, styles) = self.items.finish();
|
||||
let items = items.into_items();
|
||||
let span = items.first().map(|cite| cite.span()).unwrap_or(Span::detached());
|
||||
(CiteGroup::new(items).pack().spanned(span), styles)
|
||||
let span = self.items.first().map(|cite| cite.span()).unwrap_or(Span::detached());
|
||||
(CiteGroup::new(self.items).pack().spanned(span), self.styles)
|
||||
}
|
||||
}
|
||||
|
BIN
tests/ref/bugs/cite-show-set.png
Normal file
BIN
tests/ref/bugs/cite-show-set.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
9
tests/typ/bugs/cite-show-set.typ
Normal file
9
tests/typ/bugs/cite-show-set.typ
Normal file
@ -0,0 +1,9 @@
|
||||
// Test show set rules on citations.
|
||||
|
||||
---
|
||||
#show cite: set text(red)
|
||||
A @netwok @arrgh.
|
||||
B #cite(<netwok>) #cite(<arrgh>).
|
||||
|
||||
#show bibliography: none
|
||||
#bibliography("/files/works.bib")
|
Loading…
x
Reference in New Issue
Block a user