Fix an issue with links not being reversed in code blocks
Fixes #672 + Markdown to HTML unit test
This commit is contained in:
parent
e680cfea08
commit
c5941f316a
4 changed files with 67 additions and 5 deletions
tests/plugins
|
@ -151,4 +151,17 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
|
|||
$data = hook_markdown_render_daily($data);
|
||||
$this->assertEquals($str, $data['cols'][0][0]['formatedDescription']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test hashtag links processed with markdown.
|
||||
*/
|
||||
function testMarkdownHashtagLinks()
|
||||
{
|
||||
$md = file_get_contents('tests/plugins/resources/markdown.md');
|
||||
$md = format_description($md);
|
||||
$html = file_get_contents('tests/plugins/resources/markdown.html');
|
||||
|
||||
$data = process_markdown($md);
|
||||
$this->assertEquals($html, $data);
|
||||
}
|
||||
}
|
||||
|
|
24
tests/plugins/resources/markdown.html
Normal file
24
tests/plugins/resources/markdown.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<div class="markdown"><ul>
|
||||
<li>test:
|
||||
<ul>
|
||||
<li><a href="http://link.tld">zero</a></li>
|
||||
<li><a href="http://link.tld">two</a></li>
|
||||
<li><a href="http://link.tld">three</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<ol>
|
||||
<li><a href="http://link.tld">zero</a>
|
||||
<ol>
|
||||
<li><a href="http://link.tld">two</a></li>
|
||||
<li><a href="http://link.tld">three</a></li>
|
||||
<li><a href="http://link.tld">four</a></li>
|
||||
<li>foo <a href="?addtag=foobar" title="Hashtag foobar">#foobar</a></li>
|
||||
</ol></li>
|
||||
</ol>
|
||||
<p><a href="?addtag=foobar" title="Hashtag foobar">#foobar</a> foo <code>lol #foo</code> <a href="?addtag=bar" title="Hashtag bar">#bar</a></p>
|
||||
<p>fsdfs <a href="http://link.tld">http://link.tld</a> <a href="?addtag=foobar" title="Hashtag foobar">#foobar</a> <code>http://link.tld</code></p>
|
||||
<pre><code>http://link.tld #foobar
|
||||
next #foo</code></pre>
|
||||
<p>Block:</p>
|
||||
<pre><code>lorem ipsum #foobar http://link.tld
|
||||
#foobar http://link.tld</code></pre></div>
|
24
tests/plugins/resources/markdown.md
Normal file
24
tests/plugins/resources/markdown.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
* test:
|
||||
* [zero](http://link.tld)
|
||||
+ [two](http://link.tld)
|
||||
- [three](http://link.tld)
|
||||
|
||||
1. [zero](http://link.tld)
|
||||
2. [two](http://link.tld)
|
||||
3. [three](http://link.tld)
|
||||
4. [four](http://link.tld)
|
||||
5. foo #foobar
|
||||
|
||||
#foobar foo `lol #foo` #bar
|
||||
|
||||
fsdfs http://link.tld #foobar `http://link.tld`
|
||||
|
||||
http://link.tld #foobar
|
||||
next #foo
|
||||
|
||||
Block:
|
||||
|
||||
```
|
||||
lorem ipsum #foobar http://link.tld
|
||||
#foobar http://link.tld
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue