aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Org/Inlines.hs11
-rw-r--r--test/Tests/Readers/Org/Inline.hs4
2 files changed, 10 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs
index b8aee0322..6560def7e 100644
--- a/src/Text/Pandoc/Readers/Org/Inlines.hs
+++ b/src/Text/Pandoc/Readers/Org/Inlines.hs
@@ -448,11 +448,12 @@ selflinkOrImage :: PandocMonad m => OrgParser m (F Inlines)
selflinkOrImage = try $ do
target <- char '[' *> linkTarget <* char ']'
case cleanLinkString target of
- Nothing -> return $ internalLink target (B.str target)
- Just nonDocTgt -> returnF $
- if isImageFilename nonDocTgt
- then B.image nonDocTgt "" ""
- else B.link nonDocTgt "" (B.str target)
+ Nothing -> case target of
+ '#':_ -> returnF $ B.link target "" (B.str target)
+ _ -> return $ internalLink target (B.str target)
+ Just nonDocTgt -> if isImageFilename nonDocTgt
+ then returnF $ B.image nonDocTgt "" ""
+ else returnF $ B.link nonDocTgt "" (B.str target)
plainLink :: PandocMonad m => OrgParser m (F Inlines)
plainLink = try $ do
diff --git a/test/Tests/Readers/Org/Inline.hs b/test/Tests/Readers/Org/Inline.hs
index 7f8873642..e5996d4d8 100644
--- a/test/Tests/Readers/Org/Inline.hs
+++ b/test/Tests/Readers/Org/Inline.hs
@@ -215,6 +215,10 @@ tests =
"[[http://zeitlens.com/]]" =?>
para (link "http://zeitlens.com/" "" "http://zeitlens.com/")
+ , "Internal self-link (reference)" =:
+ "[[#rabbit]]" =?>
+ para (link "#rabbit" "" "#rabbit")
+
, "Absolute file link" =:
"[[/url][hi]]" =?>
para (link "file:///url" "" "hi")