From 12b1263da27a945c50b11f3fe4854ba6dc5f0ee2 Mon Sep 17 00:00:00 2001 From: Mizunashi Mana Date: Fri, 9 Nov 2018 23:08:42 +0900 Subject: [PATCH] Partial resolve #35 --- .../Plugin/Mdpage/MarkdownRendererTrait.php | 2 +- .../Test/Plugin/Mdpage/MarkdownSpecTest.php | 21 ++++++++++++------- tests/specs/issue-35/Content.md | 1 + tests/specs/issue-35/Content_GFM.html | 3 +++ .../specs/issue-35/Content_MarkdownExtra.html | 3 +++ tests/specs/issue-35/Content_Traditional.html | 3 +++ 6 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 tests/specs/issue-35/Content.md create mode 100644 tests/specs/issue-35/Content_GFM.html create mode 100644 tests/specs/issue-35/Content_MarkdownExtra.html create mode 100644 tests/specs/issue-35/Content_Traditional.html diff --git a/src/DokuWiki/Plugin/Mdpage/MarkdownRendererTrait.php b/src/DokuWiki/Plugin/Mdpage/MarkdownRendererTrait.php index 811d4c6..d874fca 100644 --- a/src/DokuWiki/Plugin/Mdpage/MarkdownRendererTrait.php +++ b/src/DokuWiki/Plugin/Mdpage/MarkdownRendererTrait.php @@ -315,7 +315,7 @@ protected function renderLink($block) { $url = $block['url']; if (strpos($url, '/') === false) { $this->renderer->internallink($url, $this->collectText($block['text'])); - } elseif (empty($block['title'])) { + } else { // title is not supported $this->renderer->externallink($url, $this->collectText($block['text'])); } diff --git a/tests/DokuWiki/Test/Plugin/Mdpage/MarkdownSpecTest.php b/tests/DokuWiki/Test/Plugin/Mdpage/MarkdownSpecTest.php index f03cfd9..8dc705b 100644 --- a/tests/DokuWiki/Test/Plugin/Mdpage/MarkdownSpecTest.php +++ b/tests/DokuWiki/Test/Plugin/Mdpage/MarkdownSpecTest.php @@ -29,13 +29,6 @@ public function testFeatures() { ); } - public function testIssue24() { - $this->assertSpec( - 'issue-24/Content', - $this->defaultFlavors - ); - } - public function testHtmlok() { global $conf; $conf['htmlok'] = 1; @@ -60,6 +53,20 @@ public function testCannotLookupRef() { ); } + public function testIssue24() { + $this->assertSpec( + 'issue-24/Content', + $this->defaultFlavors + ); + } + + public function testIssue35() { + $this->assertSpec( + 'issue-35/Content', + $this->defaultFlavors + ); + } + /** * This plugin has fallback HTML rendering for PHP 7.2 * So, the results of rendering are different between PHP >= 7.2 and PHP < 7.2. diff --git a/tests/specs/issue-35/Content.md b/tests/specs/issue-35/Content.md new file mode 100644 index 0000000..908e5fe --- /dev/null +++ b/tests/specs/issue-35/Content.md @@ -0,0 +1 @@ +[link](https://example.com "title") diff --git a/tests/specs/issue-35/Content_GFM.html b/tests/specs/issue-35/Content_GFM.html new file mode 100644 index 0000000..82dc89b --- /dev/null +++ b/tests/specs/issue-35/Content_GFM.html @@ -0,0 +1,3 @@ +

+link +

diff --git a/tests/specs/issue-35/Content_MarkdownExtra.html b/tests/specs/issue-35/Content_MarkdownExtra.html new file mode 100644 index 0000000..82dc89b --- /dev/null +++ b/tests/specs/issue-35/Content_MarkdownExtra.html @@ -0,0 +1,3 @@ +

+link +

diff --git a/tests/specs/issue-35/Content_Traditional.html b/tests/specs/issue-35/Content_Traditional.html new file mode 100644 index 0000000..82dc89b --- /dev/null +++ b/tests/specs/issue-35/Content_Traditional.html @@ -0,0 +1,3 @@ +

+link +