From d4d905f8a84f1f2f7485d00447418c6f9fb574a9 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 9 Feb 2008 03:22:01 +0000 Subject: [PATCH] Have --version print a list of supported languages for syntax highlighting. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1226 788f1e2b-df1e-0410-8736-df70ead52e1b --- Main.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Main.hs b/Main.hs index 5f198b349..4889ca30a 100644 --- a/Main.hs +++ b/Main.hs @@ -49,9 +49,18 @@ copyrightMessage = "\nCopyright (C) 2006-7 John MacFarlane\n\ \warranty, not even for merchantability or fitness for a particular purpose." compileOptions :: String -compileOptions = if null languages - then " [compiled without syntax highlighting support]" - else " [compiled with syntax highlighting support]" +compileOptions = + if null languages + then "\nCompiled without syntax highlighting support." + else "\nCompiled with syntax highlighting support for the following languages:\n" ++ + (unlines $ map unwords $ chunk 5 $ + map (\s -> s ++ replicate (15 - length s) ' ') languages) + +-- | Splits a list into groups of at most n. +chunk :: Int -> [a] -> [[a]] +chunk size lst = + let (next, rest) = splitAt size lst + in if null rest then [next] else next : chunk size rest -- | Association list of formats and readers. readers :: [(String, ParserState -> String -> Pandoc)]