Normalize Hashtag behavior in Mastodon Apps (#407)
* Update class-hashtag.php * Update class-shortcodes.php * fix unit tests * missed two tests --------- Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
This commit is contained in:
parent
c748d12d89
commit
26ad8975d7
3 changed files with 6 additions and 6 deletions
|
@ -89,7 +89,7 @@ class Hashtag {
|
||||||
|
|
||||||
if ( $tag_object ) {
|
if ( $tag_object ) {
|
||||||
$link = \get_term_link( $tag_object, 'post_tag' );
|
$link = \get_term_link( $tag_object, 'post_tag' );
|
||||||
return \sprintf( '<a rel="tag" class="u-tag u-category" href="%s">#%s</a>', $link, $tag );
|
return \sprintf( '<a rel="tag" class="hashtag u-tag u-category" href="%s">#%s</a>', $link, $tag );
|
||||||
}
|
}
|
||||||
|
|
||||||
return '#' . $tag;
|
return '#' . $tag;
|
||||||
|
|
|
@ -359,7 +359,7 @@ class Shortcodes {
|
||||||
|
|
||||||
foreach ( $categories as $category ) {
|
foreach ( $categories as $category ) {
|
||||||
$hash_tags[] = \sprintf(
|
$hash_tags[] = \sprintf(
|
||||||
'<a rel="tag" class="u-tag u-category" href="%s">%s</a>',
|
'<a rel="tag" class="hashtag u-tag u-category" href="%s">%s</a>',
|
||||||
\esc_url( \get_category_link( $category ) ),
|
\esc_url( \get_category_link( $category ) ),
|
||||||
esc_hashtag( $category->name )
|
esc_hashtag( $category->name )
|
||||||
);
|
);
|
||||||
|
|
|
@ -35,12 +35,12 @@ ENDPRE;
|
||||||
array( 'test', 'test' ),
|
array( 'test', 'test' ),
|
||||||
array( '#test', '#test' ),
|
array( '#test', '#test' ),
|
||||||
array( 'hallo #test test', 'hallo #test test' ),
|
array( 'hallo #test test', 'hallo #test test' ),
|
||||||
array( 'hallo #object test', 'hallo <a rel="tag" class="u-tag u-category" href="%s">#object</a> test' ),
|
array( 'hallo #object test', 'hallo <a rel="tag" class="hashtag u-tag u-category" href="%s">#object</a> test' ),
|
||||||
array( '#object test', '<a rel="tag" class="u-tag u-category" href="%s">#object</a> test' ),
|
array( '#object test', '<a rel="tag" class="hashtag u-tag u-category" href="%s">#object</a> test' ),
|
||||||
array( 'hallo <a href="http://test.test/#object">test</a> test', 'hallo <a href="http://test.test/#object">test</a> test' ),
|
array( 'hallo <a href="http://test.test/#object">test</a> test', 'hallo <a href="http://test.test/#object">test</a> test' ),
|
||||||
array( 'hallo <a href="http://test.test/#object">#test</a> test', 'hallo <a href="http://test.test/#object">#test</a> test' ),
|
array( 'hallo <a href="http://test.test/#object">#test</a> test', 'hallo <a href="http://test.test/#object">#test</a> test' ),
|
||||||
array( '<div>hallo #object test</div>', '<div>hallo <a rel="tag" class="u-tag u-category" href="%s">#object</a> test</div>' ),
|
array( '<div>hallo #object test</div>', '<div>hallo <a rel="tag" class="hashtag u-tag u-category" href="%s">#object</a> test</div>' ),
|
||||||
array( '<div>hallo #object</div>', '<div>hallo <a rel="tag" class="u-tag u-category" href="%s">#object</a></div>' ),
|
array( '<div>hallo #object</div>', '<div>hallo <a rel="tag" class="hashtag u-tag u-category" href="%s">#object</a></div>' ),
|
||||||
array( '<div>#object</div>', '<div>#object</div>' ),
|
array( '<div>#object</div>', '<div>#object</div>' ),
|
||||||
array( '<a>#object</a>', '<a>#object</a>' ),
|
array( '<a>#object</a>', '<a>#object</a>' ),
|
||||||
array( '<div style="color: #ccc;">object</a>', '<div style="color: #ccc;">object</a>' ),
|
array( '<div style="color: #ccc;">object</a>', '<div style="color: #ccc;">object</a>' ),
|
||||||
|
|
Loading…
Reference in a new issue