summaryrefslogtreecommitdiff
path: root/src/WWWStaticusPlugins.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WWWStaticusPlugins.hs')
-rw-r--r--src/WWWStaticusPlugins.hs21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/WWWStaticusPlugins.hs b/src/WWWStaticusPlugins.hs
index fe17583..a569ca9 100644
--- a/src/WWWStaticusPlugins.hs
+++ b/src/WWWStaticusPlugins.hs
@@ -59,12 +59,14 @@ staticusPluginsDefault=[ staticusPluginInit
staticusPluginInit::StaticusPlugin
staticusPluginInit = StaticusPlugin "init" id runIO
where runIO m =
- do when (not isHome) (createDirectory outdir)
+ do print $ par "path" m
+ print $ outdir
+ when (not isHome) (createDirectory outdir)
c <- getDirList (par "path" m)
t <- getDirList (par "dir_in" m)
let menutop= concat $ map (\x->"<li class=\"navitem\"><a class=\"nav-link\" href=\""++par "dir_out" m++"/"++x++"/index.html\">"++x++"</a></li>") (menu t)
let submenu= if isHome then "" else concat $ map (\x->"<li><a href=\""++outdir++"/"++x++"/index.html\">"++x++"</a></li>") (menu c)
--- let breadcrumbs=concat brc
+ let breadcrumbs=concat $ map (\x->x) brc
let breadcrumbs=""
--TODO: check top dirs until file found! add ./config
md <- readFile $ par "path" m++"/"++"index.md"
@@ -83,7 +85,8 @@ staticusPluginInit = StaticusPlugin "init" id runIO
isHome = par "path" m==par "dir_in" m
-- |This plugin will simply copy files of given extension from source
--- to the target directory. give it a list of extensions.
+-- to the target directory. give it a list of file extensions.
+-- example [".png",".zip",".css"]
staticusPluginCopy::[String]->StaticusPlugin
staticusPluginCopy ext = StaticusPlugin "copy by extension" id runIO
where runIO m = do
@@ -99,13 +102,16 @@ staticusPluginPandoc = StaticusPlugin "pandoc" run return
writeHtml5String def doc
in M.union (M.fromList [("content",T.unpack (fromRight (T.pack "err") f))]) m
--- |Plugin for filling the 'template.html' value with 'content'
--- and storing in 'final'
+-- |Plugin for filling the 'template.html' value with 'content', 'menu',
+-- etc and storing in 'final'
staticusPluginFill::StaticusPlugin
staticusPluginFill = StaticusPlugin "fill template" run return
where run m = M.union (M.fromList [("final",
- replace "###BREADCRUMBS###" (par "breadcrumbs" m) $ replace "###SUBMENU###" (par "submenu" m) $ replace "###MENU###" (par "menutop" m) (replace "###CONTENT###" (par "content" m) (par "template.html" m)))]) m
-
+ replace "###BREADCRUMBS###" (par "breadcrumbs" m) $
+ replace "###SUBMENU###" (par "submenu" m) $
+ replace "###MENU###" (par "menutop" m) $
+ replace "###CONTENT###" (par "content" m) $
+ (par "template.html" m))]) m
-- |write final index.html file
staticusPluginWrite::StaticusPlugin
@@ -113,3 +119,4 @@ staticusPluginWrite = StaticusPlugin "writer" id runIO
where runIO m = do
writeFile ((par "outdir" m)++"/index.html") (par "final" m)
return m
+