mirror of
https://github.com/srid/rib.git
synced 2024-11-26 13:50:31 +03:00
Fix hardcoding of content directory
This commit is contained in:
parent
814bbdb26f
commit
b7bd808524
@ -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
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user