Commit 66ca67b9 authored by Nicolas Lenz's avatar Nicolas Lenz

A whole bunch of stuff mkay

parent 4dd63c23
......@@ -7,8 +7,8 @@ import Config
import Control.Monad.Catch
import Path
import Path.IO
import System.Process
import Text.Pandoc
import Text.Pandoc.Shared
import qualified Data.Map as Map
-- | Predicate that checks whether a file is a markdown file using the file extension.
......@@ -73,7 +73,7 @@ data Summary = Summary {
-- | Processes a Markdown document into a complete HTML5 document and a summary for using a template.
processDocument :: (PandocMonad m) => Text -> Meta -> Text -> m (Text, Summary)
processDocument template extraMeta input = do
inputP <- headerShift 2 . addMeta extraMeta <$> readMarkdown readerOptions input
inputP <- addMeta extraMeta <$> readMarkdown readerOptions input
output <- writeHtml5String writerOptions inputP
return (output, Summary (titleString inputP) "0000-00-00" "This is a placeholder summary.")
where
......@@ -123,11 +123,20 @@ processArticles Config {..} basePath = do
getAbstract :: Pandoc -> Pandoc
getAbstract (Pandoc m bs) = Pandoc m (take 2 bs)
copyFolders :: Config -> IO ()
copyFolders Config{..} = do
folders <- mapM parseRelDir configFoldersToCopy
forM_ folders $ \folder -> copyDirRecur folder ([reldir|out|] </> folder)
compileStylesheet :: IO ()
compileStylesheet = callCommand $ "sassc style/stylesheet.scss out/style/stylesheet.css"
build :: IO ()
build = loadConfig >>= \case
Left ex -> fail $ "Error while reading config: " <> show ex
Right Config{..} -> do
Right config@Config{..} -> do
copyFolders config
compileStylesheet
templateArticle <- readFileUtf8 configTemplateArticle
-- templatePage <- readFileUtf8 configTemplatePage
-- templateIndex <- readFileUtf8 configTemplateIndex
......
......@@ -11,7 +11,7 @@ data Config = Config {
configTemplateArticle :: FilePath,
configTemplatePage :: FilePath,
configTemplateIndex :: FilePath,
configStylesheet :: FilePath,
configFoldersToCopy :: [FilePath],
configNavbar :: [Navitem]
} deriving (Show, Generic)
......
......@@ -4,7 +4,3 @@ module Style where
import ClassyPrelude
import Config
import System.Process
compileStylesheet :: Config -> IO ()
compileStylesheet Config {..} = callCommand $ "sassc " <> configStylesheet <> "out/stylesheet.css"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment