Don't hide introspection metadata

Fixes #622
This commit is contained in:
Laurenz 2023-05-22 16:44:48 +02:00
parent a3227f4ef3
commit 183997d5fe
3 changed files with 33 additions and 3 deletions

View File

@ -263,14 +263,20 @@ impl Frame {
/// Attach metadata from an iterator. /// Attach metadata from an iterator.
pub fn meta_iter(&mut self, iter: impl IntoIterator<Item = Meta>) { pub fn meta_iter(&mut self, iter: impl IntoIterator<Item = Meta>) {
let mut hide = false;
for meta in iter { for meta in iter {
if matches!(meta, Meta::Hide) { if matches!(meta, Meta::Hide) {
self.clear(); hide = true;
break; } else {
}
self.prepend(Point::zero(), FrameItem::Meta(meta, self.size)); self.prepend(Point::zero(), FrameItem::Meta(meta, self.size));
} }
} }
if hide {
Arc::make_mut(&mut self.items).retain(|(_, item)| {
matches!(item, FrameItem::Group(_) | FrameItem::Meta(Meta::Elem(_), _))
});
}
}
/// Add a background fill. /// Add a background fill.
pub fn fill(&mut self, fill: Paint) { pub fn fill(&mut self, fill: Paint) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,24 @@
// Test that metadata of hidden stuff stays available.
---
#set cite(style: "chicago-notes")
A pirate. @arrgh \
#set text(2pt)
#hide[
A @arrgh pirate.
#bibliography("/works.bib")
]
---
#set text(8pt)
#outline()
#set text(2pt)
#hide(block(grid(
[= A],
[= B],
block(grid(
[= C],
[= D],
))
)))