toHTML displays [html] #5037
-
In my plugin, I have a description field, that allows HTML content. On the page, I have $tp = e107::getParser(); It displays the content in the database, but shows [html] [/html] - did I do something wrong in my code, or is this a bug? I remember this was an issue a few years back, I use to go into the admin area, edit the field, view source code, and remove the [html] tags, but now they still show up. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It looks like there's some BBcode mixed in. Have you tried setting the second parameter of public function toHTML(
$text,
$parseBB = false,
$modifiers = '',
$postID = '',
$wrap = false
): string Here are two tests showing the difference between diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php
--- a/e107_tests/tests/unit/e_parseTest.php (revision 3c61b2e2dc52592c8a906118cad05cd4e21db880)
+++ b/e107_tests/tests/unit/e_parseTest.php (date 1688535877660)
@@ -181,6 +181,22 @@
}
+ public function testToHtml5037_1()
+ {
+ $input = "[html]<div class='container'>https://github.com/e107inc/e107/discussions/5037</div>[/html]";
+ $expected = "[html]<div class='container'>https://github.com/e107inc/e107/discussions/5037</div>[/html]";
+ $actual = $this->tp->toHTML($input);
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testToHtml5037_2()
+ {
+ $input = "[html]<div class='container'>https://github.com/e107inc/e107/discussions/5037</div>[/html]";
+ $expected = "<!-- bbcode-html-start --><div class='container'>https://github.com/e107inc/e107/discussions/5037</div><!-- bbcode-html-end -->";
+ $actual = $this->tp->toHTML($input, true);
+ $this->assertEquals($expected, $actual);
+ }
+
/*
public function testUstrpos()
{ |
Beta Was this translation helpful? Give feedback.
It looks like there's some BBcode mixed in. Have you tried setting the second parameter of
e_parse::toHTML()
,$parseBB
, to true?Here are two tests showing the difference between
$parseBB
beingfalse
versustrue
: