Merge pull request #8645 from annando/issue-8642

issue 8642: Make hashtags more compatible
This commit is contained in:
Hypolite Petovan 2020-05-16 15:17:28 -04:00 committed by GitHub
commit dffa55bf16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1801,12 +1801,16 @@ class BBCode
* - #[url=<anything>]<term>[/url] * - #[url=<anything>]<term>[/url]
* - [url=<anything>]#<term>[/url] * - [url=<anything>]#<term>[/url]
*/ */
$text = preg_replace_callback("/(?:#\[url\=[^\[\]]*\]|\[url\=[^\[\]]*\]#)(.*?)\[\/url\]/ism", function($matches) { $text = preg_replace_callback("/(?:#\[url\=[^\[\]]*\]|\[url\=[^\[\]]*\]#)(.*?)\[\/url\]/ism", function($matches) use ($simple_html) {
return '#<a href="' if ($simple_html == BBCode::ACTIVITYPUB) {
. DI::baseUrl() . '/search?tag=' . rawurlencode($matches[1]) return '<a href="' . DI::baseUrl() . '/search?tag=' . rawurlencode($matches[1])
. '" class="tag" rel="tag" title="' . XML::escape($matches[1]) . '">' . '" data-tag="' . XML::escape($matches[1]) . '" rel="tag ugc">#'
. XML::escape($matches[1]) . XML::escape($matches[1]) . '</a>';
. '</a>'; } else {
return '#<a href="' . DI::baseUrl() . '/search?tag=' . rawurlencode($matches[1])
. '" class="tag" rel="tag" title="' . XML::escape($matches[1]) . '">'
. XML::escape($matches[1]) . '</a>';
}
}, $text); }, $text);
// We need no target="_blank" rel="noopener noreferrer" for local links // We need no target="_blank" rel="noopener noreferrer" for local links