Cleaned up Main.hs to eliminate -Wall warnings.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1287 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
5eb204c86c
commit
a8920f47aa
1 changed files with 8 additions and 7 deletions
15
Main.hs
15
Main.hs
|
@ -73,7 +73,7 @@ readers = [("native" , readPandoc)
|
||||||
|
|
||||||
-- | Reader for native Pandoc format.
|
-- | Reader for native Pandoc format.
|
||||||
readPandoc :: ParserState -> String -> Pandoc
|
readPandoc :: ParserState -> String -> Pandoc
|
||||||
readPandoc state input = read input
|
readPandoc _ input = read input
|
||||||
|
|
||||||
-- | Association list of formats and pairs of writers and default headers.
|
-- | Association list of formats and pairs of writers and default headers.
|
||||||
writers :: [ ( String, ( WriterOptions -> Pandoc -> String, String ) ) ]
|
writers :: [ ( String, ( WriterOptions -> Pandoc -> String, String ) ) ]
|
||||||
|
@ -93,7 +93,7 @@ writers = [("native" , (writeDoc, ""))
|
||||||
|
|
||||||
-- | Writer for Pandoc native format.
|
-- | Writer for Pandoc native format.
|
||||||
writeDoc :: WriterOptions -> Pandoc -> String
|
writeDoc :: WriterOptions -> Pandoc -> String
|
||||||
writeDoc options = prettyPandoc
|
writeDoc _ = prettyPandoc
|
||||||
|
|
||||||
-- | Data structure for command line options.
|
-- | Data structure for command line options.
|
||||||
data Opt = Opt
|
data Opt = Opt
|
||||||
|
@ -309,9 +309,9 @@ options =
|
||||||
|
|
||||||
, Option "D" ["print-default-header"]
|
, Option "D" ["print-default-header"]
|
||||||
(ReqArg
|
(ReqArg
|
||||||
(\arg opt -> do
|
(\arg _ -> do
|
||||||
let header = case (lookup arg writers) of
|
let header = case (lookup arg writers) of
|
||||||
Just (writer, head) -> head
|
Just (_, h) -> h
|
||||||
Nothing -> error ("Unknown reader: " ++ arg)
|
Nothing -> error ("Unknown reader: " ++ arg)
|
||||||
hPutStr stdout header
|
hPutStr stdout header
|
||||||
exitWith ExitSuccess)
|
exitWith ExitSuccess)
|
||||||
|
@ -348,11 +348,11 @@ options =
|
||||||
|
|
||||||
-- Returns usage message
|
-- Returns usage message
|
||||||
usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String
|
usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String
|
||||||
usageMessage programName options = usageInfo
|
usageMessage programName opts = usageInfo
|
||||||
(programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++
|
(programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++
|
||||||
(joinWithSep ", " $ map fst readers) ++ "\nOutput formats: " ++
|
(joinWithSep ", " $ map fst readers) ++ "\nOutput formats: " ++
|
||||||
(joinWithSep ", " $ map fst writers) ++ "\nOptions:")
|
(joinWithSep ", " $ map fst writers) ++ "\nOptions:")
|
||||||
options
|
opts
|
||||||
|
|
||||||
-- Determine default reader based on source file extensions
|
-- Determine default reader based on source file extensions
|
||||||
defaultReaderName :: [FilePath] -> String
|
defaultReaderName :: [FilePath] -> String
|
||||||
|
@ -393,9 +393,10 @@ defaultWriterName x =
|
||||||
".db" -> "docbook"
|
".db" -> "docbook"
|
||||||
".xml" -> "docbook"
|
".xml" -> "docbook"
|
||||||
".sgml" -> "docbook"
|
".sgml" -> "docbook"
|
||||||
['.',x] | x `elem` ['1'..'9'] -> "man"
|
['.',y] | y `elem` ['1'..'9'] -> "man"
|
||||||
_ -> "html"
|
_ -> "html"
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
|
|
||||||
rawArgs <- getArgs
|
rawArgs <- getArgs
|
||||||
|
|
Loading…
Add table
Reference in a new issue