mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-25 01:36:45 +00:00
@@ -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" =:
|
||||
|
||||
Reference in New Issue
Block a user