parent
b23914fca9
commit
c641044380
|
|
@ -750,8 +750,10 @@ impl Default for ListBuilder<'_> {
|
||||||
/// Accepts citations.
|
/// Accepts citations.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct CiteGroupBuilder<'a> {
|
struct CiteGroupBuilder<'a> {
|
||||||
|
/// The styles.
|
||||||
|
styles: StyleChain<'a>,
|
||||||
/// The citations.
|
/// The citations.
|
||||||
items: StyleVecBuilder<'a, CiteElem>,
|
items: Vec<CiteElem>,
|
||||||
/// Trailing content for which it is unclear whether it is part of the list.
|
/// Trailing content for which it is unclear whether it is part of the list.
|
||||||
staged: Vec<(&'a Content, StyleChain<'a>)>,
|
staged: Vec<(&'a Content, StyleChain<'a>)>,
|
||||||
}
|
}
|
||||||
|
|
@ -766,8 +768,11 @@ impl<'a> CiteGroupBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(citation) = content.to::<CiteElem>() {
|
if let Some(citation) = content.to::<CiteElem>() {
|
||||||
|
if self.items.is_empty() {
|
||||||
|
self.styles = styles;
|
||||||
|
}
|
||||||
self.staged.retain(|(elem, _)| !elem.is::<SpaceElem>());
|
self.staged.retain(|(elem, _)| !elem.is::<SpaceElem>());
|
||||||
self.items.push(citation.clone(), styles);
|
self.items.push(citation.clone());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -775,9 +780,7 @@ impl<'a> CiteGroupBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finish(self) -> (Content, StyleChain<'a>) {
|
fn finish(self) -> (Content, StyleChain<'a>) {
|
||||||
let (items, styles) = self.items.finish();
|
let span = self.items.first().map(|cite| cite.span()).unwrap_or(Span::detached());
|
||||||
let items = items.into_items();
|
(CiteGroup::new(self.items).pack().spanned(span), self.styles)
|
||||||
let span = items.first().map(|cite| cite.span()).unwrap_or(Span::detached());
|
|
||||||
(CiteGroup::new(items).pack().spanned(span), styles)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
|
|
@ -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…
Reference in New Issue