git.iko.soy/typeable/pandoc
on master help sign in
Better formatting of input/output formats in `--help`.
febbf5dJohn MacFarlane
src/pandoc.hs+7−7
@@ -65,17 +65,17 @@ compileInfo :: String
65compileInfo =
65compileInfo =
66 "\nCompiled with citeproc support." ++
66 "\nCompiled with citeproc support." ++
67 "\nCompiled with syntax highlighting support for:\n" ++
67 "\nCompiled with syntax highlighting support for:\n" ++
68− wrapWords 78 languages
68+ wrapWords 4 78 languages
69
69
70-- | Converts a list of strings into a single string with the items printed as
70-- | Converts a list of strings into a single string with the items printed as
71-- comma separated words in lines with a maximum line length.
71-- comma separated words in lines with a maximum line length.
72−wrapWords :: Int -> [String] -> String
72+wrapWords :: Int -> Int -> [String] -> String
73−wrapWords c = wrap' c c where
73+wrapWords indent c = wrap' (c - indent) (c - indent)
74− wrap' _ _ [] = ""
74+ where wrap' _ _ [] = ""
75 wrap' cols remaining (x:xs) = if remaining == cols
75 wrap' cols remaining (x:xs) = if remaining == cols
76 then x ++ wrap' cols (remaining - length x) xs
76 then x ++ wrap' cols (remaining - length x) xs
77 else if (length x + 1) > remaining
77 else if (length x + 1) > remaining
78− then ",\n" ++ x ++ wrap' cols (cols - length x) xs
78+ then ",\n" ++ replicate indent ' ' ++ x ++ wrap' cols (cols - length x) xs
79 else ", " ++ x ++ wrap' cols (remaining - (length x + 2)) xs
79 else ", " ++ x ++ wrap' cols (remaining - (length x + 2)) xs
80
80
81isNonTextOutput :: String -> Bool
81isNonTextOutput :: String -> Bool
@@ -620,8 +620,8 @@ options =
620usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String
620usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String
621usageMessage programName = usageInfo
621usageMessage programName = usageInfo
622 (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++
622 (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++
623− (intercalate ", " $ map fst readers) ++ "\nOutput formats: " ++
623+ (wrapWords 16 78 $ map fst readers) ++ "\nOutput formats: " ++
624− (intercalate ", " $ map fst writers ++ ["odt","epub"]) ++ "\nOptions:")
624+ (wrapWords 16 78 $ map fst writers ++ ["odt","epub"]) ++ "\nOptions:")
625
625
626-- Determine default reader based on source file extensions
626-- Determine default reader based on source file extensions
627defaultReaderName :: String -> [FilePath] -> String
627defaultReaderName :: String -> [FilePath] -> String