diff options
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 8ebf02c33..96244e58f 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -462,12 +462,15 @@ link = try $ do else generateReference url title return $ Link (normalizeSpaces label) ref -image = try (do +image = try $ do (tag, attributes) <- htmlTag "img" url <- case (extractAttribute "src" attributes) of Just url -> do {return url} Nothing -> fail "no src" let title = fromMaybe "" (extractAttribute "title" attributes) let alt = fromMaybe "" (extractAttribute "alt" attributes) - ref <- generateReference url title - return (Image [Str alt] ref)) + state <- getState + ref <- if stateInlineLinks state + then return (Src url title) + else generateReference url title + return $ Image [Str alt] ref |