From 61c03e4b4e1afd7593a57119198dd38845485887 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 2 Aug 2024 07:17:54 +0000 Subject: fix html2bbcode table and add test --- include/html2bbcode.php | 7 ++----- tests/unit/includes/BBCodeTest.php | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 8c35cdf03..277b0e640 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -217,14 +217,11 @@ function html2bbcode($message) node2bbcode($doc, 'hr', array(), "[hr]", ""); -// node2bbcode($doc, 'table', array(), "", ""); -// node2bbcode($doc, 'tr', array(), "\n", ""); -// node2bbcode($doc, 'td', array(), "\t", ""); - - node2bbcode($doc, 'table', array(), "[table]", "[/table]"); node2bbcode($doc, 'th', array(), "[th]", "[/th]"); node2bbcode($doc, 'tr', array(), "[tr]", "[/tr]"); node2bbcode($doc, 'td', array(), "[td]", "[/td]"); + node2bbcode($doc, 'table', array(), "[table]", "[/table]"); + node2bbcode($doc, 'h1', array(), "[h1]", "[/h1]"); node2bbcode($doc, 'h2', array(), "[h2]", "[/h2]"); diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php index daa66bf72..30ea00ba6 100644 --- a/tests/unit/includes/BBCodeTest.php +++ b/tests/unit/includes/BBCodeTest.php @@ -266,6 +266,10 @@ class BBCodeTest extends UnitTestCase { 'del tag' => [ 'some strike through text', 'some [s]strike through[/s] text' + ], + 'table' => [ + '
row1, col1row1, col2
row2, col1row2, col2
', + '[table][tr][td]row1, col1[/td][td]row1, col2[/td][/tr][tr][td]row2, col1[/td][td]row2, col2[/td][/tr][/table]' ] ]; } -- cgit v1.2.3