11{-# LANGUAGE ApplicativeDo #-}
22{-# LANGUAGE LambdaCase #-}
3+ {-# LANGUAGE OverloadedStrings #-}
34{-# LANGUAGE TemplateHaskell #-}
45{-# LANGUAGE RecordWildCards #-}
6+ {-# LANGUAGE CPP #-}
57
68module Main where
79
@@ -26,7 +28,8 @@ import System.IO (hPutStrLn, stderr)
2628import Text.Pandoc.Filter.Plot (availableToolkits ,
2729 plotTransform ,
2830 defaultConfiguration ,
29- configuration , Configuration (.. ))
31+ configuration , Configuration (.. ),
32+ pandocPlotVersion )
3033import Text.Pandoc.Filter.Plot.Internal (cls , supportedSaveFormats ,
3134 toolkits , readDoc ,
3235 cleanOutputDirs ,
@@ -42,7 +45,6 @@ import Text.ParserCombinators.ReadP (readP_to_S)
4245import OpenFile (openFile )
4346
4447import qualified Data.Version as V
45- import Paths_pandoc_plot (version )
4648
4749import ManPage (embedManualHtml )
4850import ExampleConfig (embedExampleConfig )
@@ -65,10 +67,13 @@ main = join $ execParser opts
6567 where
6668 opts = info (optparse <**> helper)
6769 (fullDesc
68- <> progDesc " This pandoc filter generates plots from code blocks using a multitude of \
69- \possible renderers. This allows to keep documentation and figures in \
70- \perfect synchronicity."
71- <> header (mconcat [" pandoc-plot " , V. showVersion version, " - generate figures directly in documents" ])
70+ <> progDesc (unlines
71+ [" This pandoc filter generates plots from code blocks using a multitude of "
72+ , " possible renderers. This allows to keep documentation and figures in"
73+ , " perfect synchronicity."
74+ ]
75+ )
76+ <> header (mconcat [" pandoc-plot " , V. showVersion pandocPlotVersion, " - generate figures directly in documents" ])
7277 <> footerDoc (Just footer')
7378 )
7479
@@ -82,7 +87,7 @@ main = join $ execParser opts
8287 return $ go flag_ command_ input
8388
8489 go :: Maybe Flag -> Maybe Command -> Maybe String -> IO ()
85- go (Just Version ) _ _ = putStrLn (V. showVersion version )
90+ go (Just Version ) _ _ = putStrLn (V. showVersion pandocPlotVersion )
8691 go (Just FullVersion ) _ _ = showFullVersion
8792 go (Just Manual ) _ _ = showManPage
8893 go _ (Just (Toolkits mfp)) _ = showAvailableToolkits mfp
@@ -117,10 +122,13 @@ commandParser = optional $ subparser $ mconcat
117122 )
118123 , command " clean" (
119124 info (cleanP <**> helper) (
120- progDesc " Clean output directories where figures from FILE and log files might be stored.\
121- \ WARNING: All files in those directories will be deleted."
122- )
125+ progDesc (unlines
126+ [ " Clean output directories where figures from FILE and log files might be stored."
127+ , " WARNING: All files in those directories will be deleted."
128+ ]
129+ )
123130 )
131+ )
124132 , command " write-example-config" (
125133 info (writeConfigP <**> helper) (progDesc " Write example configuration to a file and exit." )
126134 )
@@ -196,13 +204,13 @@ localConfig = do
196204
197205showFullVersion :: IO ()
198206showFullVersion = do
199- putStrLn $ " pandoc-plot " <> (V. showVersion version )
207+ putStrLn $ " pandoc-plot " <> (V. showVersion pandocPlotVersion )
200208 putStrLn $ " Git revision " <> gitrev
201- putStrLn $ mconcat [ " Compiled with pandoc "
202- , (unpack pandocVersion)
203- , " and pandoc-types "
204- , V. showVersion pandocTypesVersion
205- ]
209+ putStrLn $ mconcat
210+ [ " Compiled with pandoc " , (unpack pandocVersion)
211+ , " and pandoc-types " , V. showVersion pandocTypesVersion
212+ , " using GHC " , TOOL_VERSION_ghc -- Constant defined by CPP
213+ ]
206214 where
207215 -- In certain environments (e.g. Hackage when building documentation),
208216 -- there is no git information.
0 commit comments