change_src_func :: String -> String
change_src_func old_src =
case Map.lookup old_src image_map of
- -- Leave it alone if we don't have the file locally
- Nothing -> old_src
+ -- If we don't have the file, empty the src. Pandoc will crash
+ -- otherwise.
+ Nothing -> ""
Just v -> v
change_src :: (ArrowXml a) => a XmlTree XmlTree
fp_parse xml = do
hl <- parse_headline xml
parsed_articles <- fp_parse_articles xml
- case parsed_articles of
- [] -> return Nothing
- x -> return $ Just $ FullPage (fromJust hl) x
+ return $ case parsed_articles of
+ [] -> Nothing
+ x -> Just $ FullPage (fromJust hl) x