diff --git a/src/eval/class.rs b/src/eval/class.rs index 5e1857d7b..2cced74d5 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 38ad39771..029125448 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:: { + MoveNode { transform: Transform::translation(offset.x, offset.y), child: self, } diff --git a/src/eval/mod.rs b/src/eval/mod.rs index 380e9e9d1..f8b4b0f0c 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 { - 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 8e7bd4b65..5a8371a96 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 747e5d442..94cc0aff9 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. diff --git a/src/library/deco.rs b/src/library/deco.rs deleted file mode 100644 index 8c2b5a9a5..000000000 --- a/src/library/deco.rs +++ /dev/null @@ -1,74 +0,0 @@ -//! Text decorations. - -use super::prelude::*; -use super::TextNode; - -/// Typeset underline, striken-through or overlined text. -#[derive(Debug, Hash)] -pub struct DecoNode(pub Template); - -#[class] -impl DecoNode { - /// Stroke color of the line, defaults to the text color if `None`. - #[shorthand] - pub const STROKE: Option = None; - /// Thickness of the line's strokes (dependent on scaled font size), read - /// from the font tables if `None`. - #[shorthand] - pub const THICKNESS: Option = None; - /// Position of the line relative to the baseline (dependent on scaled font - /// size), read from the font tables if `None`. - pub const OFFSET: Option = None; - /// Amount that the line will be longer or shorter than its associated text - /// (dependent on scaled font size). - pub const EXTENT: Linear = Linear::zero(); - /// Whether the line skips sections in which it would collide - /// with the glyphs. Does not apply to strikethrough. - pub const EVADE: bool = true; - - fn construct(_: &mut Context, args: &mut Args) -> TypResult