patat 0.8.8.0 → 0.8.9.0
raw patch · 8 files changed
+71/−67 lines, 8 filesdep ~aesondep ~optparse-applicativedep ~pandocPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, optparse-applicative, pandoc, pandoc-types, text, time
API changes (from Hackage documentation)
Files
- CHANGELOG.md +11/−0
- lib/Patat/Main.hs +23/−23
- lib/Patat/Presentation/Display.hs +11/−20
- lib/Patat/Presentation/Fragment.hs +1/−1
- lib/Patat/Presentation/Internal.hs +6/−4
- lib/Patat/PrettyPrint.hs +3/−3
- lib/Patat/Theme.hs +1/−1
- patat.cabal +15/−15
CHANGELOG.md view
@@ -1,5 +1,16 @@ # Changelog +- 0.8.9.0 (2023-06-27)+ * Apply block quote theming to entire block (#119) (#111)+ * Fix table header theming (#128)+ * Dependency updates:+ - `aeson` to 2.1+ - `optparse-applicative` to 0.18+ - `pandoc` to 3.1+ - `pandoc-types` to 1.23+ - `text` to 2.0+ - `time` to 1.12+ - 0.8.8.0 (2022-10-26) * Allow hiding slide number (contribution by Paweł Dybiec) * Support additional markdown extensions (contribution by Spreadcat)
lib/Patat/Main.hs view
@@ -8,30 +8,30 @@ ---------------------------------------------------------------------------------import Control.Concurrent (forkIO, killThread, threadDelay)-import Control.Concurrent.Chan (Chan)-import qualified Control.Concurrent.Chan as Chan-import Control.Exception (bracket)-import Control.Monad (forever, unless, when)-import qualified Data.Aeson.Extended as A-import Data.Functor (($>))-import qualified Data.Text as T-import Data.Time (UTCTime)-import Data.Version (showVersion)-import qualified Options.Applicative as OA+import Control.Concurrent (forkIO, killThread,+ threadDelay)+import Control.Concurrent.Chan (Chan)+import qualified Control.Concurrent.Chan as Chan+import Control.Exception (bracket)+import Control.Monad (forever, unless, when)+import qualified Data.Aeson.Extended as A+import Data.Functor (($>))+import Data.Time (UTCTime)+import Data.Version (showVersion)+import qualified Options.Applicative as OA+import qualified Options.Applicative.Help.Pretty as OA.PP import Patat.AutoAdvance-import qualified Patat.Images as Images+import qualified Patat.Images as Images import Patat.Presentation-import qualified Patat.PrettyPrint as PP+import qualified Patat.PrettyPrint as PP import qualified Paths_patat import Prelude-import qualified System.Console.ANSI as Ansi-import System.Directory (doesFileExist,- getModificationTime)-import System.Exit (exitFailure, exitSuccess)-import qualified System.IO as IO-import qualified Text.Pandoc as Pandoc-import qualified Text.PrettyPrint.ANSI.Leijen as PPL+import qualified System.Console.ANSI as Ansi+import System.Directory (doesFileExist,+ getModificationTime)+import System.Exit (exitFailure, exitSuccess)+import qualified System.IO as IO+import qualified Text.Pandoc as Pandoc --------------------------------------------------------------------------------@@ -77,7 +77,7 @@ OA.header ("patat v" <> showVersion Paths_patat.version) <> OA.progDescDoc (Just desc) where- desc = PPL.vcat+ desc = OA.PP.vcat [ "Terminal-based presentations using Pandoc" , "" , "Controls:"@@ -121,8 +121,8 @@ options <- OA.customExecParser parserPrefs parserInfo when (oVersion options) $ do- putStrLn (showVersion Paths_patat.version)- putStrLn $ "Using pandoc: " ++ T.unpack Pandoc.pandocVersion+ putStrLn $ showVersion Paths_patat.version+ putStrLn $ "Using pandoc: " ++ showVersion Pandoc.pandocVersion exitSuccess filePath <- case oFilePath options of
lib/Patat/Presentation/Display.hs view
@@ -1,5 +1,4 @@ ---------------------------------------------------------------------------------{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} module Patat.Presentation.Display@@ -133,17 +132,13 @@ PP.indent spaces spaces pblock where- -- Check if the fragment consists of just a single image, or a header and- -- some image.- onlyImage (Fragment blocks)- | [Pandoc.Para para] <- filter isVisibleBlock blocks- , [Pandoc.Image _ _ (target, _)] <- para =- Just target- onlyImage (Fragment blocks)- | [Pandoc.Header _ _ _, Pandoc.Para para] <- filter isVisibleBlock blocks- , [Pandoc.Image _ _ (target, _)] <- para =- Just target- onlyImage _ = Nothing+ -- Check if the fragment consists of "just a single image". Discard+ -- headers.+ onlyImage (Fragment (Pandoc.Header{} : bs)) = onlyImage (Fragment bs)+ onlyImage (Fragment bs) = case filter isVisibleBlock bs of+ [Pandoc.Figure _ _ bs'] -> onlyImage (Fragment bs')+ [Pandoc.Para [Pandoc.Image _ _ (target, _)]] -> Just target+ _ -> Nothing --------------------------------------------------------------------------------@@ -170,7 +165,7 @@ j <- [0 .. numFragments slide - 1] case displayPresentation size pres {pActiveFragment = (i, j)} of DisplayDoc doc -> [doc]- DisplayImage _ -> []+ DisplayImage filepath -> [PP.string $ "image:" ++ filepath] --------------------------------------------------------------------------------@@ -248,7 +243,7 @@ prettyBlock theme@Theme {..} (Pandoc.BlockQuote bs) = let quote = PP.NotTrimmable (themed themeBlockQuote "> ") in- PP.indent quote quote (prettyBlocks theme bs)+ PP.indent quote quote (themed themeBlockQuote $ prettyBlocks theme bs) prettyBlock theme@Theme {..} (Pandoc.DefinitionList terms) = PP.vcat $ map prettyDefinition terms@@ -282,18 +277,15 @@ 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 +prettyBlock theme (Pandoc.Figure _attr _caption blocks) =+ prettyBlocks theme blocks -------------------------------------------------------------------------------- prettyBlocks :: Theme -> [Pandoc.Block] -> PP.Doc@@ -394,7 +386,6 @@ -------------------------------------------------------------------------------- isVisibleBlock :: Pandoc.Block -> Bool-isVisibleBlock Pandoc.Null = False isVisibleBlock (Pandoc.RawBlock (Pandoc.Format "html") t) = not ("<!--" `T.isPrefixOf` t && "-->" `T.isSuffixOf` t) isVisibleBlock _ = True
lib/Patat/Presentation/Fragment.hs view
@@ -66,8 +66,8 @@ fragmentBlock _ block@(Pandoc.Table {}) = [Append [block]] fragmentBlock _ block@(Pandoc.Div {}) = [Append [block]] fragmentBlock _ block@Pandoc.HorizontalRule = [Append [block]]-fragmentBlock _ block@Pandoc.Null = [Append [block]] fragmentBlock _ block@(Pandoc.LineBlock {}) = [Append [block]]+fragmentBlock _ block@(Pandoc.Figure {}) = [Append [block]] fragmentList :: FragmentSettings -- ^ Global settings
lib/Patat/Presentation/Internal.hs view
@@ -188,10 +188,12 @@ Nothing -> fail $ "Unknown extension: " ++ show txt ++ ", known extensions are: " ++- intercalate ", "- [ show (drop 4 (show e))- | e <- [minBound .. maxBound] :: [Pandoc.Extension]- ]+ intercalate ", " (map (drop 4 . show) allExts)+ where+ -- This is an approximation since we can't enumerate extensions+ -- anymore in the latest pandoc...+ allExts = Pandoc.extensionsToList $+ Pandoc.getAllExtensions "markdown" --------------------------------------------------------------------------------
lib/Patat/PrettyPrint.hs view
@@ -144,9 +144,9 @@ -------------------------------------------------------------------------------- chunkToDocE :: Chunk -> DocE Doc-chunkToDocE NewlineChunk = Hardline-chunkToDocE (StringChunk codes str) = Ansi (\_ -> codes) (Doc [String str])-chunkToDocE (ControlChunk ctrl) = Control ctrl+chunkToDocE NewlineChunk = Hardline+chunkToDocE (StringChunk c1 str) = Ansi (\c0 -> c1 ++ c0) (Doc [String str])+chunkToDocE (ControlChunk ctrl) = Control ctrl --------------------------------------------------------------------------------
lib/Patat/Theme.hs view
@@ -113,7 +113,7 @@ , themeBlockQuote = dull Ansi.Green , themeDefinitionTerm = dull Ansi.Blue , themeDefinitionList = dull Ansi.Magenta- , themeTableHeader = dull Ansi.Blue+ , themeTableHeader = dull Ansi.Magenta `mappend` bold , themeTableSeparator = dull Ansi.Magenta , themeLineBlock = dull Ansi.Magenta , themeEmph = dull Ansi.Green
patat.cabal view
@@ -1,5 +1,5 @@ Name: patat-Version: 0.8.8.0+Version: 0.8.9.0 Synopsis: Terminal-based presentations using Pandoc Description: Terminal-based presentations using Pandoc. License: GPL-2@@ -31,7 +31,7 @@ Default-language: Haskell2010 Build-depends:- aeson >= 2.0 && < 2.1,+ aeson >= 2.0 && < 2.2, ansi-terminal >= 0.6 && < 0.12, ansi-wl-pprint >= 0.6 && < 0.7, async >= 2.2 && < 2.3,@@ -43,14 +43,14 @@ directory >= 1.2 && < 1.4, filepath >= 1.4 && < 1.5, mtl >= 2.2 && < 2.3,- optparse-applicative >= 0.16 && < 0.17,- pandoc >= 2.11 && < 2.20,- pandoc-types >= 1.22 && < 1.23,+ optparse-applicative >= 0.16 && < 0.19,+ pandoc >= 3.1 && < 3.2,+ pandoc-types >= 1.23 && < 1.24, process >= 1.6 && < 1.7, skylighting >= 0.10 && < 0.14, terminal-size >= 0.3 && < 0.4,- text >= 1.2 && < 1.3,- time >= 1.4 && < 1.10,+ text >= 1.2 && < 2.1,+ time >= 1.4 && < 1.13, unordered-containers >= 0.2 && < 0.3, yaml >= 0.8 && < 0.12, wcwidth >= 0.0 && < 0.1,@@ -112,13 +112,13 @@ Buildable: False Build-depends:- base >= 4.9 && < 5,- containers >= 0.6 && < 0.7,- doctemplates >= 0.8 && < 0.12,- mtl >= 2.2 && < 2.3,- pandoc >= 2.11 && < 2.20,- text >= 1.2 && < 1.3,- time >= 1.6 && < 1.10+ base >= 4.9 && < 5,+ containers >= 0.6 && < 0.7,+ doctemplates >= 0.8 && < 0.12,+ mtl >= 2.2 && < 2.3,+ pandoc >= 3.1 && < 3.2,+ text >= 1.2 && < 2.1,+ time >= 1.6 && < 1.13 Test-suite patat-tests Main-is: Main.hs@@ -138,5 +138,5 @@ tasty >= 1.2 && < 1.5, tasty-hunit >= 0.10 && < 0.11, tasty-quickcheck >= 0.10 && < 0.11,- text >= 1.2 && < 1.3,+ text >= 1.2 && < 2.1, QuickCheck >= 2.8 && < 2.15