on master help sign in
Merge branch 'master' into type-safe-identifiers
commitcd0228ac2bb845b25b30095d4b4d9649eac447b2 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSun 29 May 2011, 12:17 (15 years ago) parent25b28d851f0bfc
11 files changed+218−135
examples/hakyll/css/default.css+2−2 examples/hakyll/examples.markdown+27 examples/hakyll/hakyll.hs+1 examples/hakyll/images/hakyll-system-1.png examples/hakyll/images/hakyll-system-2.png examples/hakyll/images/hakyll-system-3.png examples/hakyll/index.markdown+16−24 examples/hakyll/sidebar.markdown+1 examples/hakyll/templates/default.html+22 hakyll.cabal+132−103 src/Hakyll/Web/Page.hs+17−6
examples/hakyll/css/default.css+2−2
@@ -31,7 +31,7 @@ div#header h1 {
3131
3232div#main {
3333 margin: 0px auto 0px auto;
34− width: 760px;
34+ width: 860px;
3535}
3636
3737div#sidebar {
@@ -50,7 +50,7 @@ div#sidebar a {
5050}
5151
5252div#content {
53− width: 570px;
53+ width: 670px;
5454 float: right;
5555}
5656
examples/hakyll/examples.markdownnew file+27
@@ -0,0 +1,27 @@
1+---
2+title: Examples
3+---
4+
5+## Simple examples
6+
7+A number of simple examples are available in the GitHub repository. They can be
8+found [here](https://github.com/jaspervdj/hakyll/tree/master/examples). The
9+README located in that directory explains which example does what.
10+
11+## People using Hakyll
12+
13+A lot of sites running Hakyll also publish the source code. This is a very
14+interesting resource to learn from as well. If you're using Hakyll for your
15+site, and the source code is available, please notify me so I can add you to
16+this list. This list has no particular ordering.
17+
18+- <http://jaspervdj.be/>,
19+ [source](https://github.com/jaspervdj/jaspervdj)
20+- <http://ethanschoonover.com/>,
21+ [source](https://github.com/altercation/ethanschoonover.com)
22+- <http://extralogical.net/>,
23+ [source](https://github.com/beastaugh/extralogical.net)
24+- <http://blog.demotera.com/>,
25+ [source](https://bitbucket.org/paul_r/blog-de-demotera)
26+- <http://projects.haskell.org/diagrams/>,
27+ [source](http://patch-tag.com/r/byorgey/diagrams-doc/snapshot/current/content/pretty/web/)
examples/hakyll/hakyll.hs+1
@@ -46,6 +46,7 @@ main = hakyll $ do
4646
4747 pages = [ "about.markdown"
4848 , "changelog.markdown"
49+ , "examples.markdown"
4950 , "index.markdown"
5051 , "philosophy.markdown"
5152 , "reference.markdown"
examples/hakyll/images/hakyll-system-1.pngnew file

Binary file not shown.

examples/hakyll/images/hakyll-system-2.pngnew file

Binary file not shown.

examples/hakyll/images/hakyll-system-3.pngnew file

Binary file not shown.

examples/hakyll/index.markdown+16−24
@@ -2,12 +2,6 @@
22title: Home
33---
44
5−## Hakyll 3
6−
7−Hakyll 3 has been released, and it can be installed by running
8−`cabal install hakyll`. For a limited time (but as long as is necessary) you can
9−access the old site and documentation [here](/hakyll2)
10−
115## Overview
126
137Hakyll is a [Haskell](http://haskell.org) library for generating static sites,
@@ -15,30 +9,28 @@ mostly aimed at small-to-medium sites and personal blogs. It is written in a
159very configurable way and uses an [xmonad](http://xmonad.org)-like DSL for
1610configuration.
1711
18−## Why static site generators?
12+Integration with [pandoc](http://johnmacfarlane.net/pandoc/) gives us markdown
13+and TeX support, including syntax highlighting and other goodies.
14+
15+## The Hakyll System
1916
20−- Static sites are extremely fast.
21−- You don't have to worry about security issues.
17+### Write your content in whatever format you prefer
2218
23−## Features of Hakyll
19+![Write your content](/images/hakyll-system-1.png)
2420
25−- Integration with [pandoc](http://johnmacfarlane.net/pandoc/) gives us markdown
26− and TeX support, including syntax highlighting and other goodies.
27−- An easy templating system.
28−- Hakyll also features a simple http server for previewing your site.
21+### Create compilation rules in a Haskell EDSL
2922
30−## See some examples
23+![Write your rules](/images/hakyll-system-2.png)
3124
32−Some sites written in Hakyll:
25+### Compile it to HTML and upload it!
3326
34−- Blog of [Demotera](http://blog.demotera.com/), a French engineering company
35−- Personal home page and blog of [Chris Done](http://chrisdone.com/)
36−- Personal home page and blog of [Jasper Van der Jeugt](http://jaspervdj.be/)
37−- [The Haskell Alphabet](http://www.cis.upenn.edu/~byorgey/haskell-alphabet/)
38− by Brent Yorgey
39−- Personal home page and blog of [Nicolas Wu](http://zenzike.com/)
40−- Home page of [Ethan Schoonover](http://ethanschoonover.com/)
41−- [Extralogical](http://extralogical.net/) by Benedict Eastaugh
27+![Compile it](/images/hakyll-system-3.png)
28+
29+## Hakyll 3
30+
31+Hakyll 3 has been released, and it can be installed by running
32+`cabal install hakyll`. For a limited time (but as long as is necessary) you can
33+access the old site and documentation [here](/hakyll2).
4234
4335## Getting Started
4436
examples/hakyll/sidebar.markdown+1
@@ -4,5 +4,6 @@
44[philosophy](/philosophy.html)
55[about](/about.html)
66[tutorial](/tutorial.html)
7+[examples](/examples.html)
78[reference](/reference.html)
89[changelog](/changelog.html)
examples/hakyll/templates/default.html+22
@@ -13,6 +13,22 @@
1313 <!-- Metadata. -->
1414 <meta name="keywords" content="hakyll,static site generator,static,site,generator,haskell,blog"/>
1515 <meta name="description" content="Hakyll - A Static Site Generator in Haskell."/>
16+
17+ <!-- Flattr JS -->
18+ <!--
19+ <script type="text/javascript">
20+ /* <![CDATA[ */
21+ (function() {
22+ var s = document.createElement('script'), t =
23+ document.getElementsByTagName('script')[0];
24+ s.type = 'text/javascript';
25+ s.async = true;
26+ s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
27+ t.parentNode.insertBefore(s, t);
28+ })();
29+ /* ]]> */
30+ </script>
31+ -->
1632 </head>
1733 <body>
1834 <div id="main">
@@ -23,6 +39,12 @@
2339 <!-- Sidebar. -->
2440 <div id="sidebar">
2541 $sidebar$
42+
43+ <!-- Flattr button -->
44+ <!--
45+ <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://jaspervdj.be/hakyll"></a>
46+ <noscript><a href="http://flattr.com/thing/291889/Hakyll" target="_blank"> <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
47+ -->
2648 </div>
2749
2850 <div id="content">
hakyll.cabal+132−103
@@ -1,103 +1,132 @@
1−Name: hakyll
2−Version: 3.1.2.6
3−
4−Synopsis: A simple static site generator library.
5−Description: A simple static site generator library, mainly aimed at
6− creating blogs and brochure sites.
7−Author: Jasper Van der Jeugt
8−Maintainer: jaspervdj@gmail.com
9−Homepage: http://jaspervdj.be/hakyll
10−Bug-Reports: http://github.com/jaspervdj/Hakyll/issues
11−License: BSD3
12−License-File: LICENSE
13−Category: Text
14−Cabal-Version: >= 1.6
15−Data-Dir: data
16−Data-Files: templates/atom.xml
17− templates/atom-item.xml
18− templates/rss.xml
19− templates/rss-item.xml
20−extra-source-files: src-inotify/Hakyll/Web/Preview/Poll.hs
21− src-interval/Hakyll/Web/Preview/Poll.hs
22−
23−build-type: Simple
24−
25−source-repository head
26− type: git
27− location: git://github.com/jaspervdj/hakyll.git
28−
29−library
30− ghc-options: -Wall
31− hs-source-dirs: src
32−
33− build-depends: base >= 4 && < 5,
34− filepath == 1.*,
35− directory == 1.*,
36− containers == 0.*,
37− pandoc == 1.*,
38− regex-base >= 0.93,
39− regex-pcre >= 0.93,
40− mtl >= 1,
41− old-locale == 1.*,
42− old-time == 1.*,
43− time >= 1.1,
44− binary >= 0.5,
45− hamlet >= 0.7,
46− blaze-html >= 0.4,
47− snap-server >= 0.4,
48− snap-core >= 0.4,
49− bytestring >= 0.9,
50− utf8-string >= 0.3,
51− HTTP >= 4000,
52− tagsoup >= 0.12,
53− hopenssl >= 1.4,
54− unix >= 2.4,
55− strict-concurrency >= 0.2
56− exposed-modules: Hakyll
57− Hakyll.Main
58− Hakyll.Web.Blaze
59− Hakyll.Web.Util.Url
60− Hakyll.Web.Preview.Server
61− Hakyll.Web.Preview.Poll
62− Hakyll.Web.CompressCss
63− Hakyll.Web.Template
64− Hakyll.Web.Feed
65− Hakyll.Web.Tags
66− Hakyll.Web.Pandoc
67− Hakyll.Web.Pandoc.FileType
68− Hakyll.Web.Page
69− Hakyll.Web.Template.Read
70− Hakyll.Web.RelativizeUrls
71− Hakyll.Web.Page.Read
72− Hakyll.Web.Page.Metadata
73− Hakyll.Core.Configuration
74− Hakyll.Core.DependencyAnalyzer
75− Hakyll.Core.Identifier.Pattern
76− Hakyll.Core.UnixFilter
77− Hakyll.Core.Util.Arrow
78− Hakyll.Core.Util.File
79− Hakyll.Core.Util.String
80− Hakyll.Core.Resource
81− Hakyll.Core.Resource.Provider
82− Hakyll.Core.Resource.Provider.File
83− Hakyll.Core.CompiledItem
84− Hakyll.Core.Compiler
85− Hakyll.Core.Run
86− Hakyll.Core.Store
87− Hakyll.Core.Writable
88− Hakyll.Core.Writable.CopyFile
89− Hakyll.Core.Writable.WritableTuple
90− Hakyll.Core.Identifier
91− Hakyll.Core.DirectedGraph.Dot
92− Hakyll.Core.DirectedGraph
93− Hakyll.Core.Rules
94− Hakyll.Core.Routes
95− Hakyll.Core.Logger
96− other-modules: Paths_hakyll
97− Hakyll.Web.Template.Read.Hakyll
98− Hakyll.Web.Template.Read.Hamlet
99− Hakyll.Web.Template.Internal
100− Hakyll.Web.Page.Internal
101− Hakyll.Core.Compiler.Internal
102− Hakyll.Core.DirectedGraph.Internal
103− Hakyll.Core.Rules.Internal
1+Name: hakyll
2+Version: 3.1.2.7
3+
4+Synopsis: A static website compiler library
5+Description:
6+ Hakyll is a static website compiler library. It provides you with the tools to
7+ create a simple or advanced static website using a Haskell DSL and formats
8+ such as markdown or RST. You can find more information, including a tutorial,
9+ on the website:
10+
11+ .
12+
13+ * <http://jaspervdj.be/hakyll>
14+
15+ .
16+
17+ If you seek assistance, there's:
18+
19+ .
20+
21+ * A google group: <http://groups.google.com/group/hakyll>
22+
23+ .
24+
25+ * An IRC channel, @#hakyll@ on freenode
26+
27+ .
28+
29+ Additionally, there's the Haddock documentation in the different modules,
30+ meant as a reference.
31+
32+Author: Jasper Van der Jeugt
33+Maintainer: jaspervdj@gmail.com
34+Homepage: http://jaspervdj.be/hakyll
35+Bug-Reports: http://github.com/jaspervdj/Hakyll/issues
36+License: BSD3
37+License-File: LICENSE
38+Category: Text
39+
40+Cabal-Version: >= 1.6
41+Build-Type: Simple
42+Data-Dir: data
43+Data-Files:
44+ templates/atom.xml
45+ templates/atom-item.xml
46+ templates/rss.xml
47+ templates/rss-item.xml
48+
49+Source-Repository head
50+ Type: git
51+ Location: git://github.com/jaspervdj/hakyll.git
52+
53+Library
54+ Ghc-Options: -Wall
55+ Hs-Source-Dirs: src
56+
57+ Build-Depends:
58+ base >= 4 && < 5,
59+ filepath == 1.*,
60+ directory == 1.*,
61+ containers == 0.*,
62+ pandoc == 1.*,
63+ regex-base >= 0.93,
64+ regex-pcre >= 0.93,
65+ mtl >= 1,
66+ old-locale == 1.*,
67+ old-time == 1.*,
68+ time >= 1.1,
69+ binary >= 0.5,
70+ hamlet >= 0.7,
71+ blaze-html >= 0.4,
72+ snap-server >= 0.4,
73+ snap-core >= 0.4,
74+ bytestring >= 0.9,
75+ utf8-string >= 0.3,
76+ HTTP >= 4000,
77+ tagsoup >= 0.12,
78+ hopenssl >= 1.4,
79+ unix >= 2.4,
80+ strict-concurrency >= 0.2
81+
82+ Exposed-Modules:
83+ Hakyll
84+ Hakyll.Main
85+ Hakyll.Web.Blaze
86+ Hakyll.Web.Util.Url
87+ Hakyll.Web.Preview.Server
88+ Hakyll.Web.Preview.Poll
89+ Hakyll.Web.CompressCss
90+ Hakyll.Web.Template
91+ Hakyll.Web.Feed
92+ Hakyll.Web.Tags
93+ Hakyll.Web.Pandoc
94+ Hakyll.Web.Pandoc.FileType
95+ Hakyll.Web.Page
96+ Hakyll.Web.Template.Read
97+ Hakyll.Web.RelativizeUrls
98+ Hakyll.Web.Page.Read
99+ Hakyll.Web.Page.Metadata
100+ Hakyll.Core.Configuration
101+ Hakyll.Core.DependencyAnalyzer
102+ Hakyll.Core.Identifier.Pattern
103+ Hakyll.Core.UnixFilter
104+ Hakyll.Core.Util.Arrow
105+ Hakyll.Core.Util.File
106+ Hakyll.Core.Util.String
107+ Hakyll.Core.Resource
108+ Hakyll.Core.Resource.Provider
109+ Hakyll.Core.Resource.Provider.File
110+ Hakyll.Core.CompiledItem
111+ Hakyll.Core.Compiler
112+ Hakyll.Core.Run
113+ Hakyll.Core.Store
114+ Hakyll.Core.Writable
115+ Hakyll.Core.Writable.CopyFile
116+ Hakyll.Core.Writable.WritableTuple
117+ Hakyll.Core.Identifier
118+ Hakyll.Core.DirectedGraph.Dot
119+ Hakyll.Core.DirectedGraph
120+ Hakyll.Core.Rules
121+ Hakyll.Core.Routes
122+ Hakyll.Core.Logger
123+
124+ Other-Modules:
125+ Paths_hakyll
126+ Hakyll.Web.Template.Read.Hakyll
127+ Hakyll.Web.Template.Read.Hamlet
128+ Hakyll.Web.Template.Internal
129+ Hakyll.Web.Page.Internal
130+ Hakyll.Core.Compiler.Internal
131+ Hakyll.Core.DirectedGraph.Internal
132+ Hakyll.Core.Rules.Internal
src/Hakyll/Web/Page.hs+17−6
@@ -54,6 +54,7 @@ module Hakyll.Web.Page
5454 , readPageCompiler
5555 , pageCompiler
5656 , pageCompilerWith
57+ , pageCompilerWithPandoc
5758 , addDefaultFields
5859 , sortByBaseName
5960 ) where
@@ -66,7 +67,7 @@ import qualified Data.Map as M
6667import Data.List (sortBy)
6768import Data.Ord (comparing)
6869
69−import Text.Pandoc (ParserState, WriterOptions)
70+import Text.Pandoc (Pandoc, ParserState, WriterOptions)
7071
7172import Hakyll.Core.Identifier
7273import Hakyll.Core.Compiler
@@ -91,16 +92,26 @@ readPageCompiler = getResourceString >>^ readPage
9192-- | Read a page, add default fields, substitute fields and render using pandoc
9293--
9394pageCompiler :: Compiler Resource (Page String)
94−pageCompiler = cached "Hakyll.Web.Page.pageCompiler" $
95− readPageCompiler >>> addDefaultFields >>> arr applySelf >>> pageRenderPandoc
95+pageCompiler =
96+ pageCompilerWith defaultHakyllParserState defaultHakyllWriterOptions
9697
9798-- | A version of 'pageCompiler' which allows you to specify your own pandoc
9899-- options
99100--
100−pageCompilerWith :: ParserState -> WriterOptions -> Compiler Resource (Page String)
101−pageCompilerWith state options = cached "pageCompilerWith" $
101+pageCompilerWith :: ParserState -> WriterOptions
102+ -> Compiler Resource (Page String)
103+pageCompilerWith state options = pageCompilerWithPandoc state options id
104+
105+-- | An extension of 'pageCompilerWith' which allows you to specify a custom
106+-- pandoc transformer for the content
107+--
108+pageCompilerWithPandoc :: ParserState -> WriterOptions
109+ -> (Pandoc -> Pandoc)
110+ -> Compiler Resource (Page String)
111+pageCompilerWithPandoc state options f = cached "pageCompilerWithPandoc" $
102112 readPageCompiler >>> addDefaultFields >>> arr applySelf
103− >>> pageRenderPandocWith state options
113+ >>> pageReadPandocWith state
114+ >>> arr (fmap (writePandocWith options . f))
104115
105116-- | Add a number of default metadata fields to a page. These fields include:
106117--