summaryrefslogtreecommitdiff
path: root/library/src/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-18 19:27:31 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-18 19:27:31 +0100
commita69b5874558eb50c96293813cbe67aac38174644 (patch)
treec59e671a4f73b467fc1f7f4de1d01ed6cfe24afe /library/src/layout
parenta16726ae6652a795ff24f368ca25f93bae673366 (diff)
Rename formula to equation
Diffstat (limited to 'library/src/layout')
-rw-r--r--library/src/layout/container.rs2
-rw-r--r--library/src/layout/mod.rs8
-rw-r--r--library/src/layout/par.rs16
3 files changed, 13 insertions, 13 deletions
diff --git a/library/src/layout/container.rs b/library/src/layout/container.rs
index 0b7f7eb1..bdc147c3 100644
--- a/library/src/layout/container.rs
+++ b/library/src/layout/container.rs
@@ -261,7 +261,7 @@ pub struct BlockNode {
///
/// ```example
/// #set align(center)
- /// #show math.formula: set block(above: 8pt, below: 16pt)
+ /// #show math.equation: set block(above: 8pt, below: 16pt)
///
/// This sum of $x$ and $y$:
/// $ x + y = z $
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs
index 4a38acb6..0ce292aa 100644
--- a/library/src/layout/mod.rs
+++ b/library/src/layout/mod.rs
@@ -50,7 +50,7 @@ use typst::diag::SourceResult;
use typst::eval::Tracer;
use typst::model::{applicable, realize, SequenceNode, StyleVecBuilder, StyledNode};
-use crate::math::{FormulaNode, LayoutMath};
+use crate::math::{EquationNode, LayoutMath};
use crate::meta::DocumentNode;
use crate::prelude::*;
use crate::shared::BehavedBuilder;
@@ -245,9 +245,9 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
mut content: &'a Content,
styles: StyleChain<'a>,
) -> SourceResult<()> {
- if content.can::<dyn LayoutMath>() && !content.is::<FormulaNode>() {
+ if content.can::<dyn LayoutMath>() && !content.is::<EquationNode>() {
content =
- self.scratch.content.alloc(FormulaNode::new(content.clone()).pack());
+ self.scratch.content.alloc(EquationNode::new(content.clone()).pack());
}
if let Some(styled) = content.to::<StyledNode>() {
@@ -491,7 +491,7 @@ impl<'a> ParBuilder<'a> {
|| content.is::<HNode>()
|| content.is::<LinebreakNode>()
|| content.is::<SmartQuoteNode>()
- || content.to::<FormulaNode>().map_or(false, |node| !node.block(styles))
+ || content.to::<EquationNode>().map_or(false, |node| !node.block(styles))
|| content.is::<BoxNode>()
{
self.0.push(content.clone(), styles);
diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs
index 8657d7fb..cef0d11c 100644
--- a/library/src/layout/par.rs
+++ b/library/src/layout/par.rs
@@ -7,7 +7,7 @@ use typst::model::StyledNode;
use super::{BoxNode, HNode, Sizing, Spacing};
use crate::layout::AlignNode;
-use crate::math::FormulaNode;
+use crate::math::EquationNode;
use crate::prelude::*;
use crate::text::{
shape, LinebreakNode, Quoter, Quotes, ShapedText, SmartQuoteNode, SpaceNode, TextNode,
@@ -324,8 +324,8 @@ enum Segment<'a> {
Text(usize),
/// Horizontal spacing between other segments.
Spacing(Spacing),
- /// A math formula.
- Formula(&'a FormulaNode),
+ /// A mathematical equation.
+ Equation(&'a EquationNode),
/// A box with arbitrary content.
Box(&'a BoxNode, bool),
/// Metadata.
@@ -339,7 +339,7 @@ impl Segment<'_> {
Self::Text(len) => len,
Self::Spacing(_) => SPACING_REPLACE.len_utf8(),
Self::Box(_, true) => SPACING_REPLACE.len_utf8(),
- Self::Formula(_) | Self::Box(_, _) | Self::Meta => NODE_REPLACE.len_utf8(),
+ Self::Equation(_) | Self::Box(_, _) | Self::Meta => NODE_REPLACE.len_utf8(),
}
}
}
@@ -597,9 +597,9 @@ fn collect<'a>(
full.push(if node.double(styles) { '"' } else { '\'' });
}
Segment::Text(full.len() - prev)
- } else if let Some(node) = child.to::<FormulaNode>() {
+ } else if let Some(node) = child.to::<EquationNode>() {
full.push(NODE_REPLACE);
- Segment::Formula(node)
+ Segment::Equation(node)
} else if let Some(node) = child.to::<BoxNode>() {
let frac = node.width(styles).is_fractional();
full.push(if frac { SPACING_REPLACE } else { NODE_REPLACE });
@@ -671,9 +671,9 @@ fn prepare<'a>(
items.push(Item::Fractional(v, None));
}
},
- Segment::Formula(formula) => {
+ Segment::Equation(equation) => {
let pod = Regions::one(region, Axes::splat(false));
- let mut frame = formula.layout(vt, styles, pod)?.into_frame();
+ let mut frame = equation.layout(vt, styles, pod)?.into_frame();
frame.translate(Point::with_y(TextNode::baseline_in(styles)));
items.push(Item::Frame(frame));
}