sitepipe 0.1.1 → 0.2.0.0
raw patch · 5 files changed
+79/−37 lines, 5 filesdep ~Globdep ~MissingHdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Glob, MissingH, aeson, base, bytestring, containers, directory, exceptions, filepath, lens, lens-aeson, megaparsec, mtl, optparse-applicative, pandoc, parsec, shelly, text, unordered-containers, yaml
API changes (from Hackage documentation)
- SitePipe.Types: MParseErr :: (ParseError (Token String) Dec) -> SitePipeError
+ SitePipe.Types: MParseErr :: (ParseError (Token String) MPErr) -> SitePipeError
Files
- README.md +33/−12
- sitepipe.cabal +26/−22
- src/SitePipe/Parse.hs +10/−1
- src/SitePipe/Readers.hs +1/−1
- src/SitePipe/Types.hs +9/−1
README.md view
@@ -1,5 +1,13 @@-# SitePipe+# SitePipe +[](https://travis-ci.org/ChrisPenner/SitePipe)+[](https://hackage.haskell.org/package/sitepipe)+[](https://gitter.im/SitePipe/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +++Heads up! If you're reading this from the Hackage docs the links will be broken, go+read it on [Github](https://github.com/chrispenner/sitepipe).+ ### Contents: - [What is it?](#what-is-it)@@ -28,7 +36,18 @@ ## What's it look like? -Here's a dead-simple blog generated from markdown files, you can see it in action in+Start by setting up the structure of your website in a `site` folder:++```+site+├── templates+│ ├── post.html+│ └── index.html+└── posts+ └── article.md+```++Here's a dead-simple blog generator using markdown posts, you can see it in action in [examples/starter-template](./examples/starter-template), or build on it in the [tutorial](./docs/tutorial.md) ```haskell@@ -56,14 +75,16 @@ ## Wait, another static site generator? What about Hakyll/Jekyll? -Yup, yet another static site generator. The reason for it is that I tried using-Hakyll and Jekyll on different occasions and found there was too much magic-going on for me to understand how to customize things for my use-cases. They were-too opinionated without giving me escape hatches to wire in my own functionality.--When I tried Hakyll specifically I got really bogged down; what was a+Yup, yet another static site generator. I've tried using Hakyll and Jekyll on+different occasions and found there was too much magic going on with all of the+monadic contexts for me to understand how to customize things for my use-cases.+Even adding simple tags/categories to my blog seemed far more complex then it+needed to be; Hakyll specifically got me really bogged down; what was the `Compiler` monad? How does an `Item` work? How do I add a custom field? Why-couldn't I just edit data directly like I'm used to doing in Haskell?+couldn't I just edit data directly like I'm used to doing in Haskell? They+seemed a bit too opinionated without giving me escape hatches to wire in my own+functionality. If they're working for you, then great! But they weren't working+for me, so that's where SitePipe came from. # Getting Started @@ -102,8 +123,7 @@ ## Data/Metadata Metadata for posts and content is parsed from yaml into [Aeson's `Value`-type](https://hackage.haskell.org/package/aeson); Unlike Hakyll which depends-on Pandoc's metadata blocks which can only accept Strings as values, Aeson can+type](https://hackage.haskell.org/package/aeson); Aeson can easily represent nested objects or lists inside your metadata, and there's a rich ecosystem for working with Aeson types! You can load resources in as any object which implements `FromJSON` (or just leave them as Aeson Values) and you@@ -171,4 +191,5 @@ # Issues/Troubleshooting -Feel free to file an [issue](https://github.com/chrispenner/sitepipe/issues) if you run into any trouble!+Feel free to file an [issue](https://github.com/chrispenner/sitepipe/issues) if you run into any trouble,+or come ask in the [Chatroom](https://gitter.im/SitePipe/Lobby)
sitepipe.cabal view
@@ -1,5 +1,5 @@ name: sitepipe-version: 0.1.1+version: 0.2.0.0 synopsis: A simple to understand static site generator homepage: https://github.com/ChrisPenner/sitepipe#readme license: BSD3@@ -11,6 +11,7 @@ build-type: Simple extra-source-files: README.md cabal-version: >=1.10+Tested-With: GHC == 8.0.2, GHC == 8.2.1 library hs-source-dirs: src@@ -22,27 +23,30 @@ , SitePipe.Parse , SitePipe.Types , SitePipe.Utilities- build-depends: base >= 4.9 && < 5- , optparse-applicative- , unordered-containers- , directory- , filepath- , megaparsec- , mtl- , pandoc- , yaml- , mustache >= 2.2.3- , bytestring- , text- , parsec- , exceptions- , Glob- , lens-aeson- , lens- , aeson- , shelly- , MissingH- , containers+ build-depends: base >= 4.9 && < 4.11+ , optparse-applicative >= 0.13.2+ , unordered-containers >= 0.2.8.0 && < 0.3+ , directory >= 1.3.0.0 && < 1.4+ , filepath >= 1.4.1.1 && < 1.5+ , megaparsec >= 5.3.1 && < 6.3+ , mtl >= 2.2.1 && < 2.3+ , pandoc >= 1.19.2 && < 1.20+ , yaml >= 0.8.23.3 && < 0.9+ , mustache >= 2.2.3+ , bytestring >= 0.10.8.1 && < 0.11+ , text >= 1.2.2.2 && < 1.3+ , parsec >= 3.1.11 && < 3.2+ , exceptions >= 0.8.3 && < 0.9+ , Glob >= 0.8.0 && < 0.9+ , lens-aeson >= 1.0.2 && < 1.1+ , lens >= 4.15.4 && < 4.16+ , aeson >= 1.1.2.0 && < 1.3+ , shelly >= 1.6.8 && < 1.7+ , MissingH >= 1.4.0.1 && < 1.5+ , containers >= 0.5.7.1 && < 0.6++ if impl(ghc >= 8.2)+ build-depends: pandoc >= 1.19.2.4 default-language: Haskell2010
src/SitePipe/Parse.hs view
@@ -1,16 +1,25 @@+{-# language CPP #-}+ module SitePipe.Parse ( processSource ) where import Control.Monad.Catch hiding (try) import Text.Megaparsec-import Text.Megaparsec.String import Data.Aeson import qualified Data.HashMap.Lazy as HM import Data.Yaml hiding (Parser) import SitePipe.Types import Data.ByteString.Char8 (pack) import Data.Maybe++#if MIN_VERSION_megaparsec(6,0,0)+import Text.Megaparsec.Char+import Data.Void+type Parser = Parsec Void String+#else+import Text.Megaparsec.String+#endif -- | Parses yaml block from the file if it exists, returning the inner yaml block and the remaining file contents resourceP :: Parser (String, String)
src/SitePipe/Readers.hs view
@@ -31,7 +31,7 @@ -- | A simple helper which renders pandoc to HTML; good for use with 'mkPandocReaderWith' pandocToHTML :: Pandoc -> String-pandocToHTML = writeHtmlString def+pandocToHTML = writeHtmlString def{writerHighlight=True} -- | Runs the Pandoc reader handling errors. runPandocReader :: (MonadThrow m) => (String -> Either PandocError Pandoc) -> String -> m Pandoc
src/SitePipe/Types.hs view
@@ -1,4 +1,5 @@ {-# language OverloadedStrings #-}+{-# language CPP #-} module SitePipe.Types ( TemplatePath , GlobPattern@@ -16,6 +17,13 @@ import Control.Monad.Writer import qualified Text.Mustache.Types as MT +#if MIN_VERSION_megaparsec(6,0,0)+import Data.Void (Void)+type MPErr = Void+#else+type MPErr = MP.Dec+#endif+ -- | String alias; Path to a template type TemplatePath = String @@ -36,7 +44,7 @@ data SitePipeError = YamlErr String String | PParseErr P.ParseError- | MParseErr (MP.ParseError (MP.Token String) MP.Dec)+ | MParseErr (MP.ParseError (MP.Token String) MPErr) | PandocErr PandocError | JSONErr String String | TemplateParseErr P.ParseError