diff options
author | Mario <mario@mariovavti.com> | 2024-08-02 07:17:54 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-08-02 07:17:54 +0000 |
commit | 61c03e4b4e1afd7593a57119198dd38845485887 (patch) | |
tree | 60cec6327ee4ae0faef577e1dafb8b83c3bb89ba | |
parent | dd0be272d0f645a0c2643da2552755444bb0e545 (diff) | |
download | volse-hubzilla-61c03e4b4e1afd7593a57119198dd38845485887.tar.gz volse-hubzilla-61c03e4b4e1afd7593a57119198dd38845485887.tar.bz2 volse-hubzilla-61c03e4b4e1afd7593a57119198dd38845485887.zip |
fix html2bbcode table and add test
-rw-r--r-- | include/html2bbcode.php | 7 | ||||
-rw-r--r-- | 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 <del>strike through</del> text', 'some [s]strike through[/s] text' + ], + 'table' => [ + '<table><tr><td>row1, col1</td><td>row1, col2</td></tr><tr><td>row2, col1</td><td>row2, col2</td></tr></table>', + '[table][tr][td]row1, col1[/td][td]row1, col2[/td][/tr][tr][td]row2, col1[/td][td]row2, col2[/td][/tr][/table]' ] ]; } |