diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-04-15 11:00:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-15 09:00:48 +0000 |
| commit | 401ba82927e2087afc1711e5d62583928f3b378c (patch) | |
| tree | d37c644a2844dbce01b4117e7d9021e2b5093788 | |
| parent | f25874640ee2363937dd2534b7f2a59f98dba3f0 (diff) | |
Make some changes that were deferred until after 0.11 (#3934)
| -rw-r--r-- | crates/typst/src/foundations/selector.rs | 1 | ||||
| -rw-r--r-- | crates/typst/src/introspection/metadata.rs | 11 | ||||
| -rw-r--r-- | crates/typst/src/realize/mod.rs | 5 | ||||
| -rw-r--r-- | tests/suite/layout/container.typ | 1 |
4 files changed, 2 insertions, 16 deletions
diff --git a/crates/typst/src/foundations/selector.rs b/crates/typst/src/foundations/selector.rs index 90663500..d41fd2dc 100644 --- a/crates/typst/src/foundations/selector.rs +++ b/crates/typst/src/foundations/selector.rs @@ -126,7 +126,6 @@ impl Selector { pub fn matches(&self, target: &Content, styles: Option<StyleChain>) -> bool { match self { Self::Elem(element, dict) => { - // TODO: Optimize field access to not clone. target.func() == *element && dict.iter().flat_map(|dict| dict.iter()).all(|(id, value)| { target.get(*id, styles).as_ref() == Some(value) diff --git a/crates/typst/src/introspection/metadata.rs b/crates/typst/src/introspection/metadata.rs index 2d6d8953..3a923308 100644 --- a/crates/typst/src/introspection/metadata.rs +++ b/crates/typst/src/introspection/metadata.rs @@ -2,7 +2,6 @@ use crate::diag::SourceResult; use crate::engine::Engine; use crate::foundations::{elem, Content, Packed, Show, StyleChain, Value}; use crate::introspection::Locatable; -use crate::realize::{Behave, Behaviour}; /// Exposes a value to the query system without producing visible content. /// @@ -24,7 +23,7 @@ use crate::realize::{Behave, Behaviour}; /// query(<note>).first().value /// } /// ``` -#[elem(Behave, Show, Locatable)] +#[elem(Show, Locatable)] pub struct MetadataElem { /// The value to embed into the document. #[required] @@ -36,11 +35,3 @@ impl Show for Packed<MetadataElem> { Ok(Content::empty()) } } - -// TODO: Metadata shows as empty content, so this behaviour is unnecessary. It -// can be removed once 0.11 has landed. -impl Behave for Packed<MetadataElem> { - fn behaviour(&self) -> Behaviour { - Behaviour::Invisible - } -} diff --git a/crates/typst/src/realize/mod.rs b/crates/typst/src/realize/mod.rs index 69a961b0..99b12a18 100644 --- a/crates/typst/src/realize/mod.rs +++ b/crates/typst/src/realize/mod.rs @@ -416,10 +416,7 @@ struct ParBuilder<'a>(BehavedBuilder<'a>); impl<'a> ParBuilder<'a> { fn accept(&mut self, content: &'a Content, styles: StyleChain<'a>) -> bool { if content.is::<MetaElem>() { - // TODO: This could probably just be `self.0.is_empty()` since no - // weak or invisible elements can be at the start of the builder. It - // can be removed once 0.11 has landed. - if self.0.has_strong_elements(false) { + if !self.0.is_empty() { self.0.push(content, styles); return true; } diff --git a/tests/suite/layout/container.typ b/tests/suite/layout/container.typ index ede051db..b38f6b25 100644 --- a/tests/suite/layout/container.typ +++ b/tests/suite/layout/container.typ @@ -67,7 +67,6 @@ There --- block-spacing-table --- // Test that paragraph spacing loses against block spacing. -// TODO #set block(spacing: 100pt) #show table: set block(above: 5pt, below: 5pt) Hello |
