From e6ce2885c0b4586a270e0ace79598a92365df56f Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 6 Feb 2024 21:23:51 +0100 Subject: Fix: Keep indentation in html and md code blocks. Moves the logic for unwrapping broken lines in html (and Markdown) to the node processing, instead of doing it over the full html content. This allows us to skip if for code blocks (aka `` elements within `
` elements).
---
 tests/unit/includes/BBCodeTest.php | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'tests/unit/includes/BBCodeTest.php')

diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php
index 54c35e67d..035bcbdc7 100644
--- a/tests/unit/includes/BBCodeTest.php
+++ b/tests/unit/includes/BBCodeTest.php
@@ -37,6 +37,10 @@ class BBCodeTest extends UnitTestCase {
 
 	private function html2bbcode_provider(): array {
 		return [
+			'paragraph over multiple lines' => [
+				"

A paragraph over\nmultiple lines\nshould be unwrapped

", + 'A paragraph over multiple lines should be unwrapped' + ], 'image with alt text' => [ 'Alt text', '[img=https://example.com/image.jpg]Alt text[/img]' @@ -45,6 +49,10 @@ class BBCodeTest extends UnitTestCase { "
some\ncode
", "[code]some\ncode[/code]" ], + 'code block with indentation' => [ + "
some\n    indented\ncode
", + "[code]some\n indented\ncode[/code]" + ], ]; } } -- cgit v1.2.3