From cba78821ed13d5a92c74d092914fbad4c842f889 Mon Sep 17 00:00:00 2001
From: Titus Wormer <tituswormer@gmail.com>
Date: Thu, 9 Jun 2022 14:03:04 +0200
Subject: Add temporary support for stripping whitespace

---
 src/compiler.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/compiler.rs b/src/compiler.rs
index 4f362b8..3632d29 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -280,11 +280,15 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
                 }
                 // To do: `ContentPhrasing` should be parsed as phrasing first.
                 // This branch below currently acts as the resulting `data` tokens.
-                TokenType::ContentChunk
+                // To do: initial and final whitespace should be handled in `text`.
+                TokenType::ContentChunk => {
+                    // last_was_tag = false;
+                    buf_tail_mut(buffers).push(encode(
+                        slice_serialize(codes, &get_span(events, index), false).trim(),
+                    ));
+                }
                 // To do: `ChunkString` does not belong here. Remove it when subtokenization is supported.
-                | TokenType::ChunkString
-                | TokenType::Data
-                | TokenType::CharacterEscapeValue => {
+                TokenType::ChunkString | TokenType::Data | TokenType::CharacterEscapeValue => {
                     // last_was_tag = false;
                     buf_tail_mut(buffers).push(encode(&slice_serialize(
                         codes,
-- 
cgit