aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Types.hs14
-rw-r--r--cards/mypage/img/awesome.png (renamed from external/mypage/img/awesome.png)bin36215 -> 36215 bytes
-rw-r--r--cards/mypage/text.md (renamed from external/mypage/text.md)0
-rw-r--r--site.hs6
4 files changed, 16 insertions, 4 deletions
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
index 769a333..769a333 100644
--- a/external/mypage/img/awesome.png
+++ b/cards/mypage/img/awesome.png
Binary files differ
diff --git a/external/mypage/text.md b/cards/mypage/text.md
index f1d7306..f1d7306 100644
--- a/external/mypage/text.md
+++ b/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"