diff options
| author | Miguel <m.i@gmx.at> | 2019-02-17 11:59:50 +0100 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2019-02-17 11:59:50 +0100 |
| commit | e4fdf5ac751273bcea58beaafb7d7e98f3a93b85 (patch) | |
| tree | bbbc36bf1c0304887d1a9f6a2b58b34cbaf03fad /src/WWWStaticusPlugins.hs | |
| parent | d0a2a6ed5ed787fc613f73ba74439d1beba0d1c1 (diff) | |
cleaning up in progress
Diffstat (limited to 'src/WWWStaticusPlugins.hs')
| -rw-r--r-- | src/WWWStaticusPlugins.hs | 21 |
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 + |
