summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--executable/Main.hs27
-rw-r--r--pandoc-plot.cabal2
3 files changed, 17 insertions, 17 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 28c5692..e2ae8d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,11 @@
pandoc-plot uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
+Release 0.4.0.1
+---------------
+
+* Fixed an issue where the `pandoc-plot` executable could not be built outside of its git repository.
+
Release 0.4.0.0
---------------
diff --git a/executable/Main.hs b/executable/Main.hs
index 340d137..33251d9 100644
--- a/executable/Main.hs
+++ b/executable/Main.hs
@@ -11,8 +11,7 @@ import Control.Monad (join, forM_)
import Data.Default.Class (def)
import Data.List (intersperse, (\\))
import Data.Monoid ((<>))
-import qualified Data.Text as T
-import qualified Data.Text.IO as T
+import Data.Text (unpack)
import GitHash as Git
@@ -86,7 +85,7 @@ main = join $ execParser opts
go (Just Manual) _ _ = showManPage
go (Just Toolkits) _ _ = showAvailableToolkits
go _ (Just (Clean fp)) _ = clean fp
- go _ (Just WriteConfig) _ = T.writeFile ".example-pandoc-plot.yml" exampleConfig
+ go _ (Just WriteConfig) _ = writeFile ".example-pandoc-plot.yml" $(embedExampleConfig)
go Nothing Nothing _ = toJSONFilterWithConfig
flagParser :: Parser (Maybe Flag)
@@ -147,23 +146,19 @@ config = do
else return def
-manualHtml :: T.Text
-manualHtml = T.pack $(embedManualHtml)
-
-
-exampleConfig :: T.Text
-exampleConfig = T.pack $(embedExampleConfig)
-
-
showFullVersion :: IO ()
showFullVersion = do
putStrLn $ "pandoc-plot " <> (V.showVersion version)
- putStrLn $ "Git revision " <> (Git.giHash $$tGitInfoCwd)
+ putStrLn $ "Git revision " <> gitrev
putStrLn $ mconcat [ "Compiled with pandoc "
- , (T.unpack pandocVersion)
+ , (unpack pandocVersion)
, " and pandoc-types "
, V.showVersion pandocTypesVersion
- ]
+ ]
+ where
+ -- In certain environments (e.g. Hackage when building documentation),
+ -- there is no git information.
+ gitrev = either (const "unknown") Git.giHash ($$tGitInfoCwdTry)
showAvailableToolkits :: IO ()
@@ -180,7 +175,7 @@ showAvailableToolkits = do
where
toolkitInfo tk = do
putStrLn $ "Toolkit: " <> show tk
- putStrLn $ " Code block trigger: " <> (T.unpack . cls $ tk)
+ putStrLn $ " Code block trigger: " <> (unpack . cls $ tk)
putStrLn $ " Supported save formats: " <> (mconcat . intersperse ", " . fmap show $ supportedSaveFormats tk)
putStrLn mempty
@@ -195,7 +190,7 @@ clean fp = do
showManPage :: IO ()
showManPage =
- writeSystemTempFile "pandoc-plot-manual.html" (T.unpack manualHtml)
+ writeSystemTempFile "pandoc-plot-manual.html" $(embedManualHtml)
>>= \fp -> openBrowser ("file:///" <> fp)
>> return ()
diff --git a/pandoc-plot.cabal b/pandoc-plot.cabal
index a86f591..97ba923 100644
--- a/pandoc-plot.cabal
+++ b/pandoc-plot.cabal
@@ -1,5 +1,5 @@
name: pandoc-plot
-version: 0.4.0.0
+version: 0.4.0.1
cabal-version: >= 1.12
synopsis: A Pandoc filter to include figures generated from code blocks using your plotting toolkit of choice.
description: A Pandoc filter to include figures generated from code blocks. Keep the document and code in the same location. Output is captured and included as a figure.