From c29bc4bd20f2f098720a2b973b1d14f0938cf226 Mon Sep 17 00:00:00 2001 From: Miguel Date: Tue, 19 Feb 2019 10:49:37 +0100 Subject: allow title override --- src/WWWStaticusPlugins.hs | 10 ++++++++-- 1 file 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->"
  • =1 && brc!!0==x then " active" else "")++"\">"++x++"
  • ") (menu t) let submenu= if isHome then "" else concat $ map (\x->"
  • "++cln x++"
  • ") (menu c) let breadcrumbs=concat $ map (\(x,d)->"
  • "++(if d==0 then "" else "")++cln x++(if d==0 then "" else "")++"
  • ") (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 -- cgit v1.2.3