Fix feed permalink rendering with markdown escape set to true
Fixes #1134
This commit is contained in:
parent
73da3a269b
commit
dd6794cff8
2 changed files with 63 additions and 0 deletions
tests/plugins
|
@ -49,6 +49,30 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertNotFalse(strpos($data['links'][0]['description'], '<p>'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test render_feed hook.
|
||||
*/
|
||||
public function testMarkdownFeed()
|
||||
{
|
||||
$markdown = '# My title' . PHP_EOL . 'Very interesting content.';
|
||||
$markdown .= '— <a href="http://domain.tld/?0oc_VQ" title="Permalien">Permalien</a>';
|
||||
$data = array(
|
||||
'links' => array(
|
||||
0 => array(
|
||||
'description' => $markdown,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$data = hook_markdown_render_feed($data, $this->conf);
|
||||
$this->assertNotFalse(strpos($data['links'][0]['description'], '<h1>'));
|
||||
$this->assertNotFalse(strpos($data['links'][0]['description'], '<p>'));
|
||||
$this->assertStringEndsWith(
|
||||
'— <a href="http://domain.tld/?0oc_VQ">Permalien</a></p></div>',
|
||||
$data['links'][0]['description']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test render_daily hook.
|
||||
* Only check that there is basic markdown rendering.
|
||||
|
@ -104,6 +128,37 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals($text, $reversedText);
|
||||
}
|
||||
|
||||
public function testReverseFeedPermalink()
|
||||
{
|
||||
$text = 'Description... ';
|
||||
$text .= '— <a href="http://domain.tld/?0oc_VQ" title="Permalien">Permalien</a>';
|
||||
$expected = 'Description... — [Permalien](http://domain.tld/?0oc_VQ)';
|
||||
$processedText = reverse_feed_permalink($text);
|
||||
|
||||
$this->assertEquals($expected, $processedText);
|
||||
}
|
||||
|
||||
public function testReverseLastFeedPermalink()
|
||||
{
|
||||
$text = 'Description... ';
|
||||
$text .= '<br>— <a href="http://domain.tld/?0oc_VQ" title="Permalien">Permalien</a>';
|
||||
$expected = $text;
|
||||
$text .= '<br>— <a href="http://domain.tld/?0oc_VQ" title="Permalien">Permalien</a>';
|
||||
$expected .= '<br>— [Permalien](http://domain.tld/?0oc_VQ)';
|
||||
$processedText = reverse_feed_permalink($text);
|
||||
|
||||
$this->assertEquals($expected, $processedText);
|
||||
}
|
||||
|
||||
public function testReverseNoFeedPermalink()
|
||||
{
|
||||
$text = 'Hello! Where are you from?';
|
||||
$expected = $text;
|
||||
$processedText = reverse_feed_permalink($text);
|
||||
|
||||
$this->assertEquals($expected, $processedText);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test sanitize_html().
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue