more dir parameters
This commit is contained in:
parent
c6d86aeed3
commit
384e56cb53
14
Types.hs
14
Types.hs
|
@ -44,6 +44,8 @@ data SiteState =
|
||||||
, _templates :: M.Map FilePath Mu.Template
|
, _templates :: M.Map FilePath Mu.Template
|
||||||
, _outputDir :: FilePath -- ^ Directory for output
|
, _outputDir :: FilePath -- ^ Directory for output
|
||||||
, _assetDir :: 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
|
, _defaultTemplate :: FilePath -- ^ Name of the default template
|
||||||
, _redirectTemplate :: FilePath -- ^ Name of the template for redirect pages
|
, _redirectTemplate :: FilePath -- ^ Name of the template for redirect pages
|
||||||
, _tagTemplate :: FilePath -- ^ Name of the template for tag listing pages
|
, _tagTemplate :: FilePath -- ^ Name of the template for tag listing pages
|
||||||
|
@ -71,7 +73,17 @@ siteOptions' = do
|
||||||
short 'a' <>
|
short 'a' <>
|
||||||
help "Assets directory to be copied verbatim" <>
|
help "Assets directory to be copied verbatim" <>
|
||||||
value "assets" <> showDefault
|
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 <-
|
_defaultTemplate <-
|
||||||
strOption $
|
strOption $
|
||||||
long "default-template" <>
|
long "default-template" <>
|
||||||
|
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
6
site.hs
6
site.hs
|
@ -23,6 +23,7 @@ import Hakyll.Core.Util.File (getRecursiveContents, makeDirectories)
|
||||||
import Lens.Micro
|
import Lens.Micro
|
||||||
import Lens.Micro.Aeson
|
import Lens.Micro.Aeson
|
||||||
import Lens.Micro.Mtl
|
import Lens.Micro.Mtl
|
||||||
|
import qualified Options.Applicative
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
( (</>)
|
( (</>)
|
||||||
, isAbsolute
|
, isAbsolute
|
||||||
|
@ -36,7 +37,6 @@ import Text.Pandoc.Class (runIOorExplode)
|
||||||
import Text.Pandoc.Readers.Markdown (readMarkdown)
|
import Text.Pandoc.Readers.Markdown (readMarkdown)
|
||||||
import Text.Pandoc.Writers.HTML (writeHtml5String)
|
import Text.Pandoc.Writers.HTML (writeHtml5String)
|
||||||
import qualified Text.Parsec.Error
|
import qualified Text.Parsec.Error
|
||||||
import qualified Options.Applicative
|
|
||||||
|
|
||||||
import FormatOpts
|
import FormatOpts
|
||||||
import Types
|
import Types
|
||||||
|
@ -321,9 +321,9 @@ main = do
|
||||||
init <- Options.Applicative.execParser siteOptions
|
init <- Options.Applicative.execParser siteOptions
|
||||||
flip runStateT init $ do
|
flip runStateT init $ do
|
||||||
installAssets
|
installAssets
|
||||||
traverse sourcePages ["external"]
|
use sourceDir >>= sourcePages
|
||||||
sourceTags
|
sourceTags
|
||||||
sourceTemplates "templates"
|
use templateDir >>= sourceTemplates
|
||||||
use pages >>= traverse (uncurry installPage) . M.assocs
|
use pages >>= traverse (uncurry installPage) . M.assocs
|
||||||
renderTags
|
renderTags
|
||||||
io $ putStrLn "OK"
|
io $ putStrLn "OK"
|
||||||
|
|
Loading…
Reference in a new issue