Converting multiple code blocks let to discarded newlines
authorAlexander Ebert <ebert@woltlab.com>
Wed, 13 Jun 2018 10:23:46 +0000 (12:23 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 13 Jun 2018 10:23:46 +0000 (12:23 +0200)
The XPath expression matched the global scope, eventually removing the newlines inside previously converted code blocks.

wcfsetup/install/files/lib/system/html/metacode/converter/CodeMetacodeConverter.class.php

index 0266ecb60c790a6ec407d420ba44662c7247c7fa..bfd3204e7d5c01656acd3174353bd96c54331af2 100644 (file)
@@ -75,7 +75,7 @@ class CodeMetacodeConverter extends AbstractMetacodeConverter {
                $xpath = new \DOMXPath($element->ownerDocument);
                $replaceNodes = [];
                /** @var \DOMText $textNode */
-               foreach ($xpath->query('//text()', $element) as $textNode) {
+               foreach ($xpath->query('.//text()', $element) as $textNode) {
                        if (mb_strpos($textNode->textContent, "\n") !== false) {
                                $replaceNodes[] = $textNode;
                        }