parent
b907d25fe4
commit
f5d7d41cbd
2 changed files with 6 additions and 1 deletions
|
@ -26,7 +26,8 @@ import Text.Pandoc.Shared (elemText)
|
|||
isImageFilename :: Text -> Bool
|
||||
isImageFilename fp = hasImageExtension && (isValid (T.unpack fp) || isKnownProtocolUri)
|
||||
where
|
||||
hasImageExtension = takeExtension (T.unpack fp) `elem` imageExtensions
|
||||
hasImageExtension = takeExtension (T.unpack $ T.toLower fp)
|
||||
`elem` imageExtensions
|
||||
isKnownProtocolUri = any (\x -> (x <> "://") `T.isPrefixOf` fp) protocols
|
||||
|
||||
imageExtensions = [ ".jpeg", ".jpg", ".png", ".gif", ".svg" ]
|
||||
|
|
|
@ -214,6 +214,10 @@ tests =
|
|||
, "[[file:guinea-pig.gif]]"
|
||||
] =?>
|
||||
para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
|
||||
|
||||
, "Uppercase extension" =:
|
||||
"[[file:test.PNG]]" =?>
|
||||
para (image "test.PNG" "" "")
|
||||
]
|
||||
|
||||
, "Explicit link" =:
|
||||
|
|
Loading…
Add table
Reference in a new issue