summaryrefslogtreecommitdiff
path: root/src/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2011-12-29 13:53:25 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2011-12-29 13:53:25 -0800
commitfebbf5d818af46cecbfd8e3c704e967bbb61831d (patch)
tree5b16567f7b0b06bb559ffb1e327214250c441ec2 /src/pandoc.hs
parentcdb01e6d54aace50ead88964a7182c5b9e1126a4 (diff)
Better formatting of input/output formats in `--help`.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r--src/pandoc.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index e55875c69..9fac0f56e 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -65,17 +65,17 @@ compileInfo :: String
compileInfo =
"\nCompiled with citeproc support." ++
"\nCompiled with syntax highlighting support for:\n" ++
- wrapWords 78 languages
+ wrapWords 4 78 languages
-- | Converts a list of strings into a single string with the items printed as
-- comma separated words in lines with a maximum line length.
-wrapWords :: Int -> [String] -> String
-wrapWords c = wrap' c c where
- wrap' _ _ [] = ""
+wrapWords :: Int -> Int -> [String] -> String
+wrapWords indent c = wrap' (c - indent) (c - indent)
+ where wrap' _ _ [] = ""
wrap' cols remaining (x:xs) = if remaining == cols
then x ++ wrap' cols (remaining - length x) xs
else if (length x + 1) > remaining
- then ",\n" ++ x ++ wrap' cols (cols - length x) xs
+ then ",\n" ++ replicate indent ' ' ++ x ++ wrap' cols (cols - length x) xs
else ", " ++ x ++ wrap' cols (remaining - (length x + 2)) xs
isNonTextOutput :: String -> Bool
@@ -620,8 +620,8 @@ options =
usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String
usageMessage programName = usageInfo
(programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++
- (intercalate ", " $ map fst readers) ++ "\nOutput formats: " ++
- (intercalate ", " $ map fst writers ++ ["odt","epub"]) ++ "\nOptions:")
+ (wrapWords 16 78 $ map fst readers) ++ "\nOutput formats: " ++
+ (wrapWords 16 78 $ map fst writers ++ ["odt","epub"]) ++ "\nOptions:")
-- Determine default reader based on source file extensions
defaultReaderName :: String -> [FilePath] -> String