heckle 2.0.2.0 → 2.0.2.1
raw patch · 3 files changed
+12/−37 lines, 3 filesdep −filepathPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependencies removed: filepath
API changes (from Hackage documentation)
+ Heckle: splitExtension :: String -> Maybe (String, String)
Files
- heckle.cabal +1/−5
- lib/Heckle.hs +9/−3
- src/Main.hs +2/−29
heckle.cabal view
@@ -1,5 +1,5 @@ name: heckle-version: 2.0.2.0+version: 2.0.2.1 synopsis: Jekyll in Haskell (feat. LaTeX) description: A static site generator that supports LaTeX-PDF and Markdown-HTML posts. Care has been taken to make it configurable, easy to use, and unopinionated. @@ -21,7 +21,6 @@ hs-source-dirs: lib exposed-modules: Heckle build-depends: base >= 4.8 && <5- , filepath >= 1.4.0.0 , blaze-html >= 0.8.1.1 , directory >=1.2 && <1.4 , process >= 1.2.0.0@@ -39,10 +38,7 @@ build-depends: base >=4.8 && <5 , heckle , directory >=1.2 && <1.4- , filepath >= 1.4.0.0 , process >= 1.2.0.0 , split >=0.2 && <0.3- --, optparse-applicative >= 0.12.0.0 && <0.14.0.0- --, optparse-generic ==1.1.* other-extensions: OverloadedStrings default-language: Haskell2010
lib/Heckle.hs view
@@ -13,8 +13,9 @@ import Data.List.Split (splitOn) import Data.String (IsString) import Data.Monoid-import System.FilePath +--import System.FilePath+ import Text.Blaze.Html5 as H hiding (main, map) import Text.Blaze.Html5.Attributes as A import Text.Blaze.Html.Renderer.Pretty@@ -106,12 +107,17 @@ postDate <- getMeta docDate pd >>= parseAbsoluteDate return Post{..} +splitExtension :: String -> Maybe (String, String)+splitExtension s = case splitOn "." s of+ [a,b] -> Just (a, b)+ _ -> Nothing+ fileToPost :: String -> IO (Either String Post) fileToPost fileName = case splitExtension fileName of- (name, ".pdf") ->+ Just (name, "pdf") -> return . createPost LaTeX name . readLaTeX def =<< readFile ("posts/" <> name <> ".tex")- (name, ".md") ->+ Just (name, "md") -> return . createPost Markdown name . readMarkdown def =<< readFile ("posts/" <> fileName) _ -> pure (Left "Not a LaTeX or MD file")
src/Main.hs view
@@ -1,49 +1,22 @@-{-# LANGUAGE CPP #-} module Main where import Control.Exception import Data.Either import Data.List import Data.Maybe---import Options.Applicative import System.Directory-import System.FilePath+--import System.FilePath import System.Environment (getArgs) import System.Process (readProcess) import Paths_heckle (version) import Data.Version (showVersion)--- #if MIN_VERSION_optparse_applicative(0,13,0)--- versions before optparse-applicative-0.13 reexported (<>) themselves import Data.Monoid ((<>))--- #endif + import Heckle import Files --- data Command--- = Build--- | Init--- | Version---- withInfo :: InfoMod a -> Parser a -> ParserInfo a--- withInfo im p = info (helper <*> p) im---- infixr 1 ==>--- (==>) = withInfo . progDesc---- mainFlags :: ParserInfo Command--- mainFlags = withInfo (fullDesc <> progDesc "heckle: a simple, configurable static site generator") parser--- where--- parser :: Parser Command--- parser = subparser $ mconcat--- [ command "build" $ "Generate site"--- ==> pure Build--- , command "init" $ "Make new site template"--- ==> pure Init--- , command "version" $ "Get the package version"--- ==> pure Version--- ] buildSite :: IO () buildSite = do