From 2ca510111349d2da8fabbd38e2dcb4bad923b6f2 Mon Sep 17 00:00:00 2001 From: Hans-Peter Deifel Date: Wed, 25 Feb 2015 16:40:30 +0100 Subject: Org reader: Allow image links with non-image targets Org-Mode's own html exporter converts the following org link: [[http://example.com][https://www.haskell.org/static/img/logo.png]] to logo.png but pandoc generates: https://www.haskell.org/static/img/logo.png which is useless. With this patch, it generates: --- src/Text/Pandoc/Readers/Org.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs index f16aed48d..5b153b418 100644 --- a/src/Text/Pandoc/Readers/Org.hs +++ b/src/Text/Pandoc/Readers/Org.hs @@ -1106,7 +1106,7 @@ explicitOrImageLink = try $ do char ']' return $ do src <- srcF - if isImageFilename src && isImageFilename title + if isImageFilename title then pure $ B.link src "" $ B.image title mempty mempty else linkToInlinesF src =<< title' -- cgit v1.2.3 From 58719551698dbb0f924101f128c7d0fafc3fd3d8 Mon Sep 17 00:00:00 2001 From: Hans-Peter Deifel Date: Thu, 26 Feb 2015 13:11:50 +0100 Subject: Org reader: Add test for image links Tests for image links with non-image targets, as introduced in commit 2ca5101. --- tests/Tests/Readers/Org.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs index 39c40cd45..3a26861f0 100644 --- a/tests/Tests/Readers/Org.hs +++ b/tests/Tests/Readers/Org.hs @@ -212,6 +212,10 @@ tests = "[[sunset.png][dusk.svg]]" =?> (para $ link "sunset.png" "" (image "dusk.svg" "" "")) + , "Image link with non-image target" =: + "[[http://example.com][logo.png]]" =?> + (para $ link "http://example.com" "" (image "logo.png" "" "")) + , "Plain link" =: "Posts on http://zeitlens.com/ can be funny at times." =?> (para $ spcSep [ "Posts", "on" -- cgit v1.2.3