diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-29 12:17:55 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-29 12:17:55 +0200 |
commit | cd0228ac2bb845b25b30095d4b4d9649eac447b2 (patch) | |
tree | 85bdb82f05563d8ffbb7fe06fa4d0df70b9e6972 | |
parent | 25b28d8ba4792bf31e2add88607f868f7b88bdd8 (diff) | |
parent | 51f0bfc195aca8b911614fe3d84cb2551d722e3d (diff) | |
download | hakyll-cd0228ac2bb845b25b30095d4b4d9649eac447b2.tar.gz |
Merge branch 'master' into type-safe-identifiers
-rw-r--r-- | examples/hakyll/css/default.css | 4 | ||||
-rw-r--r-- | examples/hakyll/examples.markdown | 27 | ||||
-rw-r--r-- | examples/hakyll/hakyll.hs | 1 | ||||
-rw-r--r-- | examples/hakyll/images/hakyll-system-1.png | bin | 0 -> 34950 bytes | |||
-rw-r--r-- | examples/hakyll/images/hakyll-system-2.png | bin | 0 -> 29373 bytes | |||
-rw-r--r-- | examples/hakyll/images/hakyll-system-3.png | bin | 0 -> 28774 bytes | |||
-rw-r--r-- | examples/hakyll/index.markdown | 40 | ||||
-rw-r--r-- | examples/hakyll/sidebar.markdown | 1 | ||||
-rw-r--r-- | examples/hakyll/templates/default.html | 22 | ||||
-rw-r--r-- | hakyll.cabal | 235 | ||||
-rw-r--r-- | src/Hakyll/Web/Page.hs | 23 |
11 files changed, 218 insertions, 135 deletions
diff --git a/examples/hakyll/css/default.css b/examples/hakyll/css/default.css index f895f48..06f664c 100644 --- a/examples/hakyll/css/default.css +++ b/examples/hakyll/css/default.css @@ -31,7 +31,7 @@ div#header h1 { div#main { margin: 0px auto 0px auto; - width: 760px; + width: 860px; } div#sidebar { @@ -50,7 +50,7 @@ div#sidebar a { } div#content { - width: 570px; + width: 670px; float: right; } diff --git a/examples/hakyll/examples.markdown b/examples/hakyll/examples.markdown new file mode 100644 index 0000000..453a22e --- /dev/null +++ b/examples/hakyll/examples.markdown @@ -0,0 +1,27 @@ +--- +title: Examples +--- + +## Simple examples + +A number of simple examples are available in the GitHub repository. They can be +found [here](https://github.com/jaspervdj/hakyll/tree/master/examples). The +README located in that directory explains which example does what. + +## People using Hakyll + +A lot of sites running Hakyll also publish the source code. This is a very +interesting resource to learn from as well. If you're using Hakyll for your +site, and the source code is available, please notify me so I can add you to +this list. This list has no particular ordering. + +- <http://jaspervdj.be/>, + [source](https://github.com/jaspervdj/jaspervdj) +- <http://ethanschoonover.com/>, + [source](https://github.com/altercation/ethanschoonover.com) +- <http://extralogical.net/>, + [source](https://github.com/beastaugh/extralogical.net) +- <http://blog.demotera.com/>, + [source](https://bitbucket.org/paul_r/blog-de-demotera) +- <http://projects.haskell.org/diagrams/>, + [source](http://patch-tag.com/r/byorgey/diagrams-doc/snapshot/current/content/pretty/web/) diff --git a/examples/hakyll/hakyll.hs b/examples/hakyll/hakyll.hs index 60ddc33..5ee755f 100644 --- a/examples/hakyll/hakyll.hs +++ b/examples/hakyll/hakyll.hs @@ -46,6 +46,7 @@ main = hakyll $ do pages = [ "about.markdown" , "changelog.markdown" + , "examples.markdown" , "index.markdown" , "philosophy.markdown" , "reference.markdown" diff --git a/examples/hakyll/images/hakyll-system-1.png b/examples/hakyll/images/hakyll-system-1.png Binary files differnew file mode 100644 index 0000000..69e850c --- /dev/null +++ b/examples/hakyll/images/hakyll-system-1.png diff --git a/examples/hakyll/images/hakyll-system-2.png b/examples/hakyll/images/hakyll-system-2.png Binary files differnew file mode 100644 index 0000000..eb424a9 --- /dev/null +++ b/examples/hakyll/images/hakyll-system-2.png diff --git a/examples/hakyll/images/hakyll-system-3.png b/examples/hakyll/images/hakyll-system-3.png Binary files differnew file mode 100644 index 0000000..cdffe2d --- /dev/null +++ b/examples/hakyll/images/hakyll-system-3.png diff --git a/examples/hakyll/index.markdown b/examples/hakyll/index.markdown index c430ab3..ee44cf3 100644 --- a/examples/hakyll/index.markdown +++ b/examples/hakyll/index.markdown @@ -2,12 +2,6 @@ title: Home --- -## Hakyll 3 - -Hakyll 3 has been released, and it can be installed by running -`cabal install hakyll`. For a limited time (but as long as is necessary) you can -access the old site and documentation [here](/hakyll2) - ## Overview Hakyll 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 very configurable way and uses an [xmonad](http://xmonad.org)-like DSL for configuration. -## Why static site generators? +Integration with [pandoc](http://johnmacfarlane.net/pandoc/) gives us markdown +and TeX support, including syntax highlighting and other goodies. + +## The Hakyll System -- Static sites are extremely fast. -- You don't have to worry about security issues. +### Write your content in whatever format you prefer -## Features of Hakyll +![Write your content](/images/hakyll-system-1.png) -- Integration with [pandoc](http://johnmacfarlane.net/pandoc/) gives us markdown - and TeX support, including syntax highlighting and other goodies. -- An easy templating system. -- Hakyll also features a simple http server for previewing your site. +### Create compilation rules in a Haskell EDSL -## See some examples +![Write your rules](/images/hakyll-system-2.png) -Some sites written in Hakyll: +### Compile it to HTML and upload it! -- Blog of [Demotera](http://blog.demotera.com/), a French engineering company -- Personal home page and blog of [Chris Done](http://chrisdone.com/) -- Personal home page and blog of [Jasper Van der Jeugt](http://jaspervdj.be/) -- [The Haskell Alphabet](http://www.cis.upenn.edu/~byorgey/haskell-alphabet/) - by Brent Yorgey -- Personal home page and blog of [Nicolas Wu](http://zenzike.com/) -- Home page of [Ethan Schoonover](http://ethanschoonover.com/) -- [Extralogical](http://extralogical.net/) by Benedict Eastaugh +![Compile it](/images/hakyll-system-3.png) + +## Hakyll 3 + +Hakyll 3 has been released, and it can be installed by running +`cabal install hakyll`. For a limited time (but as long as is necessary) you can +access the old site and documentation [here](/hakyll2). ## Getting Started diff --git a/examples/hakyll/sidebar.markdown b/examples/hakyll/sidebar.markdown index fb40b5d..8396c75 100644 --- a/examples/hakyll/sidebar.markdown +++ b/examples/hakyll/sidebar.markdown @@ -4,5 +4,6 @@ [philosophy](/philosophy.html) [about](/about.html) [tutorial](/tutorial.html) +[examples](/examples.html) [reference](/reference.html) [changelog](/changelog.html) diff --git a/examples/hakyll/templates/default.html b/examples/hakyll/templates/default.html index 139564b..040292c 100644 --- a/examples/hakyll/templates/default.html +++ b/examples/hakyll/templates/default.html @@ -13,6 +13,22 @@ <!-- Metadata. --> <meta name="keywords" content="hakyll,static site generator,static,site,generator,haskell,blog"/> <meta name="description" content="Hakyll - A Static Site Generator in Haskell."/> + + <!-- Flattr JS --> + <!-- + <script type="text/javascript"> + /* <![CDATA[ */ + (function() { + var s = document.createElement('script'), t = + document.getElementsByTagName('script')[0]; + s.type = 'text/javascript'; + s.async = true; + s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto'; + t.parentNode.insertBefore(s, t); + })(); + /* ]]> */ + </script> + --> </head> <body> <div id="main"> @@ -23,6 +39,12 @@ <!-- Sidebar. --> <div id="sidebar"> $sidebar$ + + <!-- Flattr button --> + <!-- + <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://jaspervdj.be/hakyll"></a> + <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> + --> </div> <div id="content"> diff --git a/hakyll.cabal b/hakyll.cabal index b8ff57c..f7be8b2 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -1,103 +1,132 @@ -Name: hakyll -Version: 3.1.2.6 - -Synopsis: A simple static site generator library. -Description: A simple static site generator library, mainly aimed at - creating blogs and brochure sites. -Author: Jasper Van der Jeugt -Maintainer: jaspervdj@gmail.com -Homepage: http://jaspervdj.be/hakyll -Bug-Reports: http://github.com/jaspervdj/Hakyll/issues -License: BSD3 -License-File: LICENSE -Category: Text -Cabal-Version: >= 1.6 -Data-Dir: data -Data-Files: templates/atom.xml - templates/atom-item.xml - templates/rss.xml - templates/rss-item.xml -extra-source-files: src-inotify/Hakyll/Web/Preview/Poll.hs - src-interval/Hakyll/Web/Preview/Poll.hs - -build-type: Simple - -source-repository head - type: git - location: git://github.com/jaspervdj/hakyll.git - -library - ghc-options: -Wall - hs-source-dirs: src - - build-depends: base >= 4 && < 5, - filepath == 1.*, - directory == 1.*, - containers == 0.*, - pandoc == 1.*, - regex-base >= 0.93, - regex-pcre >= 0.93, - mtl >= 1, - old-locale == 1.*, - old-time == 1.*, - time >= 1.1, - binary >= 0.5, - hamlet >= 0.7, - blaze-html >= 0.4, - snap-server >= 0.4, - snap-core >= 0.4, - bytestring >= 0.9, - utf8-string >= 0.3, - HTTP >= 4000, - tagsoup >= 0.12, - hopenssl >= 1.4, - unix >= 2.4, - strict-concurrency >= 0.2 - exposed-modules: Hakyll - Hakyll.Main - Hakyll.Web.Blaze - Hakyll.Web.Util.Url - Hakyll.Web.Preview.Server - Hakyll.Web.Preview.Poll - Hakyll.Web.CompressCss - Hakyll.Web.Template - Hakyll.Web.Feed - Hakyll.Web.Tags - Hakyll.Web.Pandoc - Hakyll.Web.Pandoc.FileType - Hakyll.Web.Page - Hakyll.Web.Template.Read - Hakyll.Web.RelativizeUrls - Hakyll.Web.Page.Read - Hakyll.Web.Page.Metadata - Hakyll.Core.Configuration - Hakyll.Core.DependencyAnalyzer - Hakyll.Core.Identifier.Pattern - Hakyll.Core.UnixFilter - Hakyll.Core.Util.Arrow - Hakyll.Core.Util.File - Hakyll.Core.Util.String - Hakyll.Core.Resource - Hakyll.Core.Resource.Provider - Hakyll.Core.Resource.Provider.File - Hakyll.Core.CompiledItem - Hakyll.Core.Compiler - Hakyll.Core.Run - Hakyll.Core.Store - Hakyll.Core.Writable - Hakyll.Core.Writable.CopyFile - Hakyll.Core.Writable.WritableTuple - Hakyll.Core.Identifier - Hakyll.Core.DirectedGraph.Dot - Hakyll.Core.DirectedGraph - Hakyll.Core.Rules - Hakyll.Core.Routes - Hakyll.Core.Logger - other-modules: Paths_hakyll - Hakyll.Web.Template.Read.Hakyll - Hakyll.Web.Template.Read.Hamlet - Hakyll.Web.Template.Internal - Hakyll.Web.Page.Internal - Hakyll.Core.Compiler.Internal - Hakyll.Core.DirectedGraph.Internal - Hakyll.Core.Rules.Internal +Name: hakyll +Version: 3.1.2.7 + +Synopsis: A static website compiler library +Description: + Hakyll is a static website compiler library. It provides you with the tools to + create a simple or advanced static website using a Haskell DSL and formats + such as markdown or RST. You can find more information, including a tutorial, + on the website: + + . + + * <http://jaspervdj.be/hakyll> + + . + + If you seek assistance, there's: + + . + + * A google group: <http://groups.google.com/group/hakyll> + + . + + * An IRC channel, @#hakyll@ on freenode + + . + + Additionally, there's the Haddock documentation in the different modules, + meant as a reference. + +Author: Jasper Van der Jeugt +Maintainer: jaspervdj@gmail.com +Homepage: http://jaspervdj.be/hakyll +Bug-Reports: http://github.com/jaspervdj/Hakyll/issues +License: BSD3 +License-File: LICENSE +Category: Text + +Cabal-Version: >= 1.6 +Build-Type: Simple +Data-Dir: data +Data-Files: + templates/atom.xml + templates/atom-item.xml + templates/rss.xml + templates/rss-item.xml + +Source-Repository head + Type: git + Location: git://github.com/jaspervdj/hakyll.git + +Library + Ghc-Options: -Wall + Hs-Source-Dirs: src + + Build-Depends: + base >= 4 && < 5, + filepath == 1.*, + directory == 1.*, + containers == 0.*, + pandoc == 1.*, + regex-base >= 0.93, + regex-pcre >= 0.93, + mtl >= 1, + old-locale == 1.*, + old-time == 1.*, + time >= 1.1, + binary >= 0.5, + hamlet >= 0.7, + blaze-html >= 0.4, + snap-server >= 0.4, + snap-core >= 0.4, + bytestring >= 0.9, + utf8-string >= 0.3, + HTTP >= 4000, + tagsoup >= 0.12, + hopenssl >= 1.4, + unix >= 2.4, + strict-concurrency >= 0.2 + + Exposed-Modules: + Hakyll + Hakyll.Main + Hakyll.Web.Blaze + Hakyll.Web.Util.Url + Hakyll.Web.Preview.Server + Hakyll.Web.Preview.Poll + Hakyll.Web.CompressCss + Hakyll.Web.Template + Hakyll.Web.Feed + Hakyll.Web.Tags + Hakyll.Web.Pandoc + Hakyll.Web.Pandoc.FileType + Hakyll.Web.Page + Hakyll.Web.Template.Read + Hakyll.Web.RelativizeUrls + Hakyll.Web.Page.Read + Hakyll.Web.Page.Metadata + Hakyll.Core.Configuration + Hakyll.Core.DependencyAnalyzer + Hakyll.Core.Identifier.Pattern + Hakyll.Core.UnixFilter + Hakyll.Core.Util.Arrow + Hakyll.Core.Util.File + Hakyll.Core.Util.String + Hakyll.Core.Resource + Hakyll.Core.Resource.Provider + Hakyll.Core.Resource.Provider.File + Hakyll.Core.CompiledItem + Hakyll.Core.Compiler + Hakyll.Core.Run + Hakyll.Core.Store + Hakyll.Core.Writable + Hakyll.Core.Writable.CopyFile + Hakyll.Core.Writable.WritableTuple + Hakyll.Core.Identifier + Hakyll.Core.DirectedGraph.Dot + Hakyll.Core.DirectedGraph + Hakyll.Core.Rules + Hakyll.Core.Routes + Hakyll.Core.Logger + + Other-Modules: + Paths_hakyll + Hakyll.Web.Template.Read.Hakyll + Hakyll.Web.Template.Read.Hamlet + Hakyll.Web.Template.Internal + Hakyll.Web.Page.Internal + Hakyll.Core.Compiler.Internal + Hakyll.Core.DirectedGraph.Internal + Hakyll.Core.Rules.Internal diff --git a/src/Hakyll/Web/Page.hs b/src/Hakyll/Web/Page.hs index a9c622c..1450702 100644 --- a/src/Hakyll/Web/Page.hs +++ b/src/Hakyll/Web/Page.hs @@ -54,6 +54,7 @@ module Hakyll.Web.Page , readPageCompiler , pageCompiler , pageCompilerWith + , pageCompilerWithPandoc , addDefaultFields , sortByBaseName ) where @@ -66,7 +67,7 @@ import qualified Data.Map as M import Data.List (sortBy) import Data.Ord (comparing) -import Text.Pandoc (ParserState, WriterOptions) +import Text.Pandoc (Pandoc, ParserState, WriterOptions) import Hakyll.Core.Identifier import Hakyll.Core.Compiler @@ -91,16 +92,26 @@ readPageCompiler = getResourceString >>^ readPage -- | Read a page, add default fields, substitute fields and render using pandoc -- pageCompiler :: Compiler Resource (Page String) -pageCompiler = cached "Hakyll.Web.Page.pageCompiler" $ - readPageCompiler >>> addDefaultFields >>> arr applySelf >>> pageRenderPandoc +pageCompiler = + pageCompilerWith defaultHakyllParserState defaultHakyllWriterOptions -- | A version of 'pageCompiler' which allows you to specify your own pandoc -- options -- -pageCompilerWith :: ParserState -> WriterOptions -> Compiler Resource (Page String) -pageCompilerWith state options = cached "pageCompilerWith" $ +pageCompilerWith :: ParserState -> WriterOptions + -> Compiler Resource (Page String) +pageCompilerWith state options = pageCompilerWithPandoc state options id + +-- | An extension of 'pageCompilerWith' which allows you to specify a custom +-- pandoc transformer for the content +-- +pageCompilerWithPandoc :: ParserState -> WriterOptions + -> (Pandoc -> Pandoc) + -> Compiler Resource (Page String) +pageCompilerWithPandoc state options f = cached "pageCompilerWithPandoc" $ readPageCompiler >>> addDefaultFields >>> arr applySelf - >>> pageRenderPandocWith state options + >>> pageReadPandocWith state + >>> arr (fmap (writePandocWith options . f)) -- | Add a number of default metadata fields to a page. These fields include: -- |