summaryrefslogtreecommitdiff
path: root/src/WWW
diff options
context:
space:
mode:
Diffstat (limited to 'src/WWW')
-rw-r--r--src/WWW/Base.hs39
-rw-r--r--src/WWW/HW.hs14
2 files changed, 53 insertions, 0 deletions
diff --git a/src/WWW/Base.hs b/src/WWW/Base.hs
new file mode 100644
index 0000000..4f8d1c7
--- /dev/null
+++ b/src/WWW/Base.hs
@@ -0,0 +1,39 @@
+module WWW.Base
+ ( baseConfig
+ , baseHakyll
+ , domain
+ , wwwRoot
+ ) where
+
+import Prolog
+import Hakyll
+import System.Process
+
+
+hakyllVersion :: IsString s => s
+hakyllVersion = "Hakyll 4.16.2.2"
+
+-- | mathematicaster.org
+domain :: IsString s => s
+domain = "mathematicaster.org"
+
+-- | /var/www
+wwwRoot :: IsString s => s
+wwwRoot = "/var/www"
+
+baseConfig :: FilePath -> Configuration
+baseConfig p = defaultConfiguration
+ { destinationDirectory = "output"
+ , storeDirectory = ".cache"
+ , tmpDirectory = ".cache/tmp"
+ , deploySite = \cfg -> rawSystem "rsync"
+ [ "-aP"
+ , "--delete-after"
+ , "--chown=nginx:nginx"
+ , destinationDirectory cfg <> "/"
+ , "root@" <> domain <> ":" <> wwwRoot <> "/" <> p
+ ]
+ }
+
+baseHakyll :: MonadIO m => FilePath -> Rules a -> m ()
+baseHakyll p = liftIO . hakyllWith (baseConfig p)
diff --git a/src/WWW/HW.hs b/src/WWW/HW.hs
new file mode 100644
index 0000000..0740fe6
--- /dev/null
+++ b/src/WWW/HW.hs
@@ -0,0 +1,14 @@
+module WWW.HW
+ ( removeEnv
+ , removeSolutions
+ ) where
+
+import Prolog
+
+import Text.LaTeX.Base.Syntax
+
+removeEnv :: (String -> Bool) -> LaTeX -> LaTeX
+removeEnv p = texmap (\case { TeXEnv s _ _ -> p s; _ -> False }) $ pure mempty
+
+removeSolutions :: LaTeX -> LaTeX
+removeSolutions = removeEnv (== "solution")