packages feed

patat 0.3.2.0 → 0.3.3.0

raw patch · 5 files changed

+48/−10 lines, 5 filesdep ~aesondep ~pandoc

Dependency ranges changed: aeson, pandoc

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog +- 0.3.3.0 (2016-10-31)+    * Add a `--version` flag.+    * Add support for `pandoc-1.18` which includes a new `LineBlock` element.+ - 0.3.2.0 (2016-10-20)     * Keep running even if errors are encountered during reload. 
patat.cabal view
@@ -1,5 +1,5 @@ Name:                patat-Version:             0.3.2.0+Version:             0.3.3.0 Synopsis:            Terminal-based presentations using Pandoc Description:         Terminal-based presentations using Pandoc License:             GPL-2@@ -24,7 +24,7 @@   Default-language:  Haskell2010    Build-depends:-    aeson                >= 0.11 && < 1.1,+    aeson                >= 0.9  && < 1.1,     ansi-terminal        >= 0.6  && < 0.7,     ansi-wl-pprint       >= 0.6  && < 0.7,     base                 >= 4.6  && < 4.10,@@ -35,7 +35,7 @@     highlighting-kate    >= 0.6  && < 0.7,     mtl                  >= 2.2  && < 2.3,     optparse-applicative >= 0.12 && < 0.14,-    pandoc               >= 1.17 && < 1.18,+    pandoc               >= 1.16 && < 1.19,     terminal-size        >= 0.3  && < 0.4,     text                 >= 1.2  && < 1.3,     time                 >= 1.4  && < 1.7,
src/Main.hs view
@@ -10,7 +10,7 @@ import           Control.Concurrent           (forkIO, threadDelay) import qualified Control.Concurrent.Chan      as Chan import           Control.Monad                (forever, unless, when)-import           Data.Monoid                  ((<>))+import           Data.Monoid                  (mempty, (<>)) import           Data.Time                    (UTCTime) import           Data.Version                 (showVersion) import qualified Options.Applicative          as OA@@ -19,7 +19,7 @@ import qualified System.Console.ANSI          as Ansi import           System.Directory             (doesFileExist,                                                getModificationTime)-import           System.Exit                  (exitFailure)+import           System.Exit                  (exitFailure, exitSuccess) import qualified System.IO                    as IO import qualified Text.PrettyPrint.ANSI.Leijen as PP import           Prelude@@ -27,17 +27,18 @@  -------------------------------------------------------------------------------- data Options = Options-    { oFilePath :: !FilePath+    { oFilePath :: !(Maybe FilePath)     , oForce    :: !Bool     , oDump     :: !Bool     , oWatch    :: !Bool+    , oVersion  :: !Bool     } deriving (Show)   -------------------------------------------------------------------------------- parseOptions :: OA.Parser Options parseOptions = Options-    <$> (OA.strArgument $+    <$> (OA.optional $ OA.strArgument $             OA.metavar "FILENAME" <>             OA.help    "Input file")     <*> (OA.switch $@@ -54,6 +55,10 @@             OA.long    "watch" <>             OA.short   'w' <>             OA.help    "Watch file for changes")+    <*> (OA.switch $+            OA.long    "version" <>+            OA.help    "Display version info and exit" <>+            OA.hidden)   --------------------------------------------------------------------------------@@ -79,6 +84,11 @@   --------------------------------------------------------------------------------+parserPrefs :: OA.ParserPrefs+parserPrefs = OA.prefs OA.showHelpOnError+++-------------------------------------------------------------------------------- errorAndExit :: [String] -> IO a errorAndExit msg = do     mapM_ (IO.hPutStrLn IO.stderr) msg@@ -98,8 +108,18 @@ -------------------------------------------------------------------------------- main :: IO () main = do-    options   <- OA.customExecParser (OA.prefs OA.showHelpOnError) parserInfo-    errOrPres <- readPresentation (oFilePath options)+    options <- OA.customExecParser parserPrefs parserInfo++    when (oVersion options) $ do+        putStrLn (showVersion Paths_patat.version)+        exitSuccess++    filePath <- case oFilePath options of+        Just fp -> return fp+        Nothing -> OA.handleParseResult $ OA.Failure $+            OA.parserFailure parserPrefs parserInfo OA.ShowHelpText mempty++    errOrPres <- readPresentation filePath     pres      <- either (errorAndExit . return) return errOrPres      unless (oForce options) assertAnsiFeatures
src/Patat/Presentation/Display.hs view
@@ -1,4 +1,5 @@ --------------------------------------------------------------------------------+{-# LANGUAGE CPP                        #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings          #-} {-# LANGUAGE RecordWildCards            #-}@@ -205,6 +206,16 @@ prettyBlock theme (Pandoc.Div _attrs blocks) = prettyBlocks theme blocks  prettyBlock _theme Pandoc.Null = mempty++#if MIN_VERSION_pandoc(1,18,0)+-- 'LineBlock' elements are new in pandoc-1.18+prettyBlock theme@Theme {..} (Pandoc.LineBlock inliness) =+    let ind = PP.NotTrimmable (themed themeLineBlock "| ") in+    PP.wrapAt Nothing $+    PP.indent ind ind $+    PP.vcat $+    map (prettyInlines theme) inliness+#endif   --------------------------------------------------------------------------------
src/Patat/Theme.hs view
@@ -43,6 +43,7 @@     , themeDefinitionList     :: !(Maybe Style)     , themeTableHeader        :: !(Maybe Style)     , themeTableSeparator     :: !(Maybe Style)+    , themeLineBlock          :: !(Maybe Style)     , themeEmph               :: !(Maybe Style)     , themeStrong             :: !(Maybe Style)     , themeCode               :: !(Maybe Style)@@ -62,7 +63,7 @@     mempty = Theme         Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing         Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing-        Nothing Nothing Nothing Nothing+        Nothing Nothing Nothing Nothing Nothing      mappend l r = Theme         { themeBorders            = mplusOn   themeBorders@@ -76,6 +77,7 @@         , themeDefinitionList     = mplusOn   themeDefinitionList         , themeTableHeader        = mplusOn   themeTableHeader         , themeTableSeparator     = mplusOn   themeTableSeparator+        , themeLineBlock          = mplusOn   themeLineBlock         , themeEmph               = mplusOn   themeEmph         , themeStrong             = mplusOn   themeStrong         , themeCode               = mplusOn   themeCode@@ -107,6 +109,7 @@     , themeDefinitionList     = dull Ansi.Magenta     , themeTableHeader        = dull Ansi.Blue     , themeTableSeparator     = dull Ansi.Magenta+    , themeLineBlock          = dull Ansi.Magenta     , themeEmph               = dull Ansi.Green     , themeStrong             = dull Ansi.Red <> bold     , themeCode               = dull Ansi.White <> ondull Ansi.Black