From 5a7373dc41476d8c5097b7f33d55fdf58f473f7b Mon Sep 17 00:00:00 2001 From: "lina.wolf" Date: Sat, 16 Mar 2024 10:08:26 +0100 Subject: [PATCH] [BUGFIX] Prevent Twig from swallowing whitespace between inline tags resolves #922 --- .../template/html/inline/plain-text.html.twig | 6 +++++- .../tests/definition-list/definition-list.html | 2 +- .../tests/inline-combinations/expected/index.html | 13 +++++++++++++ .../tests/inline-combinations/input/index.rst | 15 +++++++++++++++ .../list-table-directive/expected/index.html | 9 --------- 5 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 tests/Integration/tests/inline-combinations/expected/index.html create mode 100644 tests/Integration/tests/inline-combinations/input/index.rst diff --git a/packages/guides/resources/template/html/inline/plain-text.html.twig b/packages/guides/resources/template/html/inline/plain-text.html.twig index 64dbb3b7e..3fd6f83c3 100644 --- a/packages/guides/resources/template/html/inline/plain-text.html.twig +++ b/packages/guides/resources/template/html/inline/plain-text.html.twig @@ -1 +1,5 @@ -{{- node.value -}} +{%- if node.value == ' ' -%} + {{ ' '|raw }} +{%- else -%} + {{ node.value }} +{%- endif -%} \ No newline at end of file diff --git a/tests/Functional/tests/definition-list/definition-list.html b/tests/Functional/tests/definition-list/definition-list.html index a166be03e..491f35e00 100644 --- a/tests/Functional/tests/definition-list/definition-list.html +++ b/tests/Functional/tests/definition-list/definition-list.html @@ -31,7 +31,7 @@

classifier
Definition 1
-
Complex: int
+
Complex: int
Colon must be surrounded by spaces to be a term identifier
multi-line definition term
diff --git a/tests/Integration/tests/inline-combinations/expected/index.html b/tests/Integration/tests/inline-combinations/expected/index.html new file mode 100644 index 000000000..2651e5c77 --- /dev/null +++ b/tests/Integration/tests/inline-combinations/expected/index.html @@ -0,0 +1,13 @@ + +
+ +

Document Title

+ +

Lorem Ipsum Dolor.

+

all data

+

all data

+

bold and italic

+

bold italic

+
+ + diff --git a/tests/Integration/tests/inline-combinations/input/index.rst b/tests/Integration/tests/inline-combinations/input/index.rst new file mode 100644 index 000000000..34861dbbb --- /dev/null +++ b/tests/Integration/tests/inline-combinations/input/index.rst @@ -0,0 +1,15 @@ +.. _start: + +============== +Document Title +============== + +Lorem Ipsum Dolor. + +**all** :ref:`data ` + +*all* :ref:`data ` + +**bold** and *italic* + +**bold** *italic* diff --git a/tests/Integration/tests/tables/list-table-directive/expected/index.html b/tests/Integration/tests/tables/list-table-directive/expected/index.html index 5f579181b..f13f0c6c7 100644 --- a/tests/Integration/tests/tables/list-table-directive/expected/index.html +++ b/tests/Integration/tests/tables/list-table-directive/expected/index.html @@ -1,10 +1,3 @@ - - - - table - - -

table

@@ -71,5 +64,3 @@

table

- -