summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.md5
-rw-r--r--Makefile2
-rw-r--r--estatico.cabal2
-rw-r--r--src/WWWStaticusPlugins.hs11
4 files changed, 12 insertions, 8 deletions
diff --git a/ChangeLog.md b/ChangeLog.md
deleted file mode 100644
index 36f1718..0000000
--- a/ChangeLog.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Changelog for staticus
-
-- First Release
-
-## Unreleased changes
diff --git a/Makefile b/Makefile
index 2eed15c..8ec4bb4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,4 @@
+build:
+ stack build
update_gitweb_readme:
markdown README.md | ssh git readme miguel/estatico set
diff --git a/estatico.cabal b/estatico.cabal
index c16e424..a65b47f 100644
--- a/estatico.cabal
+++ b/estatico.cabal
@@ -11,7 +11,6 @@ license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
- ChangeLog.md
library
exposed-modules:
@@ -34,6 +33,7 @@ library
, time
, http-conduit
, bytestring
+ , process
default-language: Haskell2010
executable estatico-exe
diff --git a/src/WWWStaticusPlugins.hs b/src/WWWStaticusPlugins.hs
index 668dfb6..043e40e 100644
--- a/src/WWWStaticusPlugins.hs
+++ b/src/WWWStaticusPlugins.hs
@@ -12,6 +12,7 @@ module WWWStaticusPlugins
) where
import WWWStaticus
+import System.Process
import System.Directory as D
import System.IO.Error
import Data.Time.Clock as C
@@ -65,7 +66,7 @@ staticusPluginsDefault::[StaticusPlugin]
staticusPluginsDefault=[ staticusPluginInit
,staticusPluginTimestamp
,staticusPluginCfg
- ,staticusPluginCopy [".jpg",".png",".zip",".css",".js",".ico",".mp4",".ogv",".hs",".glade",".cast"]
+ ,staticusPluginCopy [".jpg",".png",".zip",".css",".js",".ico",".mp4",".ogv",".hs",".glade",".cast",".pdf"]
,staticusPluginCards
,staticusDownloadEmbed
,staticusPluginPandoc
@@ -129,9 +130,16 @@ staticusPluginCopy::[String]->StaticusPlugin
staticusPluginCopy ext = StaticusPlugin "copy by extension" id runIO
where runIO m = do
let tst x=or $ map ($x) (map isSuffixOf ext)
+ let tst_img x=or $ map ($x) (map isSuffixOf [".jpg",".png"])
+ let tst_vid x=or $ map ($x) (map isSuffixOf [".ogv",".ogg"])
dl <- filter tst <$> listDirectory (par "path" m)
mapM_ (\x->copyFile (par "path" m++"/"++x) (par "outdir" m++"/"++x)) dl
+ mapM_ (\x->scaleFile (par "path" m++"/"++x) (par "outdir" m++"/"++x)) $ filter tst_img dl
return m
+ where scaleFile fin fout = do let conv_cmd = "convert \""++fin++"\" -resize 640x640 \""++renameImg fout++"\""
+ putStrLn conv_cmd
+ system conv_cmd
+ renameImg = uncurry (++) . first (("/"++).intercalate "/". init) . second (("/scale_"++).last) . dupe . splitOn "/"
-- |extracts config lines (###>>>) from 'index.md'
staticusPluginCfg::StaticusPlugin
@@ -162,7 +170,6 @@ staticusPluginFill = StaticusPlugin "fill template" run return
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