mirror of
https://github.com/typst/typst
synced 2025-08-13 22:57:56 +08:00
Quote body is not a paragraph
This commit is contained in:
parent
e40bf22c23
commit
2492ba42ed
@ -212,17 +212,24 @@ impl Show for Packed<QuoteElem> {
|
||||
.pack()
|
||||
.spanned(self.span()),
|
||||
};
|
||||
let attribution =
|
||||
[TextElem::packed('—'), SpaceElem::shared().clone(), attribution];
|
||||
let attribution = Content::sequence([
|
||||
TextElem::packed('—'),
|
||||
SpaceElem::shared().clone(),
|
||||
attribution,
|
||||
]);
|
||||
|
||||
if !html {
|
||||
// Use v(0.9em, weak: true) to bring the attribution closer
|
||||
// to the quote.
|
||||
if html {
|
||||
realized += attribution;
|
||||
} else {
|
||||
// Bring the attribution a bit closer to the quote.
|
||||
let gap = Spacing::Rel(Em::new(0.9).into());
|
||||
let v = VElem::new(gap).with_weak(true).pack();
|
||||
realized += v;
|
||||
realized += BlockElem::new()
|
||||
.with_body(Some(BlockBody::Content(attribution)))
|
||||
.pack()
|
||||
.aligned(Alignment::END);
|
||||
}
|
||||
realized += Content::sequence(attribution).aligned(Alignment::END);
|
||||
}
|
||||
|
||||
if !html {
|
||||
|
BIN
tests/ref/quote-par.png
Normal file
BIN
tests/ref/quote-par.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
@ -107,3 +107,14 @@ When you said that #quote[he surely meant that #quote[she intended to say #quote
|
||||
)[
|
||||
Compose papers faster
|
||||
]
|
||||
|
||||
--- quote-par ---
|
||||
// Ensure that an inline quote is part of a paragraph, but a block quote
|
||||
// does not result in paragraphs.
|
||||
#show par: highlight
|
||||
|
||||
An inline #quote[quote.]
|
||||
|
||||
#quote(block: true, attribution: [The Test Author])[
|
||||
A block-level quote.
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user