@@ -80,50 +80,6 @@ wrapWords c = wrap' c c where
8080 then ",\n" ++ x ++ wrap' cols (cols - length x) xs
8181 else ", " ++ x ++ wrap' cols (remaining - (length x + 2)) xs
8282
83−-- | Association list of formats and readers.
84−readers :: [(String, ParserState -> String -> Pandoc)]
85−readers = [("native" , readPandoc)
86− ,("markdown" , readMarkdown)
87− ,("markdown+lhs" , readMarkdown)
88− ,("rst" , readRST)
89− ,("textile" , readTextile) -- TODO : textile+lhs
90− ,("rst+lhs" , readRST)
91− ,("html" , readHtml)
92− ,("latex" , readLaTeX)
93− ,("latex+lhs" , readLaTeX)
94− ]
95−
96−-- | Reader for native Pandoc format.
97−readPandoc :: ParserState -> String -> Pandoc
98−readPandoc _ = read
99−
100−-- | Association list of formats and writers.
101−writers :: [ ( String, WriterOptions -> Pandoc -> String ) ]
102−writers = [("native" , writeNative)
103− ,("html" , writeHtmlString)
104− ,("html+lhs" , writeHtmlString)
105− ,("s5" , writeHtmlString)
106− ,("slidy" , writeHtmlString)
107− ,("docbook" , writeDocbook)
108− ,("opendocument" , writeOpenDocument)
109− ,("odt" , \_ _ -> "")
110− ,("epub" , \_ _ -> "")
111− ,("latex" , writeLaTeX)
112− ,("latex+lhs" , writeLaTeX)
113− ,("context" , writeConTeXt)
114− ,("texinfo" , writeTexinfo)
115− ,("man" , writeMan)
116− ,("markdown" , writeMarkdown)
117− ,("markdown+lhs" , writeMarkdown)
118− ,("plain" , writePlain)
119− ,("rst" , writeRST)
120− ,("rst+lhs" , writeRST)
121− ,("mediawiki" , writeMediaWiki)
122− ,("textile" , writeTextile)
123− ,("rtf" , writeRTF)
124− ,("org" , writeOrg)
125− ]
126−
12783isNonTextOutput :: String -> Bool
12884isNonTextOutput = (`elem` ["odt","epub"])
12985
@@ -210,13 +166,13 @@ options =
210166 (ReqArg
211167 (\arg opt -> return opt { optReader = map toLower arg })
212168 "FORMAT")
213− "" -- ("(" ++ (intercalate ", " $ map fst readers) ++ ")")
169+ ""
214170
215171 , Option "tw" ["to","write"]
216172 (ReqArg
217173 (\arg opt -> return opt { optWriter = map toLower arg })
218174 "FORMAT")
219− "" -- ("(" ++ (intercalate ", " $ map fst writers) ++ ")")
175+ ""
220176
221177 , Option "s" ["standalone"]
222178 (NoArg
@@ -561,7 +517,7 @@ usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String
561517usageMessage programName = usageInfo
562518 (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++
563519 (intercalate ", " $ map fst readers) ++ "\nOutput formats: " ++
564− (intercalate ", " $ map fst writers) ++ "\nOptions:")
520+ (intercalate ", " $ map fst writers ++ ["odt","epub"]) ++ "\nOptions:")
565521
566522-- Determine default reader based on source file extensions
567523defaultReaderName :: String -> [FilePath] -> String
@@ -711,8 +667,8 @@ main = do
711667 Nothing -> error ("Unknown reader: " ++ readerName')
712668
713669 let writer = case lookup writerName' writers of
714− Just _ | writerName' == "epub" -> writeEPUB epubStylesheet
715− Just _ | writerName' == "odt" -> writeODT referenceODT
670+ Nothing | writerName' == "epub" -> writeEPUB epubStylesheet
671+ Nothing | writerName' == "odt" -> writeODT referenceODT
716672 Just r -> \o ->
717673 return . fromString . r o
718674 Nothing -> error $ "Unknown writer: " ++