From 1658b00282b631fb5218f477ea7f45f925644cea Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 13 Feb 2020 21:58:49 +0100 Subject: =?UTF-8?q?New=20syntax=20features=20=F0=9F=91=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Forced line breaks with backslash followed by whitespace - (Multline) raw text in backticks - Set font class fallbacks with [font.family] (e.g. [font.family: monospace=("CMU Typewriter Text")]) - More sophisticated procedure to find end of function, which accounts for comments, strings, raw text and nested functions (this is a mix of a feature and a bug fix) --- src/syntax/mod.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/syntax/mod.rs') diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index c3a57ee6..f7321c77 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -62,15 +62,17 @@ pub enum Node { /// Whitespace containing less than two newlines. Space, /// Whitespace with more than two newlines. - Newline, + Parbreak, + /// A forced line break. + Linebreak, /// Plain text. Text(String), + /// Lines of raw text. + Raw(Vec), /// Italics were enabled / disabled. ToggleItalic, /// Bolder was enabled / disabled. ToggleBolder, - /// Monospace was enabled / disabled. - ToggleMonospace, /// A submodel, typically a function invocation. Model(Box), } @@ -80,11 +82,12 @@ impl PartialEq for Node { use Node::*; match (self, other) { (Space, Space) => true, - (Newline, Newline) => true, + (Parbreak, Parbreak) => true, + (Linebreak, Linebreak) => true, (Text(a), Text(b)) => a == b, + (Raw(a), Raw(b)) => a == b, (ToggleItalic, ToggleItalic) => true, (ToggleBolder, ToggleBolder) => true, - (ToggleMonospace, ToggleMonospace) => true, (Model(a), Model(b)) => a == b, _ => false, } @@ -107,6 +110,7 @@ pub enum Decoration { /// ^^^^^^ /// ``` InvalidFuncName, + /// A key of a keyword argument: /// ```typst /// [box: width=5cm] @@ -119,12 +123,11 @@ pub enum Decoration { /// ^^^^ ^^^^^ /// ``` ObjectKey, + /// An italic word. Italic, /// A bold word. Bold, - /// A monospace word. - Monospace, } impl dyn Model { -- cgit v1.2.3