packages feed

pandoc-plot 0.4.0.0 → 0.4.0.1

raw patch · 3 files changed

+17/−17 lines, 3 files

Files

CHANGELOG.md view
@@ -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
 ---------------
 
executable/Main.hs view
@@ -11,8 +11,7 @@ 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 @@         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 @@         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 @@     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 @@ 
 showManPage :: IO ()
 showManPage = 
-    writeSystemTempFile "pandoc-plot-manual.html" (T.unpack manualHtml)
+    writeSystemTempFile "pandoc-plot-manual.html" $(embedManualHtml)
         >>= \fp -> openBrowser ("file:///" <> fp)
         >> return ()
 
pandoc-plot.cabal view
@@ -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.