Merge pull request #1355 from ArthurHoaro/hotfix/feed-md-directlink
Markdown plugin: fix RSS feed direct link reverse
This commit is contained in:
commit
188a99db99
2 changed files with 11 additions and 1 deletions
|
@ -259,7 +259,7 @@ function reverse_space2nbsp($description)
|
|||
|
||||
function reverse_feed_permalink($description)
|
||||
{
|
||||
return preg_replace('@— <a href="([^"]+)" title="[^"]+">(\w+)</a>$@im', '— [$2]($1)', $description);
|
||||
return preg_replace('@— <a href="([^"]+)" title="[^"]+">([^<]+)</a>$@im', '— [$2]($1)', $description);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -156,6 +156,16 @@ public function testReverseFeedPermalink()
|
|||
$this->assertEquals($expected, $processedText);
|
||||
}
|
||||
|
||||
public function testReverseFeedDirectLink()
|
||||
{
|
||||
$text = 'Description... ';
|
||||
$text .= '— <a href="http://domain.tld/?0oc_VQ" title="Direct link">Direct link</a>';
|
||||
$expected = 'Description... — [Direct link](http://domain.tld/?0oc_VQ)';
|
||||
$processedText = reverse_feed_permalink($text);
|
||||
|
||||
$this->assertEquals($expected, $processedText);
|
||||
}
|
||||
|
||||
public function testReverseLastFeedPermalink()
|
||||
{
|
||||
$text = 'Description... ';
|
||||
|
|
Loading…
Reference in a new issue