mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-26 02:06:32 +00:00
HTML writer: improved detection of image links.
Previously image links with queries were not recognized, leading to use of an embed tag rather than an img tag.
This commit is contained in:
@@ -40,6 +40,7 @@ import Text.Pandoc.Slides
|
||||
import Text.Pandoc.Highlighting ( highlight, styleToCss,
|
||||
formatHtmlInline, formatHtmlBlock )
|
||||
import Text.Pandoc.XML (fromEntities, escapeStringForXML)
|
||||
import Network.URI ( parseURIReference, URI(..) )
|
||||
import Network.HTTP ( urlEncode )
|
||||
import Numeric ( showHex )
|
||||
import Data.Char ( ord, toLower )
|
||||
@@ -396,7 +397,10 @@ imageExts = [ "art", "bmp", "cdr", "cdt", "cpt", "cr2", "crw", "djvu", "erf",
|
||||
|
||||
treatAsImage :: FilePath -> Bool
|
||||
treatAsImage fp =
|
||||
let ext = map toLower $ drop 1 $ takeExtension fp
|
||||
let path = case uriPath `fmap` parseURIReference fp of
|
||||
Nothing -> fp
|
||||
Just up -> up
|
||||
ext = map toLower $ drop 1 $ takeExtension path
|
||||
in null ext || ext `elem` imageExts
|
||||
|
||||
-- | Convert Pandoc block element to HTML.
|
||||
|
||||
Reference in New Issue
Block a user