diff options
Diffstat (limited to 'src/WWWStaticusPlugins.hs')
| -rw-r--r-- | src/WWWStaticusPlugins.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/WWWStaticusPlugins.hs b/src/WWWStaticusPlugins.hs index 33916ef..790a694 100644 --- a/src/WWWStaticusPlugins.hs +++ b/src/WWWStaticusPlugins.hs @@ -67,13 +67,16 @@ staticusPluginsDefault=[ staticusPluginInit ] -- |Creates target directory and sets basic params in map: +-- TODO: cleanup! staticusPluginInit::StaticusPlugin staticusPluginInit = StaticusPlugin "init" id runIO where runIO m = - do print $ par "path" m + do putStrLn $ "processing: " ++ par "path" m ++ " ..." when (not isHome) (createDirectory outdir) + c <- getDirList (par "path" m) t <- getDirList (par "dir_in" m) + let menutop= concat $ map (\x->"<li class=\"nav-item"++(if length brc>=1 && brc!!0==x then " active" else "")++"\"><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\">"++cln x++"</a></li>") (menu c) let breadcrumbs=concat $ map (\(x,d)->"<li class=\"breadcrumb-item"++(if d==0 then " active" else "")++"\">"++(if d==0 then "" else "<a href=."++concat(take d (repeat "/.."))++"/index.html>")++cln x++(if d==0 then "" else "</a>")++"</li>") (zip ("home":brc) [brcl,brcl-1..]) @@ -88,6 +91,7 @@ staticusPluginInit = StaticusPlugin "init" id runIO ,("breadcrumbs",breadcrumbs) ,("title",if null brc then "Home" else cln $ last brc) ]) m + where outdir = par "dir_out" m ++ "/" ++ intercalate "/" brc brc = remUnder $ splitOn "/" (drop (length (par "dir_in" m)) (par "path" m)) brcl = length brc @@ -131,10 +135,12 @@ staticusPluginFill = StaticusPlugin "fill template" run return replace "###MENU###" (par "menutop" m) $ replace "###CONTENT###" (par "content" m) $ replace "###ROOT###" (par "html_root" m) $ - replace "###TITLE###" (par "title" m) $ + replace "###TITLE###" (t (par' "###>>>TITLE" m,par "title" m)) $ replace "###DESCRIPTION###" (par' "###>>>DSC" m) $ replace "###KEYWORDS###" (par' "###>>>KWD" m) $ (par "template.html" m))]) m + t (a,b) = if a=="" then b else a + -- |write final index.html file staticusPluginWrite::StaticusPlugin |
