aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-09-26 22:22:14 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-09-26 22:22:14 -0700
commitf76478bcb9a651623d33c6d4ad766a126bc590a1 (patch)
tree79d1c11a4476088ee1802578d79768371817344f /src
parent90a42fae052e8e9dd08605c05c2c3fe000fe9b4e (diff)
downloadpandoc-f76478bcb9a651623d33c6d4ad766a126bc590a1.tar.gz
RST reader: Support :target: on .. image:: blocks.
Still not supported on substitution definitions.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 1d64ff220..4527dba14 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -257,10 +257,14 @@ imageBlock = try $ do
fields <- try $ do indent <- lookAhead $ many (oneOf " /t")
many $ rawFieldListItem indent
optional blanklines
- case lookup "alt" fields of
- Just alt -> return $ Plain [Image [Str $ removeTrailingSpace alt]
- (src, "")]
- Nothing -> return $ Plain [Image [Str "image"] (src, "")]
+ let alt = maybe [Str "image"] (\x -> [Str $ removeTrailingSpace x])
+ $ lookup "alt" fields
+ let img = Image alt (src,"")
+ return $ Para [case lookup "target" fields of
+ Just t -> Link [img]
+ (escapeURI $ removeLeadingTrailingSpace t,"")
+ Nothing -> img]
+
--
-- header blocks
--