mirror of
https://github.com/srid/rib.git
synced 2024-11-26 13:50:31 +03:00
cleanup
This commit is contained in:
parent
36a94cb3c8
commit
01abafb3f6
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user