diff --git a/Types.hs b/Types.hs index e818c63..a6a8b2b 100644 --- a/Types.hs +++ b/Types.hs @@ -44,6 +44,8 @@ data SiteState = , _templates :: M.Map FilePath Mu.Template , _outputDir :: FilePath -- ^ Directory for output , _assetDir :: FilePath -- ^ Directory for output + , _sourceDir :: FilePath -- ^ Path to page source data + , _templateDir :: FilePath -- ^ Path to template directory , _defaultTemplate :: FilePath -- ^ Name of the default template , _redirectTemplate :: FilePath -- ^ Name of the template for redirect pages , _tagTemplate :: FilePath -- ^ Name of the template for tag listing pages @@ -71,7 +73,17 @@ siteOptions' = do short 'a' <> help "Assets directory to be copied verbatim" <> value "assets" <> showDefault - --TODO templates directory! + _sourceDir <- + strOption $ + long "source-directory" <> + short 's' <> + help "Path to the directory with source data (possibly multiple paths)" <> + value "cards" <> showDefault + _templateDir <- + strOption $ + long "template-directory" <> + help "Path to the directory with templates" <> + value "templates" <> showDefault _defaultTemplate <- strOption $ long "default-template" <> diff --git a/external/mypage/img/awesome.png b/cards/mypage/img/awesome.png similarity index 100% rename from external/mypage/img/awesome.png rename to cards/mypage/img/awesome.png diff --git a/external/mypage/text.md b/cards/mypage/text.md similarity index 100% rename from external/mypage/text.md rename to cards/mypage/text.md diff --git a/site.hs b/site.hs index b6f6840..1369457 100644 --- a/site.hs +++ b/site.hs @@ -23,6 +23,7 @@ import Hakyll.Core.Util.File (getRecursiveContents, makeDirectories) import Lens.Micro import Lens.Micro.Aeson import Lens.Micro.Mtl +import qualified Options.Applicative import System.FilePath ( () , isAbsolute @@ -36,7 +37,6 @@ import Text.Pandoc.Class (runIOorExplode) import Text.Pandoc.Readers.Markdown (readMarkdown) import Text.Pandoc.Writers.HTML (writeHtml5String) import qualified Text.Parsec.Error -import qualified Options.Applicative import FormatOpts import Types @@ -321,9 +321,9 @@ main = do init <- Options.Applicative.execParser siteOptions flip runStateT init $ do installAssets - traverse sourcePages ["external"] + use sourceDir >>= sourcePages sourceTags - sourceTemplates "templates" + use templateDir >>= sourceTemplates use pages >>= traverse (uncurry installPage) . M.assocs renderTags io $ putStrLn "OK"