@@ -1,6 +1,7 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2-- Create pandoc.1 man and pandoc_markdown.5 man pages from README
2-- Create pandoc.1 man and pandoc_markdown.5 man pages from README
3import Text.Pandoc
3import Text.Pandoc
4+import Text.Pandoc.Error (handleError)
4import qualified Text.Pandoc.UTF8 as UTF8
5import qualified Text.Pandoc.UTF8 as UTF8
5import Data.Char (toUpper)
6import Data.Char (toUpper)
6import Control.Monad
7import Control.Monad
@@ -27,7 +28,7 @@ main = do
28 unless (null ds1 && null ds2) $ do
29 unless (null ds1 && null ds2) $ do
29 rmContents <- UTF8.readFile "README"
30 rmContents <- UTF8.readFile "README"
30− let (Pandoc meta blocks) = normalize $ readMarkdown def rmContents
31+ let (Pandoc meta blocks) = normalize $ handleError $ readMarkdown def rmContents
31 let manBlocks = removeSect [Str "Wrappers"]
32 let manBlocks = removeSect [Str "Wrappers"]
32 $ removeSect [Str "Pandoc's",Space,Str "markdown"] blocks
33 $ removeSect [Str "Pandoc's",Space,Str "markdown"] blocks
33 let syntaxBlocks = extractSect [Str "Pandoc's",Space,Str "markdown"] blocks
34 let syntaxBlocks = extractSect [Str "Pandoc's",Space,Str "markdown"] blocks
@@ -101,4 +102,3 @@ modifiedDependencies file dependencies = do
101 depModTimes <- mapM getModificationTime dependencies
102 depModTimes <- mapM getModificationTime dependencies
102 let modified = zipWith (\dep time -> if time > fileModTime then Just dep else Nothing) dependencies depModTimes
103 let modified = zipWith (\dep time -> if time > fileModTime then Just dep else Nothing) dependencies depModTimes
103 return $ catMaybes modified
104 return $ catMaybes modified