diff --git a/src/HTML.hs b/src/HTML.hs index d4bdddc..a782749 100644 --- a/src/HTML.hs +++ b/src/HTML.hs @@ -91,4 +91,3 @@ pageWidget page = do where fontUrl = "https://fonts.googleapis.com/css?family=" <> (T.replace " " "-" name) elMeta k v = elAttr "meta" ("name" =: k <> "content" =: v) blank - diff --git a/src/Rib/Settings.hs b/src/Rib/Settings.hs index 5f2d25e..8565abe 100644 --- a/src/Rib/Settings.hs +++ b/src/Rib/Settings.hs @@ -18,9 +18,9 @@ data Settings = Settings , parsePage :: Text -> Pandoc -- ^ Parse a text document like Markdown into Pandoc structure , contentDir :: FilePath - -- ^ Directory of source content + -- ^ Directory name of the source content , destDir :: FilePath - -- ^ Directory to generate + -- ^ Name of the directory where output files will be generated , staticFilePatterns :: [FilePath] -- ^ Which files are considered to be static files. , postFilePatterns :: [FilePath] diff --git a/src/Rib/Shake.hs b/src/Rib/Shake.hs index 26ee998..88c4ffd 100644 --- a/src/Rib/Shake.hs +++ b/src/Rib/Shake.hs @@ -1,7 +1,9 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TupleSections #-} -module Rib.Shake where +module Rib.Shake + ( ribShake + ) where import Control.Monad.IO.Class (liftIO) import Data.Bool (bool) @@ -21,14 +23,6 @@ import qualified Rib.Settings as S import Rib.Types --- | convert 'build' filepaths into source file filepaths -destToSrc :: FilePath -> FilePath -destToSrc p = "site" dropDirectory1 p - --- | convert a source file path into a URL -srcToURL :: FilePath -> String -srcToURL = ("/" ++) . dropDirectory1 . dropExtension - ribShake :: Bool -- ^ Force generate of requested targes @@ -86,5 +80,9 @@ ribShake forceGen cfg = withArgs [] $ do let srcPath = destToSrc postPath -<.> "md" content <- T.decodeUtf8 . BS8.pack <$> readFile' srcPath let doc = S.parsePage cfg content - postURL = T.pack $ srcToURL postPath + postURL = T.pack $ ("/" ++) . dropDirectory1 . dropExtension $ postPath pure $ Post doc postURL + + -- | Convert 'build' filepaths into source file filepaths + destToSrc :: FilePath -> FilePath + destToSrc = (S.contentDir cfg ) . dropDirectory1