Merge pull request #10878 from MrPetovan/bug/10877-html-to-bbcode

Bug/10877 html to bbcode
This commit is contained in:
Tobias Diekershoff 2021-10-15 17:55:11 +02:00 committed by GitHub
commit 907f45b0f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -386,7 +386,7 @@ class HTML
$prefix = '[code=' . $matches[1] . ']'; $prefix = '[code=' . $matches[1] . ']';
} }
return $prefix . PHP_EOL . trim($matches[2]) . PHP_EOL . '[/code]'; return $prefix . "\n" . html_entity_decode($matches[2]) . "\n" . '[/code]';
}, },
$message $message
); );

View File

@ -84,6 +84,16 @@ class HTMLTest extends MockedTest
'expectedBBCode' => "<big rant here> I don't understand tests", 'expectedBBCode' => "<big rant here> I don't understand tests",
'html' => "&lt;big rant here&gt; I don't understand tests", 'html' => "&lt;big rant here&gt; I don't understand tests",
], ],
'bug-10877-code-entities' => [
'expectedBBCode' => "Now playing
[code]
echo \"main(i){for(i=0;;i++)putchar(((i*(i>>8|i>>9)&46&i>>8))^(i&i>>13|i>>6));}\" | gcc -o a.out -x c - 2> /dev/null
./a.out | aplay -q 2> /dev/null
[/code]
its surprisingly good",
'html' => "<p>Now playing</p><pre><code>echo &quot;main(i){for(i=0;;i++)putchar(((i*(i&gt;&gt;8|i&gt;&gt;9)&amp;46&amp;i&gt;&gt;8))^(i&amp;i&gt;&gt;13|i&gt;&gt;6));}&quot; | gcc -o a.out -x c - 2&gt; /dev/null
./a.out | aplay -q 2&gt; /dev/null</code></pre><p>its surprisingly good</p>",
],
]; ];
} }