diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-13 14:48:19 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-13 14:48:19 +0200 |
| commit | 67e9313b9127b70b9d7dad6540853025ae90b4a5 (patch) | |
| tree | 9f060b1982534ad67ee5a0688927071aa08dd96c /src/syntax/ast.rs | |
| parent | 2279c26543f7edde910fd89a3f8f0710c67249db (diff) | |
Soft breaks and shy hyphens
Diffstat (limited to 'src/syntax/ast.rs')
| -rw-r--r-- | src/syntax/ast.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs index d629b1fd..b01eeb47 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast.rs @@ -62,10 +62,11 @@ impl Markup { self.0.children().filter_map(|node| match node.kind() { NodeKind::Space(2 ..) => Some(MarkupNode::Parbreak), NodeKind::Space(_) => Some(MarkupNode::Space), - NodeKind::Linebreak => Some(MarkupNode::Linebreak), + NodeKind::Linebreak(s) => Some(MarkupNode::Linebreak(*s)), NodeKind::Text(s) => Some(MarkupNode::Text(s.clone())), NodeKind::Escape(c) => Some(MarkupNode::Text((*c).into())), NodeKind::NonBreakingSpace => Some(MarkupNode::Text('\u{00A0}'.into())), + NodeKind::Shy => Some(MarkupNode::Text('\u{00AD}'.into())), NodeKind::EnDash => Some(MarkupNode::Text('\u{2013}'.into())), NodeKind::EmDash => Some(MarkupNode::Text('\u{2014}'.into())), NodeKind::Quote(d) => Some(MarkupNode::Quote(*d)), @@ -86,8 +87,9 @@ impl Markup { pub enum MarkupNode { /// Whitespace containing less than two newlines. Space, - /// A forced line break: `\`. - Linebreak, + /// A forced line break. If soft (`\`, `true`), the preceding line can still + /// be justified, if hard (`\+`, `false`) not. + Linebreak(bool), /// A paragraph break: Two or more newlines. Parbreak, /// Plain text. |
