summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-01-24 09:25:11 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-01-24 09:25:11 +0000
commit8152c250c54b6be6533eecf393d38c83b4c66348 (patch)
tree6fcde0ce3914d61e8bc0414b01b686dd77d805c1
parent68b7a70cca25a891df55721bf104fe36c8cb862a (diff)
downloaddirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.tar
dirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.tar.gz
dirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.tar.bz2
dirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.tar.xz
dirty-haskell.org-8152c250c54b6be6533eecf393d38c83b4c66348.zip
Site redesign
-rw-r--r--blog.cabal1
-rw-r--r--blog.nix22
-rw-r--r--provider/css/default.css77
-rw-r--r--provider/index.html1
-rw-r--r--provider/index.md3
-rw-r--r--provider/templates/default.html5
-rw-r--r--src/Site.hs19
7 files changed, 96 insertions, 32 deletions
diff --git a/blog.cabal b/blog.cabal
index e6aba5f..b8e83ce 100644
--- a/blog.cabal
+++ b/blog.cabal
@@ -36,3 +36,4 @@ executable site
36 , deepseq >=1.4 && <2 36 , deepseq >=1.4 && <2
37 , regex-tdfa >=1.2 && <2 37 , regex-tdfa >=1.2 && <2
38 , mtl >=2.2 && <3 38 , mtl >=2.2 && <3
39 , blaze-html >=0.8.1 && <1
diff --git a/blog.nix b/blog.nix
index ca9a83f..cce4bc9 100644
--- a/blog.nix
+++ b/blog.nix
@@ -1,19 +1,19 @@
1# This file was auto-generated by cabal2nix. Please do NOT edit manually! 1{ mkDerivation, base, blaze-html, bytestring, containers
2 2, cryptohash, data-default, deepseq, directory, filepath, hakyll
3{ mkDerivation, stdenv 3, hex, mtl, pandoc, pandoc-types, process, regex-tdfa, stdenv
4, hakyll, containers, pandoc, data-default, filepath, hex, cryptohash 4, temporary
5, process, temporary, directory, deepseq, regex-tdfa, mtl
6}: 5}:
7
8mkDerivation { 6mkDerivation {
9 pname = "dirty-haskell"; 7 pname = "dirty-haskell";
10 version = "0.0.0"; 8 version = "0.0.0";
11 src = ./.; 9 src = ./.;
12 isExecutable = true;
13 isLibrary = false; 10 isLibrary = false;
14 buildDepends = [ 11 isExecutable = true;
15 hakyll containers pandoc data-default filepath hex cryptohash 12 executableHaskellDepends = [
16 process temporary directory deepseq regex-tdfa mtl 13 base blaze-html bytestring containers cryptohash data-default
14 deepseq directory filepath hakyll hex mtl pandoc pandoc-types
15 process regex-tdfa temporary
17 ]; 16 ];
18 license = stdenv.lib.licenses.publicDomain; 17 homepage = "git://git.yggdrasil.li/dirty-haskell.org";
18 license = stdenv.lib.licenses.unfree;
19} 19}
diff --git a/provider/css/default.css b/provider/css/default.css
index af4832a..a100adc 100644
--- a/provider/css/default.css
+++ b/provider/css/default.css
@@ -1,29 +1,82 @@
1header, footer {
2 padding:1em 0 1em 0;
3}
4
5header {
6 border-bottom:2px solid #f0f0f0;
7}
8
9footer {
10 border-top:2px solid #f0f0f0;
11}
12
13footer ul.tags {
14 list-style:none outside none;
15 margin:0;
16 padding:0;
17 display:inline;
18}
19
20footer ul.tags:before { content:" — "; }
21
22footer ul.tags li {
23 margin:0;
24 padding:0;
25 display:inline;
26}
27
28footer ul.tags li:after { content:", "; }
29
30footer ul.tags li:last-child:after { content: ""; }
31
32header h1, header h2 {
33 margin:0;
34}
35
36header h2.subtitle {
37 font-size:1em;
38 font-weight:normal;
39 font-style:italic;
40}
41
1body { 42body {
2 margin: auto; 43 margin:auto;
3 padding-right: 1em; 44 padding-right:1em;
4 padding-left: 1em; 45 padding-left:1em;
5 font: normal 1.1em monospace; 46 font:normal 1em monospace;
6 max-width: 90em; 47 max-width:90em;
7 text-align: justify; 48 text-align:justify;
8} 49}
9 50
10a { 51a {
11 color: inherit; 52 color:inherit;
12} 53}
13 54
14p { 55p {
15 margin-bottom: 0 56 margin-top:1em;
57 margin-bottom:0;
58}
59
60p:last-of-type {
61 margin-bottom:1em;
16} 62}
17 63
18p + p { 64p + p {
19 text-indent: 1.5em; 65 text-indent:1.5em;
20 margin-top: 0; 66 margin-top:0;
67}
68
69footer p, footer p:last-of-type {
70 margin:0;
71 padding:0;
72 text-indent:0;
73 display:inline;
21} 74}
22 75
23div.sourceCode { 76div.sourceCode {
24 padding-left: 1.5em; 77 padding-left:1.5em;
25 border-left:2px solid #f0f0f0; 78 border-left:2px solid #f0f0f0;
26 margin-left: -2px; 79 margin-left:-2px;
27} 80}
28 81
29pre code { 82pre code {
diff --git a/provider/index.html b/provider/index.html
index 8eb184f..422b726 100644
--- a/provider/index.html
+++ b/provider/index.html
@@ -1,4 +1,3 @@
1$body$
2<ul> 1<ul>
3 $for(tags)$ 2 $for(tags)$
4 <li> 3 <li>
diff --git a/provider/index.md b/provider/index.md
deleted file mode 100644
index 53a06bc..0000000
--- a/provider/index.md
+++ /dev/null
@@ -1,3 +0,0 @@
1This is a blog.
2It contains things.
3Send other things to <blog@dirty-haskell.org> if you so choose.
diff --git a/provider/templates/default.html b/provider/templates/default.html
index ba412e6..4dca581 100644
--- a/provider/templates/default.html
+++ b/provider/templates/default.html
@@ -18,8 +18,13 @@
18$if(title)$ 18$if(title)$
19<header> 19<header>
20 <h1 class="title"><a href="/" title="dirty-haskell.org">dirty-haskell.org</a>: $title$</h1> 20 <h1 class="title"><a href="/" title="dirty-haskell.org">dirty-haskell.org</a>: $title$</h1>
21 <h2 class="subtitle">It's not crazy — it's having fun with types.</h2>
21</header> 22</header>
22$endif$ 23$endif$
23$body$ 24$body$
25<footer>
26 <p class="info">$if(published)$$published$, $endif$<a href="mailto:blog@dirty-haskell.org">blog@dirty-haskell.org</a></p>
27 $if(tagList)$<ul class="tags">$tagList$</ul>$endif$
28</footer>
24</body> 29</body>
25</html> 30</html>
diff --git a/src/Site.hs b/src/Site.hs
index 98a598f..c1e4854 100644
--- a/src/Site.hs
+++ b/src/Site.hs
@@ -9,13 +9,16 @@ import Data.Maybe (mapMaybe, fromMaybe)
9import Data.Map (Map) 9import Data.Map (Map)
10import qualified Data.Map as Map 10import qualified Data.Map as Map
11import qualified Data.Set as Set 11import qualified Data.Set as Set
12import Data.List (take, reverse, nub, groupBy, concatMap) 12import Data.List (take, reverse, nub, groupBy, concatMap, intersperse)
13import Data.Function (on) 13import Data.Function (on)
14import Data.Default 14import Data.Default
15import Text.Pandoc 15import Text.Pandoc
16import Text.Pandoc.Walk (query, walkM) 16import Text.Pandoc.Walk (query, walkM)
17import Text.Pandoc.Error 17import Text.Pandoc.Error
18import Control.Applicative (Alternative(..), Applicative(..)) 18import Control.Applicative (Alternative(..), Applicative(..))
19import Text.Blaze.Html (toHtml, toValue, (!))
20import qualified Text.Blaze.Html5 as H
21import qualified Text.Blaze.Html5.Attributes as A
19 22
20import System.FilePath (takeBaseName, (</>), (<.>)) 23import System.FilePath (takeBaseName, (</>), (<.>))
21 24
@@ -45,16 +48,20 @@ main = hakyllWith config $ do
45 saveSnapshot "alignment" $ fmap snd item 48 saveSnapshot "alignment" $ fmap snd item
46 return $ fmap fst item 49 return $ fmap fst item
47 50
51 tags <- buildTags "posts/*" tagTranslation' >>= addTag "All Posts" "posts/*"
52
48 match "posts/*" $ do 53 match "posts/*" $ do
49 route $ setExtension ".html" 54 route $ setExtension ".html"
50 compile $ do 55 compile $ do
56 let ctx = mconcat [ defaultContext
57 , dateField "published" "%F"
58 , tagsFieldWith getTags (\tag _ -> Just . H.li $ H.a ! A.href (toValue . toUrl $ "tags" </> tagTranslation tag <.> "html") $ toHtml tag) (mconcat . intersperse "\n") "tagList" tags
59 ]
51 getResourceBody >>= saveSnapshot "content" 60 getResourceBody >>= saveSnapshot "content"
52 pandocCompilerWithTransformM defaultHakyllReaderOptions defaultHakyllWriterOptions mathTransform 61 pandocCompilerWithTransformM defaultHakyllReaderOptions defaultHakyllWriterOptions mathTransform
53 >>= loadAndApplyTemplate "templates/default.html" defaultContext 62 >>= loadAndApplyTemplate "templates/default.html" ctx
54 >>= relativizeUrls 63 >>= relativizeUrls
55 64
56 tags <- buildTags "posts/*" tagTranslation' >>= addTag "All Posts" "posts/*"
57
58 tagsRules tags $ \tag pattern -> do 65 tagsRules tags $ \tag pattern -> do
59 route idRoute 66 route idRoute
60 compile $ do 67 compile $ do
@@ -89,7 +96,9 @@ main = hakyllWith config $ do
89 , defaultContext 96 , defaultContext
90 ] 97 ]
91 item <- getResourceBody 98 item <- getResourceBody
92 pandocCompilerWith def (def { writerEmailObfuscation = NoObfuscation }) 99 {-pandocCompilerWith def (def { writerEmailObfuscation = NoObfuscation })
100 >>=-}
101 makeItem ""
93 >>= loadAndApplyTemplate "templates/index.html" ctx 102 >>= loadAndApplyTemplate "templates/index.html" ctx
94 >>= loadAndApplyTemplate "templates/default.html" ctx 103 >>= loadAndApplyTemplate "templates/default.html" ctx
95 >>= relativizeUrls 104 >>= relativizeUrls