summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-18 11:25:36 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-18 12:49:27 +0100
commit92f2c56203c6528e35ec1feae14e5dd2c2425311 (patch)
tree8438f9fe8e6cd4b91aad3302d9725975a6b50501 /library
parentc3895cbd66688c8d677d5795813432b9a72b3ef9 (diff)
Reorganize style module
Diffstat (limited to 'library')
-rw-r--r--library/src/layout/columns.rs2
-rw-r--r--library/src/layout/container.rs4
-rw-r--r--library/src/layout/flow.rs4
-rw-r--r--library/src/layout/mod.rs10
-rw-r--r--library/src/text/mod.rs6
-rw-r--r--library/src/text/par.rs2
6 files changed, 14 insertions, 14 deletions
diff --git a/library/src/layout/columns.rs b/library/src/layout/columns.rs
index ec9510d8..c5a340ee 100644
--- a/library/src/layout/columns.rs
+++ b/library/src/layout/columns.rs
@@ -99,7 +99,7 @@ impl LayoutBlock for ColumnsNode {
}
/// A column break.
-#[derive(Debug, Clone, Hash)]
+#[derive(Debug, Hash)]
pub struct ColbreakNode {
pub weak: bool,
}
diff --git a/library/src/layout/container.rs b/library/src/layout/container.rs
index eb899d54..408f6720 100644
--- a/library/src/layout/container.rs
+++ b/library/src/layout/container.rs
@@ -2,7 +2,7 @@ use super::VNode;
use crate::prelude::*;
/// An inline-level container that sizes content.
-#[derive(Debug, Clone, Hash)]
+#[derive(Debug, Hash)]
pub struct BoxNode {
/// How to size the content horizontally and vertically.
pub sizing: Axes<Option<Rel<Length>>>,
@@ -58,7 +58,7 @@ impl LayoutInline for BoxNode {
}
/// A block-level container that places content into a separate flow.
-#[derive(Debug, Clone, Hash)]
+#[derive(Debug, Hash)]
pub struct BlockNode(pub Content);
#[node(LayoutBlock)]
diff --git a/library/src/layout/flow.rs b/library/src/layout/flow.rs
index f47a8f42..b69f4f4e 100644
--- a/library/src/layout/flow.rs
+++ b/library/src/layout/flow.rs
@@ -1,4 +1,4 @@
-use typst::model::{Property, StyleEntry};
+use typst::model::{Property, Style};
use super::{AlignNode, ColbreakNode, PlaceNode, Spacing, VNode};
use crate::prelude::*;
@@ -161,7 +161,7 @@ impl FlowLayouter {
let mut chained = styles;
if !self.last_block_was_par && is_par && !styles.get(ParNode::INDENT).is_zero() {
let property = Property::new(ParNode::INDENT, Length::zero());
- reset = StyleEntry::Property(property);
+ reset = Style::Property(property);
chained = reset.chain(&styles);
}
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs
index 5812115a..bcc5bf6d 100644
--- a/library/src/layout/mod.rs
+++ b/library/src/layout/mod.rs
@@ -32,8 +32,8 @@ use typst::diag::SourceResult;
use typst::frame::Frame;
use typst::geom::*;
use typst::model::{
- capability, Content, Node, SequenceNode, Show, StyleChain, StyleEntry,
- StyleVecBuilder, StyledNode,
+ capability, Content, Node, SequenceNode, Show, Style, StyleChain, StyleVecBuilder,
+ StyledNode,
};
use typst::World;
@@ -89,7 +89,7 @@ impl LayoutBlock for Content {
) -> SourceResult<Vec<Frame>> {
if !self.has::<dyn Show>() || !styles.applicable(self) {
if let Some(node) = self.to::<dyn LayoutBlock>() {
- let barrier = StyleEntry::Barrier(self.id());
+ let barrier = Style::Barrier(self.id());
let styles = barrier.chain(&styles);
return node.layout_block(world, regions, styles);
}
@@ -128,13 +128,13 @@ impl LayoutInline for Content {
if !self.has::<dyn Show>() || !styles.applicable(self) {
if let Some(node) = self.to::<dyn LayoutInline>() {
- let barrier = StyleEntry::Barrier(self.id());
+ let barrier = Style::Barrier(self.id());
let styles = barrier.chain(&styles);
return node.layout_inline(world, regions, styles);
}
if let Some(node) = self.to::<dyn LayoutBlock>() {
- let barrier = StyleEntry::Barrier(self.id());
+ let barrier = Style::Barrier(self.id());
let styles = barrier.chain(&styles);
return Ok(node.layout_block(world, regions, styles)?.remove(0));
}
diff --git a/library/src/text/mod.rs b/library/src/text/mod.rs
index 8484ff57..1ab1c37d 100644
--- a/library/src/text/mod.rs
+++ b/library/src/text/mod.rs
@@ -407,7 +407,7 @@ impl Fold for FontFeatures {
}
/// A text space.
-#[derive(Debug, Clone, Hash)]
+#[derive(Debug, Hash)]
pub struct SpaceNode;
#[node(Behave)]
@@ -424,7 +424,7 @@ impl Behave for SpaceNode {
}
/// A line break.
-#[derive(Debug, Clone, Hash)]
+#[derive(Debug, Hash)]
pub struct LinebreakNode {
pub justify: bool,
}
@@ -444,7 +444,7 @@ impl Behave for LinebreakNode {
}
/// A smart quote.
-#[derive(Debug, Clone, Hash)]
+#[derive(Debug, Hash)]
pub struct SmartQuoteNode {
pub double: bool,
}
diff --git a/library/src/text/par.rs b/library/src/text/par.rs
index 1d01071d..6551ae9c 100644
--- a/library/src/text/par.rs
+++ b/library/src/text/par.rs
@@ -114,7 +114,7 @@ castable! {
}
/// A paragraph break.
-#[derive(Debug, Clone, Hash)]
+#[derive(Debug, Hash)]
pub struct ParbreakNode;
#[node]