Commit 528c031b authored by Nicolas Lenz's avatar Nicolas Lenz

Add base url config option.

parent 0f894164
Pipeline #282 passed with stage
in 3 minutes and 10 seconds
......@@ -8,6 +8,7 @@ import Path
-- | A nebelhorn config.
data Config = Config {
configBaseUrl :: String,
configFolderOutput :: Path Rel Dir,
configFolderArticle :: Path Rel Dir,
configFolderPage :: Path Rel Dir,
......@@ -25,7 +26,8 @@ data NavItem = NavItem {
instance FromJSON Config where
parseJSON = withObject "Config" $ \v -> Config
<$> v .:? "folderOutput" .!= [reldir|out|]
<$> v .: "baseUrl" .!= "https://example.com"
<*> v .:? "folderOutput" .!= [reldir|out|]
<*> v .:? "folderArticle" .!= [reldir|article|]
<*> v .:? "folderPage" .!= [reldir|page|]
<*> v .:? "templateArticle" .!= [relfile|template/article.html|]
......
......@@ -5,8 +5,10 @@ import Path
import Config
import Text.Pandoc.Definition
-- TODO: Refactor used used types to be more consistent
-- | The Nebelhorn type.
data Nebelhorn = Nebelhorn {
nebelhornBaseUrl :: String,
nebelhornFolderOutput :: Path Rel Dir, -- ^ The folder path to put the output into.
nebelhornFoldersToCopy :: [Path Rel Dir], -- ^ The list of folders to just copy over.
nebelhornNavItems :: [NavItem], -- ^ The list of navitems for the navbars.
......
......@@ -17,7 +17,8 @@ import Util
-- | Reads in a Nebelhorn value using a config.
load :: (PandocMonad m, MonadIO m) => Config -> m Nebelhorn
load Config{..} = Nebelhorn
<$> return configFolderOutput
<$> return configBaseUrl
<*> return configFolderOutput
<*> return configFoldersToCopy
<*> return configNavbar
<*> uncurry linkIntoMeta <$$> prependPath configFolderArticle
......
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