Commit 82ec02d4 authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Only write back markdown source if content has actually changed

parent 8c45a68a
......@@ -41,9 +41,7 @@ randomAlpha = getStdRandom (randomR ('a', 'z'))
-- | Writes a pandoc document to a markdown file.
writeToMarkdownFile :: FilePath -> Pandoc -> IO ()
writeToMarkdownFile filepath pandoc
-- putStrLn $ "Writing back: " ++ filepath
= do
writeToMarkdownFile filepath pandoc = do
template <- getResourceString $ "template" </> "deck.md"
let extensions =
(disableExtension Ext_simple_tables .
......@@ -58,8 +56,9 @@ writeToMarkdownFile filepath pandoc
, writerColumns = 999
, writerSetextHeaders = False
}
runIO (Markdown.writeMarkdown options pandoc) >>= handleError >>=
T.writeFile filepath
markdown <- runIO (Markdown.writeMarkdown options pandoc) >>= handleError
fileContent <- T.readFile filepath
when (markdown /= fileContent) $ T.writeFile filepath markdown
provideSlideIds :: Pandoc -> IO Pandoc
provideSlideIds (Pandoc meta body) = do
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment