From 5e08028fb36aa766957cba64c5c665edf9b96fb7 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 21 Mar 2021 17:46:09 +0100 Subject: =?UTF-8?q?Syntax=20functions=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds overridable functions that markup desugars into. Specifically: - \ desugars into linebreak - Two newlines desugar into parbreak - * desugars into strong - _ desugars into emph - = .. desugars into heading - `..` desugars into raw --- src/eval/value.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/eval/value.rs') diff --git a/src/eval/value.rs b/src/eval/value.rs index 485829f3..288e5ed7 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -4,7 +4,7 @@ use std::fmt::{self, Debug, Display, Formatter}; use std::ops::Deref; use std::rc::Rc; -use super::{EvalContext, ExprMap}; +use super::{EvalContext, NodeMap}; use crate::color::Color; use crate::diag::DiagSet; use crate::exec::ExecContext; @@ -107,7 +107,7 @@ pub type TemplateValue = Vec; /// /// Evaluating a template expression creates only a single node. Adding multiple /// templates can yield multi-node templates. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone)] pub enum TemplateNode { /// A template that consists of a syntax tree plus already evaluated /// expression. @@ -115,7 +115,7 @@ pub enum TemplateNode { /// The syntax tree of the corresponding template expression. tree: Rc, /// The evaluated expressions for the `tree`. - map: ExprMap, + map: NodeMap, }, /// A template that was converted from a string. Str(String), @@ -123,6 +123,13 @@ pub enum TemplateNode { Func(TemplateFunc), } +impl PartialEq for TemplateNode { + fn eq(&self, _: &Self) -> bool { + // TODO: Figure out what we want here. + false + } +} + /// A reference-counted dynamic template node that can implement custom /// behaviour. #[derive(Clone)] -- cgit v1.2.3