patat 0.8.7.0 → 0.8.8.0
raw patch · 9 files changed
+83/−31 lines, 9 filesdep ~QuickCheckdep ~aesondep ~ansi-terminalPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: QuickCheck, aeson, ansi-terminal, base64-bytestring, bytestring, doctemplates, optparse-applicative, pandoc, skylighting, tasty
API changes (from Hackage documentation)
+ Patat.Presentation: [psSlideNumber] :: PresentationSettings -> !Maybe Bool
+ Patat.Presentation.Internal: [psSlideNumber] :: PresentationSettings -> !Maybe Bool
- Patat.Presentation: PresentationSettings :: !Maybe (FlexibleNum Int) -> !Maybe (FlexibleNum Int) -> !Maybe Margins -> !Maybe Bool -> !Maybe Theme -> !Maybe Bool -> !Maybe (FlexibleNum Int) -> !Maybe Int -> !Maybe ExtensionList -> !Maybe ImageSettings -> !Maybe Bool -> !Maybe EvalSettingsMap -> PresentationSettings
+ Patat.Presentation: PresentationSettings :: !Maybe (FlexibleNum Int) -> !Maybe (FlexibleNum Int) -> !Maybe Margins -> !Maybe Bool -> !Maybe Theme -> !Maybe Bool -> !Maybe (FlexibleNum Int) -> !Maybe Int -> !Maybe ExtensionList -> !Maybe ImageSettings -> !Maybe Bool -> !Maybe EvalSettingsMap -> !Maybe Bool -> PresentationSettings
- Patat.Presentation.Internal: PresentationSettings :: !Maybe (FlexibleNum Int) -> !Maybe (FlexibleNum Int) -> !Maybe Margins -> !Maybe Bool -> !Maybe Theme -> !Maybe Bool -> !Maybe (FlexibleNum Int) -> !Maybe Int -> !Maybe ExtensionList -> !Maybe ImageSettings -> !Maybe Bool -> !Maybe EvalSettingsMap -> PresentationSettings
+ Patat.Presentation.Internal: PresentationSettings :: !Maybe (FlexibleNum Int) -> !Maybe (FlexibleNum Int) -> !Maybe Margins -> !Maybe Bool -> !Maybe Theme -> !Maybe Bool -> !Maybe (FlexibleNum Int) -> !Maybe Int -> !Maybe ExtensionList -> !Maybe ImageSettings -> !Maybe Bool -> !Maybe EvalSettingsMap -> !Maybe Bool -> PresentationSettings
Files
- CHANGELOG.md +12/−0
- README.md +30/−3
- extra/make-man.hs +1/−1
- lib/Patat/Images/W3m.hs +9/−9
- lib/Patat/Main.hs +2/−1
- lib/Patat/Presentation/Display.hs +3/−1
- lib/Patat/Presentation/Internal.hs +5/−2
- lib/Patat/Presentation/Read.hs +9/−2
- patat.cabal +12/−12
CHANGELOG.md view
@@ -1,5 +1,17 @@ # Changelog +- 0.8.8.0 (2022-10-26)+ * Allow hiding slide number (contribution by Paweł Dybiec)+ * Support additional markdown extensions (contribution by Spreadcat)+ * Dependency updates:+ - `aeson` to 2.0+ - `ansi-terminal` to 0.11+ - `base64-bytestring` to 1.2+ - `bytestring` to 0.11+ - `optparse-applicative` to 1.16+ - `pandoc` to 2.19+ - `skylighting` to 0.13+ - 0.8.7.0 (2021-03-12) * Fix alignment and display of CJK characters in presentation title, author and tables
README.md view
@@ -36,6 +36,7 @@ - [Table of Contents](#table-of-contents) - [Installation](#installation) - [Pre-built-packages](#pre-built-packages)+ - [Homebrew](#homebrew) - [From source](#from-source) - [Running](#running) - [Options](#options)@@ -68,6 +69,21 @@ You can also find generic Linux and Mac OS binaries here: <https://github.com/jaspervdj/patat/releases>. +### Homebrew++Homebrew packages are offered by a third-party repository:++1. Install [Homebrew] for your platform.+2. Run `brew tap nicholasdille/tap`.+3. Run `brew install patat-bin` to receive the official binaries or+ `brew install patat` for pre-built ("bottled") binaries.++[Homebrew]: https://brew.sh/++For issues and feedback please refer to [nicholasdille/homebrew-tap].++[nicholasdille/homebrew-tap]: https://github.com/nicholasdille/homebrew-tap+ ### From source Installation from source is very easy. You can build from source using `stack@@ -557,10 +573,10 @@  ``` -If `images` is enabled (not by default), `patat` will draw slides that consist-only of a single image just by drawing the image, centered and resized to fit-the terminal window.+`patat` can display full-size images on slides. For this to work `images` must be enabled in the configuration and the slide needs to contain only a single image and no other content. The image will be centered and resized to fit the terminal window. +`images` is off by default in the configuration.+ `patat` supports the following image drawing backends: - `backend: iterm2`: uses [iTerm2](https://iterm2.com/)'s special escape@@ -592,6 +608,17 @@ ```yaml patat: breadcrumbs: false+```++### Slide numbers++By default, `patat` will display slide number in bottom-right corner++This feature can be turned off by using:++```yaml+patat:+ slideNumber: false ``` ### Evaluating code
extra/make-man.hs view
@@ -49,7 +49,7 @@ let doc = Pandoc.Pandoc Pandoc.nullMeta [Pandoc.Plain inlines] txt = case Pandoc.runPure (Pandoc.writeMarkdown Pandoc.def doc) of Left err -> throw err -- Bad!- Right x -> x+ Right x -> T.strip x return (l, txt) toSectionHeader _ = Nothing
lib/Patat/Images/W3m.hs view
@@ -19,17 +19,21 @@ ---------------------------------------------------------------------------------backend :: Internal.Backend-backend = Internal.Backend new----------------------------------------------------------------------------------- data Config = Config { cPath :: Maybe FilePath } deriving (Show) --------------------------------------------------------------------------------+$(A.deriveFromJSON A.dropPrefixOptions ''Config)+++--------------------------------------------------------------------------------+backend :: Internal.Backend+backend = Internal.Backend new+++-------------------------------------------------------------------------------- new :: Internal.Config Config -> IO Internal.Handle new config = do w3m <- findW3m $ case config of@@ -153,7 +157,3 @@ y = (th - ih2) `div` 2 in (x, y, iw2, ih2)------------------------------------------------------------------------------------$(A.deriveFromJSON A.dropPrefixOptions ''Config)
lib/Patat/Main.hs view
@@ -128,7 +128,8 @@ filePath <- case oFilePath options of Just fp -> return fp Nothing -> OA.handleParseResult $ OA.Failure $- OA.parserFailure parserPrefs parserInfo OA.ShowHelpText mempty+ OA.parserFailure parserPrefs parserInfo+ (OA.ShowHelpText Nothing) mempty errOrPres <- readPresentation filePath pres <- either (errorAndExit . return) return errOrPres
lib/Patat/Presentation/Display.hs view
@@ -100,7 +100,9 @@ canvasSize = Size (rows - 2) columns -- Compute footer.- active = show (sidx + 1) ++ " / " ++ show (length pSlides)+ active+ | fromMaybe True $ psSlideNumber settings = show (sidx + 1) ++ " / " ++ show (length pSlides)+ | otherwise = "" activeWidth = wcstrwidth active author = PP.toString (prettyInlines theme pAuthor) authorWidth = wcstrwidth author
lib/Patat/Presentation/Internal.hs view
@@ -79,6 +79,7 @@ , psImages :: !(Maybe ImageSettings) , psBreadcrumbs :: !(Maybe Bool) , psEval :: !(Maybe EvalSettingsMap)+ , psSlideNumber :: !(Maybe Bool) } deriving (Show) @@ -97,6 +98,7 @@ , psImages = psImages l `mplus` psImages r , psBreadcrumbs = psBreadcrumbs l `mplus` psBreadcrumbs r , psEval = psEval l <> psEval r+ , psSlideNumber = psSlideNumber l `mplus` psSlideNumber r } @@ -105,7 +107,7 @@ mappend = (<>) mempty = PresentationSettings Nothing Nothing Nothing Nothing Nothing Nothing Nothing- Nothing Nothing Nothing Nothing Nothing+ Nothing Nothing Nothing Nothing Nothing Nothing --------------------------------------------------------------------------------@@ -123,6 +125,7 @@ , psImages = Nothing , psBreadcrumbs = Nothing , psEval = Nothing+ , psSlideNumber = Nothing } @@ -295,5 +298,5 @@ ---------------------------------------------------------------------------------$(A.deriveFromJSON A.dropPrefixOptions ''PresentationSettings) $(A.deriveFromJSON A.dropPrefixOptions ''Margins)+$(A.deriveFromJSON A.dropPrefixOptions ''PresentationSettings)
lib/Patat/Presentation/Read.hs view
@@ -16,8 +16,8 @@ throwError) import Control.Monad.Trans (liftIO) import qualified Data.Aeson as A+import qualified Data.Aeson.KeyMap as AKM import Data.Bifunctor (first)-import qualified Data.HashMap.Strict as HMS import Data.Maybe (fromMaybe) import qualified Data.Text as T import qualified Data.Text.Encoding as T@@ -64,7 +64,14 @@ :: ExtensionList -> String -> Maybe (T.Text -> Either Pandoc.PandocError Pandoc.Pandoc) readExtension (ExtensionList extensions) fileExt = case fileExt of+ ".markdown" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts ".md" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts+ ".mdown" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts+ ".mdtext" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts+ ".mdtxt" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts+ ".mdwn" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts+ ".mkd" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts+ ".mkdn" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts ".lhs" -> Just $ Pandoc.runPure . Pandoc.readMarkdown lhsOpts "" -> Just $ Pandoc.runPure . Pandoc.readMarkdown readerOpts ".org" -> Just $ Pandoc.runPure . Pandoc.readOrg readerOpts@@ -121,7 +128,7 @@ readMetaSettings src = case parseMetadataBlock src of Nothing -> Right mempty Just (Left err) -> Left err- Just (Right (A.Object obj)) | Just val <- HMS.lookup "patat" obj ->+ Just (Right (A.Object obj)) | Just val <- AKM.lookup "patat" obj -> resultToEither $! A.fromJSON val Just (Right _) -> Right mempty where
patat.cabal view
@@ -1,5 +1,5 @@ Name: patat-Version: 0.8.7.0+Version: 0.8.8.0 Synopsis: Terminal-based presentations using Pandoc Description: Terminal-based presentations using Pandoc. License: GPL-2@@ -31,23 +31,23 @@ Default-language: Haskell2010 Build-depends:- aeson >= 0.9 && < 1.5,- ansi-terminal >= 0.6 && < 0.11,+ aeson >= 2.0 && < 2.1,+ ansi-terminal >= 0.6 && < 0.12, ansi-wl-pprint >= 0.6 && < 0.7, async >= 2.2 && < 2.3, base >= 4.9 && < 5,- base64-bytestring >= 1.0 && < 1.1,- bytestring >= 0.10 && < 0.11,+ base64-bytestring >= 1.0 && < 1.3,+ bytestring >= 0.10 && < 0.12, colour >= 2.3 && < 2.4, containers >= 0.5 && < 0.7, directory >= 1.2 && < 1.4, filepath >= 1.4 && < 1.5, mtl >= 2.2 && < 2.3,- optparse-applicative >= 0.12 && < 0.16,- pandoc >= 2.11 && < 2.12,+ optparse-applicative >= 0.16 && < 0.17,+ pandoc >= 2.11 && < 2.20, pandoc-types >= 1.22 && < 1.23, process >= 1.6 && < 1.7,- skylighting >= 0.10 && < 0.11,+ skylighting >= 0.10 && < 0.14, terminal-size >= 0.3 && < 0.4, text >= 1.2 && < 1.3, time >= 1.4 && < 1.10,@@ -114,9 +114,9 @@ Build-depends: base >= 4.9 && < 5, containers >= 0.6 && < 0.7,- doctemplates >= 0.8 && < 0.9,+ doctemplates >= 0.8 && < 0.12, mtl >= 2.2 && < 2.3,- pandoc >= 2.11 && < 2.12,+ pandoc >= 2.11 && < 2.20, text >= 1.2 && < 1.3, time >= 1.6 && < 1.10 @@ -135,8 +135,8 @@ patat, base >= 4.8 && < 5, directory >= 1.2 && < 1.4,- tasty >= 1.2 && < 1.3,+ tasty >= 1.2 && < 1.5, tasty-hunit >= 0.10 && < 0.11, tasty-quickcheck >= 0.10 && < 0.11, text >= 1.2 && < 1.3,- QuickCheck >= 2.8 && < 2.14+ QuickCheck >= 2.8 && < 2.15