diff options
-rw-r--r-- | blog.cabal | 1 | ||||
-rw-r--r-- | blog.nix | 22 | ||||
-rw-r--r-- | provider/css/default.css | 77 | ||||
-rw-r--r-- | provider/index.html | 1 | ||||
-rw-r--r-- | provider/index.md | 3 | ||||
-rw-r--r-- | provider/templates/default.html | 5 | ||||
-rw-r--r-- | src/Site.hs | 19 |
7 files changed, 96 insertions, 32 deletions
@@ -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 | ||
@@ -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 | |||
8 | mkDerivation { | 6 | mkDerivation { |
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 @@ | |||
1 | header, footer { | ||
2 | padding:1em 0 1em 0; | ||
3 | } | ||
4 | |||
5 | header { | ||
6 | border-bottom:2px solid #f0f0f0; | ||
7 | } | ||
8 | |||
9 | footer { | ||
10 | border-top:2px solid #f0f0f0; | ||
11 | } | ||
12 | |||
13 | footer ul.tags { | ||
14 | list-style:none outside none; | ||
15 | margin:0; | ||
16 | padding:0; | ||
17 | display:inline; | ||
18 | } | ||
19 | |||
20 | footer ul.tags:before { content:" — "; } | ||
21 | |||
22 | footer ul.tags li { | ||
23 | margin:0; | ||
24 | padding:0; | ||
25 | display:inline; | ||
26 | } | ||
27 | |||
28 | footer ul.tags li:after { content:", "; } | ||
29 | |||
30 | footer ul.tags li:last-child:after { content: ""; } | ||
31 | |||
32 | header h1, header h2 { | ||
33 | margin:0; | ||
34 | } | ||
35 | |||
36 | header h2.subtitle { | ||
37 | font-size:1em; | ||
38 | font-weight:normal; | ||
39 | font-style:italic; | ||
40 | } | ||
41 | |||
1 | body { | 42 | body { |
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 | ||
10 | a { | 51 | a { |
11 | color: inherit; | 52 | color:inherit; |
12 | } | 53 | } |
13 | 54 | ||
14 | p { | 55 | p { |
15 | margin-bottom: 0 | 56 | margin-top:1em; |
57 | margin-bottom:0; | ||
58 | } | ||
59 | |||
60 | p:last-of-type { | ||
61 | margin-bottom:1em; | ||
16 | } | 62 | } |
17 | 63 | ||
18 | p + p { | 64 | p + p { |
19 | text-indent: 1.5em; | 65 | text-indent:1.5em; |
20 | margin-top: 0; | 66 | margin-top:0; |
67 | } | ||
68 | |||
69 | footer p, footer p:last-of-type { | ||
70 | margin:0; | ||
71 | padding:0; | ||
72 | text-indent:0; | ||
73 | display:inline; | ||
21 | } | 74 | } |
22 | 75 | ||
23 | div.sourceCode { | 76 | div.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 | ||
29 | pre code { | 82 | pre 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 @@ | |||
1 | This is a blog. | ||
2 | It contains things. | ||
3 | Send 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) | |||
9 | import Data.Map (Map) | 9 | import Data.Map (Map) |
10 | import qualified Data.Map as Map | 10 | import qualified Data.Map as Map |
11 | import qualified Data.Set as Set | 11 | import qualified Data.Set as Set |
12 | import Data.List (take, reverse, nub, groupBy, concatMap) | 12 | import Data.List (take, reverse, nub, groupBy, concatMap, intersperse) |
13 | import Data.Function (on) | 13 | import Data.Function (on) |
14 | import Data.Default | 14 | import Data.Default |
15 | import Text.Pandoc | 15 | import Text.Pandoc |
16 | import Text.Pandoc.Walk (query, walkM) | 16 | import Text.Pandoc.Walk (query, walkM) |
17 | import Text.Pandoc.Error | 17 | import Text.Pandoc.Error |
18 | import Control.Applicative (Alternative(..), Applicative(..)) | 18 | import Control.Applicative (Alternative(..), Applicative(..)) |
19 | import Text.Blaze.Html (toHtml, toValue, (!)) | ||
20 | import qualified Text.Blaze.Html5 as H | ||
21 | import qualified Text.Blaze.Html5.Attributes as A | ||
19 | 22 | ||
20 | import System.FilePath (takeBaseName, (</>), (<.>)) | 23 | import 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 |