aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/html2bbcode.php30
-rw-r--r--tests/unit/includes/BBCodeTest.php4
-rw-r--r--vendor/composer/installed.php4
3 files changed, 21 insertions, 17 deletions
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index 009c051e6..03e09cd62 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -187,25 +187,24 @@ function html2bbcode($message)
node2bbcode($doc, 'u', array(), '[u]', '[/u]');
node2bbcode($doc, 's', array(), '[s]', '[/s]');
node2bbcode($doc, 'mark', array(), '[mark]', '[/mark]');
+ node2bbcode($doc, 'span', array(), "", "");
node2bbcode($doc, 'big', array(), "[size=large]", "[/size]");
node2bbcode($doc, 'small', array(), "[size=small]", "[/size]");
- node2bbcode($doc, 'blockquote', array(), '[quote]', '[/quote]');
-
// Use a temporary tag to keep line breaks
node2bbcode($doc, 'br', array(), '[br]', '');
node2bbcode($doc, 'a', array('href'=>'/(.+)/'), '[url=$1]', '[/url]');
- node2bbcode($doc, 'p', array('class'=>'MsoNormal'), "\n", "");
- node2bbcode($doc, 'div', array('class'=>'MsoNormal'), "\r", "");
+ node2bbcode($doc, 'img', array('src'=>'/(.+)/', 'width'=>'/(\d+)/', 'height'=>'/(\d+)/'), '[img=$2x$3]$1', '[/img]');
+ node2bbcode($doc, 'img', array('src'=>'/(.+)/', 'alt'=>'/(.+)/'), '[img=$1]$2', '[/img]');
+ node2bbcode($doc, 'img', array('src'=>'/(.+)/'), '[img]$1', '[/img]');
- node2bbcode($doc, 'span', array(), "", "");
+ node2bbcode($doc, 'video', array('src'=>'/(.+)/'), '[video]$1', '[/video]');
+ node2bbcode($doc, 'audio', array('src'=>'/(.+)/'), '[audio]$1', '[/audio]');
+// node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), '[iframe]$1', '[/iframe]');
- node2bbcode($doc, 'pre', array(), "", "");
- node2bbcode($doc, 'div', array(), "\r", "\r");
- node2bbcode($doc, 'p', array(), "\n", "\n");
node2bbcode($doc, 'ul', array(), "[list]", "[/list]");
node2bbcode($doc, 'ol', array(), "[list=1]", "[/list]");
@@ -229,18 +228,19 @@ function html2bbcode($message)
node2bbcode($doc, 'h5', array(), "[h5]", "[/h5]");
node2bbcode($doc, 'h6', array(), "[h6]", "[/h6]");
- node2bbcode($doc, 'img', array('src'=>'/(.+)/', 'width'=>'/(\d+)/', 'height'=>'/(\d+)/'), '[img=$2x$3]$1', '[/img]');
- node2bbcode($doc, 'img', array('src'=>'/(.+)/', 'alt'=>'/(.+)/'), '[img=$1]$2', '[/img]');
- node2bbcode($doc, 'img', array('src'=>'/(.+)/'), '[img]$1', '[/img]');
-
- node2bbcode($doc, 'video', array('src'=>'/(.+)/'), '[video]$1', '[/video]');
- node2bbcode($doc, 'audio', array('src'=>'/(.+)/'), '[audio]$1', '[/audio]');
-// node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), '[iframe]$1', '[/iframe]');
+ node2bbcode($doc, 'blockquote', array(), '[quote]', '[/quote]');
+ node2bbcode($doc, 'pre', array(), "", "");
node2bbcode($doc, 'code', array('class'=>'/(.+)/'), '[code=$1]', '[/code]');
node2bbcode($doc, 'code', array(), '[code]', '[/code]');
+ node2bbcode($doc, 'p', array('class'=>'MsoNormal'), "\n", "");
+ node2bbcode($doc, 'p', array(), "\n", "\n");
+
+ node2bbcode($doc, 'div', array('class'=>'MsoNormal'), "\r", "");
+ node2bbcode($doc, 'div', array(), "\r", "\r");
+
$message = $doc->saveHTML();
// I'm removing the UTF-8 encoding of a NO-BREAK SPACE codepoint
diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php
index 0da50f77a..6f79c45f4 100644
--- a/tests/unit/includes/BBCodeTest.php
+++ b/tests/unit/includes/BBCodeTest.php
@@ -198,6 +198,10 @@ class BBCodeTest extends UnitTestCase {
'nested tags with ampersand and new line' => [
"<b>\n<i>foo & bar</i></b>",
'[b] [i]foo &amp; bar[/i][/b]'
+ ],
+ 'html reshares from streams' => [
+ '<div><div><a href="https://example.com"><img src="https://example.com/image.jpg" alt="image/photo"></a> shared something</div>something</div>',
+ '[url=https://example.com][img=https://example.com/image.jpg]image/photo[/img][/url] shared something' . "\n" . 'something'
]
];
}
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index 17113d857..9c1c3eb6a 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => 'zotlabs/hubzilla',
'pretty_version' => 'dev-9.0RC',
'version' => 'dev-9.0RC',
- 'reference' => 'fe018d646a4f25d3512059f6e8d520441e95967c',
+ 'reference' => '8754f72e63ea0fd9067c20104a2b068e5c518d0a',
'type' => 'application',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -340,7 +340,7 @@
'zotlabs/hubzilla' => array(
'pretty_version' => 'dev-9.0RC',
'version' => 'dev-9.0RC',
- 'reference' => 'fe018d646a4f25d3512059f6e8d520441e95967c',
+ 'reference' => '8754f72e63ea0fd9067c20104a2b068e5c518d0a',
'type' => 'application',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),