summaryrefslogtreecommitdiff
path: root/src/library/math.rs
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/library/math.rs
parentb63c21c91d99a1554a019dc275f955d3e6a34271 (diff)
Reorganize library
Diffstat (limited to 'src/library/math.rs')
-rw-r--r--src/library/math.rs39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/library/math.rs b/src/library/math.rs
deleted file mode 100644
index 5d0ae41b..00000000
--- a/src/library/math.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-//! Mathematical formulas.
-
-use super::prelude::*;
-
-/// A mathematical formula.
-#[derive(Debug, Hash)]
-pub struct MathNode {
- /// The formula.
- pub formula: EcoString,
- /// Whether the formula is display-level.
- pub display: bool,
-}
-
-#[class]
-impl MathNode {
- fn construct(_: &mut Context, args: &mut Args) -> TypResult<Template> {
- Ok(Template::show(Self {
- formula: args.expect("formula")?,
- display: args.named("display")?.unwrap_or(false),
- }))
- }
-}
-
-impl Show for MathNode {
- fn show(&self, ctx: &mut Context, styles: StyleChain) -> TypResult<Template> {
- Ok(styles
- .show(self, ctx, [
- Value::Str(self.formula.clone()),
- Value::Bool(self.display),
- ])?
- .unwrap_or_else(|| {
- let mut template = Template::Text(self.formula.trim().into());
- if self.display {
- template = Template::Block(template.pack());
- }
- template.monospaced()
- }))
- }
-}