X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FLWN%2FPage.hs;h=5f3b9ee608f42dc9895c458e3968e0363f4702bb;hp=3d53284c4b66e9c67ff222d19982ce4e2ced45d2;hb=HEAD;hpb=7b567f5bc275be3212d485e2fe537949c921df3d diff --git a/src/LWN/Page.hs b/src/LWN/Page.hs index 3d53284..5f3b9ee 100644 --- a/src/LWN/Page.hs +++ b/src/LWN/Page.hs @@ -4,11 +4,10 @@ module LWN.Page where import Control.Concurrent.ParallelIO (parallel) -import qualified Data.Map as Map (lookup) import Data.Time (getCurrentTime) import qualified Data.ByteString.Lazy as B (ByteString, hPut) import Data.String.Utils (split, strip) -import qualified Data.Map as Map (Map, empty, insert) +import qualified Data.Map as Map (Map, empty, insert, lookup) import Data.Maybe (catMaybes, fromJust, isNothing) import Prelude hiding (readFile) import System.IO (Handle, hClose, hFlush) @@ -163,8 +162,9 @@ replace_remote_img_srcs image_map = 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