aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2016-05-25 14:31:53 +0200
committerJoris2017-07-25 00:36:39 +0200
commit7091d40b31d4e9fe32ab15b865397e9abf0ba5d8 (patch)
tree237d92ecd75edf3a875b08921ea5e5eae8eac085
downloadjardin-7091d40b31d4e9fe32ab15b865397e9abf0ba5d8.tar.gz
jardin-7091d40b31d4e9fe32ab15b865397e9abf0ba5d8.tar.bz2
jardin-7091d40b31d4e9fe32ab15b865397e9abf0ba5d8.zip
Init with potimarron page
-rw-r--r--.gitignore7
-rw-r--r--.gitlab-ci.yml20
-rw-r--r--.tmuxinator.yml8
-rw-r--r--Makefile25
-rw-r--r--README.md25
-rw-r--r--design/Main.hs120
-rw-r--r--images/icon.pngbin0 -> 662 bytes
-rw-r--r--index.html5
-rw-r--r--jardin.cabal14
-rw-r--r--legumes/potimarron.md48
-rw-r--r--shell.nix11
-rw-r--r--src/Main.hs47
-rw-r--r--stack.yaml1
-rw-r--r--templates/main.html15
-rw-r--r--templates/vegetables.html9
15 files changed, 355 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..886423d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+_cache
+public
+.stack-work
+output
+node_modules
+bower_components
+yarn.lock
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..155de00
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,20 @@
+image: haskell:latest
+
+cache:
+ paths:
+ - .stack-work
+ - output
+
+pages:
+ script:
+ - apt-get update
+ - apt-get install -y xz-utils make
+ - export STACK_ROOT="$(pwd)/.stack"
+ - stack setup
+ - stack build
+ - stack exec cooking build
+ artifacts:
+ paths:
+ - public
+ only:
+ - master
diff --git a/.tmuxinator.yml b/.tmuxinator.yml
new file mode 100644
index 0000000..d3e40c3
--- /dev/null
+++ b/.tmuxinator.yml
@@ -0,0 +1,8 @@
+name: jardin
+
+windows:
+ - main:
+ layout: fff4,119x58,0,0{94x58,0,0,0,24x58,95,0,1}
+ panes:
+ - # Empty
+ - make install watch
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e4b352c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,25 @@
+all: build
+
+start:
+ @nix-shell --command "mux local"
+
+stop:
+ @tmux kill-session -t jardin
+
+clean:
+ @stack exec jardin clean > /dev/null 2>&1 || true
+ @stack clean > /dev/null
+
+install:
+ @stack setup
+
+.PHONY: build
+build:
+ @stack build
+ @stack exec jardin build
+
+watch:
+ @nodemon --watch src -e hs --exec 'make watch-command --silent'
+
+watch-command:
+ @(killall jardin || :) && sleep 1 && stack build && stack exec jardin watch
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..ee173d7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,25 @@
+[Jardin](https://guyonvarch.gitlab.io/jardin)
+=============================================
+
+[![build status](https://gitlab.com/guyonvarch/jardin/badges/master/build.svg)](https://gitlab.com/guyonvarch/jardin/commits/master)
+
+Gettings started
+----------------
+
+Install nix and follow the instructions:
+
+```sh
+curl https://nixos.org/nix/install | sh
+```
+
+Then:
+
+```sh
+make start
+```
+
+Later, stop the environment with:
+
+```sh
+make stop
+```
diff --git a/design/Main.hs b/design/Main.hs
new file mode 100644
index 0000000..18688ba
--- /dev/null
+++ b/design/Main.hs
@@ -0,0 +1,120 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+import Clay hiding (violet)
+import Data.Monoid ((<>))
+import qualified Clay.Media as Media
+
+fernFrond = rgb 101 114 32
+violet = rgb 13 13 81
+
+main :: IO ()
+main = putCss $ do
+
+ body ? do
+ maxWidth responsiveLimit
+ sym2 margin (px 0) auto
+ mobile $ fontSize (px 14)
+ desktop $ fontSize (px 18)
+
+ "a.header" ? do
+ display block
+ sym2 padding (px 15) (px 0)
+ sym2 margin (px 0) auto
+ backgroundColor fernFrond
+ color white
+ fontWeight bold
+ textAlign center
+ hover & textDecoration none
+ desktop $ do
+ fontSize (px 32)
+ marginBottom (px 30)
+ borderRadius (px 0) (px 0) (px 5) (px 5)
+ mobile $ do
+ fontSize (px 22)
+ marginBottom (px 20)
+
+ a ? do
+ textDecoration none
+ color violet
+ hover & textDecoration underline
+
+ "#content" ? do
+ mobile $ sym2 margin (px 0) (px 20)
+
+ (h1 <> h2) ? color fernFrond
+
+ h1 ? do
+ desktop $ fontSize (px 28)
+ mobile $ fontSize (px 22)
+
+ h2 ? do
+ desktop $ fontSize (px 22)
+ mobile $ fontSize (px 18)
+
+ (ul <> ol) ? do
+ listStyleType none
+ desktop $ paddingLeft (px 15)
+ mobile $ paddingLeft (px 0)
+
+ li ? do
+ marginBottom (em 0.8)
+ lineHeight (em 1.6)
+ position relative
+ paddingLeft (px 20)
+ before & do
+ position absolute
+ top (px 0)
+ left (px 0)
+ color fernFrond
+ display inlineBlock
+
+ (ol <> ul) |> li |> (ol <> ul) ? do
+ marginTop (em 0.5)
+ marginLeft (px 30)
+
+ ul ? li ? before &
+ content (stringContent "•")
+
+ ol ? do
+ "counter-reset" -: "ol"
+
+ li ? do
+ desktop $ paddingLeft (px 30)
+ mobile $ paddingLeft (px 20)
+ position relative
+ textAlign justify
+ before & do
+ "counter-increment" -: "ol"
+ "content" -: "counter(ol)\".\""
+
+ p ? do
+ lineHeight (px 20)
+
+ (".plus" <> ".moins") ? before & do
+ display inlineBlock
+ width (px 20)
+ height (px 20)
+ marginRight (px 10)
+ textAlign (center)
+ verticalAlign middle
+ fontWeight bold
+ "transform" -: "translateY(-2px)"
+ marginLeft (px 10)
+
+ ".plus" ? before & do
+ content (stringContent "+")
+ color green
+
+ ".moins" ? before & do
+ content (stringContent "−")
+ color red
+
+
+mobile :: Css -> Css
+mobile = query Media.screen [ Media.maxWidth responsiveLimit ]
+
+desktop :: Css -> Css
+desktop = query Media.screen [ Media.minWidth responsiveLimit ]
+
+responsiveLimit :: Size LengthUnit
+responsiveLimit = px 800
diff --git a/images/icon.png b/images/icon.png
new file mode 100644
index 0000000..900ccde
--- /dev/null
+++ b/images/icon.png
Binary files differ
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..a967757
--- /dev/null
+++ b/index.html
@@ -0,0 +1,5 @@
+---
+title: Jardin
+---
+
+$partial("templates/vegetables.html")$
diff --git a/jardin.cabal b/jardin.cabal
new file mode 100644
index 0000000..476b65a
--- /dev/null
+++ b/jardin.cabal
@@ -0,0 +1,14 @@
+name: jardin
+version: 0.1.0.0
+build-type: Simple
+cabal-version: >= 1.10
+
+executable jardin
+ main-is: Main.hs
+ hs-source-dirs: src
+ ghc-options: -threaded
+ default-language: Haskell2010
+ build-depends: base
+ , hakyll
+ , clay
+ , process
diff --git a/legumes/potimarron.md b/legumes/potimarron.md
new file mode 100644
index 0000000..853f5b7
--- /dev/null
+++ b/legumes/potimarron.md
@@ -0,0 +1,48 @@
+---
+title: Potimarron
+---
+
+Semis
+=====
+
+- Semer 2 ou 3 graines en godet dès la mi-mars, soit 3 semaines avant la fin
+ des gelées, ou directement en terre à partir de la mi-mai.
+- Mettre la pointe de chaque graine vers le bas à 2 cm de profondeur.
+- Ne garder que la plante la plus vigoureuse au bout de 3 semaines.
+- Placer dans une terre riche à un endroit ensoleillé.
+- Espacer les plants de 2 mètres de diamètre dans le potager.
+
+Associations
+============
+
+<span class="plus"></span>maïs, camomille.
+
+<span class="moins" />choux, pommes de terre.
+
+Entretien
+=========
+
+- Couper la tige principale au dessus de la 2<sup>ème</sup> feuille lorsque la
+ tige a 5 feuilles.
+- Couper chaque tige partant de la base après la 5<sup>ème</sup> feuille
+ lorsque la tige a une dizaine de feuilles.
+- Couper la tige deux feuilles après chaque potimarron lorsqu’il a la taille
+ d’une grosse pomme.
+- Pailler le pied, ainsi que les potimarrons pour éviter la pourriture.
+- Arroser modérément durant l’été en évitant de mouiller le feuillage.
+- Éviter de conserver plus de 5 ou 6 potimarrons par pied.
+
+Récolte
+=======
+
+- Récolter avant les 1<sup>ères</sup> gelées, lorsque le pédoncule est bien
+ sec, que le feuillage jaunit et que le fruit est bien orangé. Cela correspond
+ au début du mois d’octobre.
+- Conserver au maximum le pédoncule lors de la coupe.
+- Enlever la végétation une fois que tout est récolté pour éviter les maladies
+ et champignons.
+
+Conservation
+============
+
+- Conserver 1 an après la récolte, dans un environnement sec, de 10°C à 15°C.
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..bbbcc4a
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,11 @@
+with import <nixpkgs> {}; {
+ env = stdenv.mkDerivation {
+ name = "env";
+ buildInputs = with pkgs; [
+ stack
+ nodePackages.nodemon
+ tmux
+ tmuxinator
+ ];
+ };
+}
diff --git a/src/Main.hs b/src/Main.hs
new file mode 100644
index 0000000..b9ba49c
--- /dev/null
+++ b/src/Main.hs
@@ -0,0 +1,47 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+import Data.List (sortBy)
+import Data.Monoid (mappend)
+import Data.Ord (comparing)
+
+import Hakyll
+import Hakyll.Core.Item (Item(itemIdentifier))
+import System.Process (readProcess)
+
+main :: IO ()
+main = hakyllWith configuration $ do
+ match "images/*" $ do
+ route idRoute
+ compile copyFileCompiler
+
+ match "design/**" $ do
+ route $ customRoute $ const "main.css"
+ compile $ do
+ filePath <- getResourceFilePath
+ unsafeCompiler (readProcess "runghc" [ filePath ] "")
+ >>= makeItem
+
+ match "legumes/**" $ do
+ route $ setExtension "html"
+ compile $ pandocCompiler
+ >>= loadAndApplyTemplate "templates/main.html" defaultContext
+ >>= relativizeUrls
+
+ match "index.html" $ do
+ route idRoute
+ let context =
+ listField "vegetables" defaultContext (loadAll "legumes/*") `mappend`
+ defaultContext
+ compile $
+ getResourceBody
+ >>= applyAsTemplate context
+ >>= loadAndApplyTemplate "templates/main.html" context
+ >>= relativizeUrls
+
+ match "templates/*" $ compile templateBodyCompiler
+
+configuration :: Configuration
+configuration = defaultConfiguration
+ { destinationDirectory = "public"
+ , inMemoryCache = True
+ }
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
index 0000000..018615a
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1 @@
+resolver: lts-8.3
diff --git a/templates/main.html b/templates/main.html
new file mode 100644
index 0000000..5957668
--- /dev/null
+++ b/templates/main.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="fr">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>$title$</title>
+ <link rel="stylesheet" href="/main.css" />
+ <link rel="icon" href="/images/icon.png">
+ </head>
+ <body>
+ <a href="/" class="header">$title$</a>
+ <div id="content">$body$</div>
+ <script src="/main.js"></script>
+ </body>
+</html>
diff --git a/templates/vegetables.html b/templates/vegetables.html
new file mode 100644
index 0000000..eabb315
--- /dev/null
+++ b/templates/vegetables.html
@@ -0,0 +1,9 @@
+<h1>Légumes</h1>
+
+<ul>
+ $for(vegetables)$
+ <li>
+ <a href="$url$">$title$</a>
+ </li>
+ $endfor$
+</ul>