summaryrefslogtreecommitdiff
path: root/src/eval
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-28 15:50:48 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-28 23:54:34 +0100
commit3ca5b238238e1128aa7bbfbd5db9e632045d8600 (patch)
tree2471f4b340a15695b7f4d518c0b39fabaea676c4 /src/eval
parentb63c21c91d99a1554a019dc275f955d3e6a34271 (diff)
Reorganize library
Diffstat (limited to 'src/eval')
-rw-r--r--src/eval/class.rs2
-rw-r--r--src/eval/layout.rs4
-rw-r--r--src/eval/mod.rs16
-rw-r--r--src/eval/styles.rs3
-rw-r--r--src/eval/template.rs7
5 files changed, 16 insertions, 16 deletions
diff --git a/src/eval/class.rs b/src/eval/class.rs
index 5e1857d7..2cced74d 100644
--- a/src/eval/class.rs
+++ b/src/eval/class.rs
@@ -33,7 +33,7 @@ use crate::Context;
/// ```
///
/// [construct]: Self::construct
-/// [`TextNode`]: crate::library::TextNode
+/// [`TextNode`]: crate::library::text::TextNode
/// [`set`]: Self::set
#[derive(Clone)]
pub struct Class {
diff --git a/src/eval/layout.rs b/src/eval/layout.rs
index 38ad3977..02912544 100644
--- a/src/eval/layout.rs
+++ b/src/eval/layout.rs
@@ -9,7 +9,7 @@ use crate::diag::TypResult;
use crate::eval::StyleChain;
use crate::frame::{Element, Frame, Geometry, Shape, Stroke};
use crate::geom::{Align, Length, Linear, Paint, Point, Sides, Size, Spec, Transform};
-use crate::library::{AlignNode, PadNode, TransformNode, MOVE};
+use crate::library::layout::{AlignNode, MoveNode, PadNode};
use crate::util::Prehashed;
use crate::Context;
@@ -203,7 +203,7 @@ impl LayoutNode {
/// Transform this node's contents without affecting layout.
pub fn moved(self, offset: Point) -> Self {
if !offset.is_zero() {
- TransformNode::<MOVE> {
+ MoveNode {
transform: Transform::translation(offset.x, offset.y),
child: self,
}
diff --git a/src/eval/mod.rs b/src/eval/mod.rs
index 380e9e9d..f8b4b0f0 100644
--- a/src/eval/mod.rs
+++ b/src/eval/mod.rs
@@ -120,7 +120,7 @@ impl Eval for StrongNode {
type Output = Template;
fn eval(&self, ctx: &mut Context, scp: &mut Scopes) -> EvalResult<Self::Output> {
- Ok(Template::show(library::StrongNode(
+ Ok(Template::show(library::text::StrongNode(
self.body().eval(ctx, scp)?,
)))
}
@@ -130,7 +130,7 @@ impl Eval for EmphNode {
type Output = Template;
fn eval(&self, ctx: &mut Context, scp: &mut Scopes) -> EvalResult<Self::Output> {
- Ok(Template::show(library::EmphNode(
+ Ok(Template::show(library::text::EmphNode(
self.body().eval(ctx, scp)?,
)))
}
@@ -140,12 +140,12 @@ impl Eval for RawNode {
type Output = Template;
fn eval(&self, _: &mut Context, _: &mut Scopes) -> EvalResult<Self::Output> {
- let template = Template::show(library::RawNode {
+ let template = Template::show(library::text::RawNode {
text: self.text.clone(),
block: self.block,
});
Ok(match self.lang {
- Some(_) => template.styled(library::RawNode::LANG, self.lang.clone()),
+ Some(_) => template.styled(library::text::RawNode::LANG, self.lang.clone()),
None => template,
})
}
@@ -155,7 +155,7 @@ impl Eval for MathNode {
type Output = Template;
fn eval(&self, _: &mut Context, _: &mut Scopes) -> EvalResult<Self::Output> {
- Ok(Template::show(library::MathNode {
+ Ok(Template::show(library::elements::MathNode {
formula: self.formula.clone(),
display: self.display,
}))
@@ -166,7 +166,7 @@ impl Eval for HeadingNode {
type Output = Template;
fn eval(&self, ctx: &mut Context, scp: &mut Scopes) -> EvalResult<Self::Output> {
- Ok(Template::show(library::HeadingNode {
+ Ok(Template::show(library::elements::HeadingNode {
body: self.body().eval(ctx, scp)?,
level: self.level(),
}))
@@ -177,7 +177,7 @@ impl Eval for ListNode {
type Output = Template;
fn eval(&self, ctx: &mut Context, scp: &mut Scopes) -> EvalResult<Self::Output> {
- Ok(Template::List(library::ListItem {
+ Ok(Template::List(library::elements::ListItem {
number: None,
body: Box::new(self.body().eval(ctx, scp)?),
}))
@@ -188,7 +188,7 @@ impl Eval for EnumNode {
type Output = Template;
fn eval(&self, ctx: &mut Context, scp: &mut Scopes) -> EvalResult<Self::Output> {
- Ok(Template::Enum(library::ListItem {
+ Ok(Template::Enum(library::elements::ListItem {
number: self.number(),
body: Box::new(self.body().eval(ctx, scp)?),
}))
diff --git a/src/eval/styles.rs b/src/eval/styles.rs
index 8e7bd4b6..5a8371a9 100644
--- a/src/eval/styles.rs
+++ b/src/eval/styles.rs
@@ -5,7 +5,8 @@ use std::sync::Arc;
use super::{Args, Func, Span, Template, Value};
use crate::diag::{At, TypResult};
-use crate::library::{PageNode, ParNode};
+use crate::library::layout::PageNode;
+use crate::library::text::ParNode;
use crate::Context;
/// A map of style properties.
diff --git a/src/eval/template.rs b/src/eval/template.rs
index 747e5d44..94cc0aff 100644
--- a/src/eval/template.rs
+++ b/src/eval/template.rs
@@ -10,11 +10,10 @@ use super::{
StyleMap, StyleVecBuilder,
};
use crate::diag::StrResult;
+use crate::library::elements::{ListItem, ListKind, ListNode, ORDERED, UNORDERED};
+use crate::library::layout::{FlowChild, FlowNode, PageNode, PlaceNode, SpacingKind};
use crate::library::prelude::*;
-use crate::library::{
- DecoNode, FlowChild, FlowNode, ListItem, ListKind, ListNode, PageNode, ParChild,
- ParNode, PlaceNode, SpacingKind, TextNode, ORDERED, UNDERLINE, UNORDERED,
-};
+use crate::library::text::{DecoNode, ParChild, ParNode, TextNode, UNDERLINE};
use crate::util::EcoString;
/// Composable representation of styled content.