Commit 528c031b authored by Nicolas Lenz's avatar Nicolas Lenz ❄️
Browse files

Add base url config option.

parent 0f894164
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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|]
+2 −0
Original line number Diff line number Diff line
@@ -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.
+2 −1
Original line number Diff line number Diff line
@@ -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