1
1
mirror of https://github.com/srid/rib.git synced 2024-11-26 13:50:31 +03:00
This commit is contained in:
Sridhar Ratnakumar 2019-07-11 18:19:02 -04:00
parent 36a94cb3c8
commit 01abafb3f6
4 changed files with 8 additions and 13 deletions

View File

@ -1,8 +1,8 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
@ -22,9 +22,9 @@ import Lucid
import qualified Rib
import qualified Rib.App as App
import Rib.Pandoc
import qualified Rib.Settings as S
import Rib.Types
import Rib.Pandoc
data PostCategory
= Programming
@ -47,7 +47,7 @@ googleFonts :: [Text]
googleFonts = [headerFont, contentFont, codeFont]
headerFont :: Text
headerFont = "Saira Extra Condensed"
headerFont = "IBM Plex Sans Condensed"
contentFont :: Text
contentFont = "Muli"

View File

@ -7,8 +7,8 @@ module Rib where
import Data.Default (Default (def))
import qualified Data.Text as T
import Text.Pandoc
import Lucid
import Text.Pandoc
import Rib.Settings
import Rib.Shake

View File

@ -4,8 +4,8 @@
module Rib.Settings where
import Data.Text (Text)
import Control.Monad.Reader
import Data.Text (Text)
import Development.Shake
import Lucid (Html)

View File

@ -7,7 +7,7 @@ module Rib.Shake
, simpleBuildRules
) where
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Reader
import Data.Bool (bool)
import qualified Data.ByteString.Char8 as BS8
@ -96,19 +96,14 @@ simpleBuildRules staticFilePatterns postFilePatterns = do
posts <- forM files $ \f -> do
doc <- parsePandocCached $ PostFilePath (contentDir </> f)
pure $ Post doc $ getHTMLFileUrl f
writeLucidHtml out $ pageWidget $ Page_Index posts
liftIO $ renderToFile out $ pageWidget $ Page_Index posts
-- Rule for building individual posts
(destDir </> "*.html") %> \out -> do
let f = dropDirectory1 $ destToSrc out -<.> "md"
doc <- parsePandocCached $ PostFilePath (contentDir </> f)
let post = Post doc $ getHTMLFileUrl f
writeLucidHtml out $ pageWidget $ Page_Post post
-- | TODO: Put this in Shake monad?
writeLucidHtml :: MonadIO m => FilePath -> Html () -> m ()
writeLucidHtml out = liftIO . renderToFile out
liftIO $ renderToFile out $ pageWidget $ Page_Post post
-- Require the given post file and parse it as Pandoc document.
parsePandoc