diff options
19 files changed, 273 insertions, 2 deletions
diff --git a/examples/brochure/about.markdown b/examples/brochure/about.markdown new file mode 100644 index 0000000..410cb10 --- /dev/null +++ b/examples/brochure/about.markdown @@ -0,0 +1,14 @@ +--- +title: About +--- +Nullam imperdiet sodales orci vitae molestie. Nunc quam orci, pharetra a +rhoncus vitae, eleifend id felis. Suspendisse potenti. Etiam vitae urna orci. +Quisque pellentesque dignissim felis, egestas tempus urna luctus vitae. In hac +habitasse platea dictumst. Morbi fringilla mattis odio, et mattis tellus +accumsan vitae. + +Vivamus eget mauris sit amet nulla laoreet lobortis. Nulla in diam elementum +risus convallis commodo. Cras vehicula varius dui vitae facilisis. Proin +elementum libero eget leo aliquet quis euismod orci vestibulum. Duis rhoncus +lorem consequat tellus vestibulum aliquam. Quisque orci orci, malesuada porta +blandit et, interdum nec magna. diff --git a/examples/brochure/css/default.css b/examples/brochure/css/default.css new file mode 100644 index 0000000..9ed2b01 --- /dev/null +++ b/examples/brochure/css/default.css @@ -0,0 +1,17 @@ +body { + width: 600px; + margin: 0px auto 0px auto; +} + +div#navigation { + text-align: center; + border-bottom: 4px solid black; +} + +div#navigation a { + color: white; + text-decoration: none; + background-color: black; + padding: 3px 10px 3px 10px; + margin: 0px 10px 0px 10px; +} diff --git a/examples/brochure/hakyll.hs b/examples/brochure/hakyll.hs new file mode 100644 index 0000000..b2606ba --- /dev/null +++ b/examples/brochure/hakyll.hs @@ -0,0 +1,11 @@ +import Text.Hakyll (hakyll) +import Text.Hakyll.File (directory) +import Text.Hakyll.Render (css, static, renderChain) +import Text.Hakyll.Renderables (createPagePath) + +main = hakyll $ do + directory css "css" + render "about.markdown" + render "index.markdown" + render "products.markdown" + where render = renderChain ["templates/default.html"] . createPagePath diff --git a/examples/brochure/index.markdown b/examples/brochure/index.markdown new file mode 100644 index 0000000..76ed40c --- /dev/null +++ b/examples/brochure/index.markdown @@ -0,0 +1,22 @@ +--- +title: Home +--- +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempor, urna et +auctor tincidunt, eros mauris facilisis purus, eget sollicitudin leo massa sit +amet ipsum. Vivamus eu massa in urna vehicula rutrum eget sit amet purus. + +Mauris sit amet justo mi. Curabitur vel quam felis. In hac habitasse platea +dictumst. Etiam nec consequat risus. Donec consequat est vitae neque fermentum +feugiat nec ac nibh. Nulla rhoncus, odio quis scelerisque rutrum, metus sem +tempor ante, a ornare ipsum felis sed ligula. Morbi urna lectus, scelerisque +non pharetra in, rutrum quis ligula. Phasellus semper ullamcorper arcu eu +auctor. + +Aliquam sagittis tincidunt libero ut elementum. Ut sit amet vestibulum metus. +Ut aliquet congue neque eu tincidunt. Integer eu elit sed massa sollicitudin +vehicula nec ut sem. Cras euismod enim eget purus lacinia non feugiat urna +imperdiet. Aliquam justo sem, viverra eu vehicula vitae, imperdiet vel magna. + +Pellentesque enim dui, interdum elementum vehicula luctus, feugiat vitae arcu. +Vestibulum ut felis justo. Quisque vestibulum mauris eget ipsum luctus +consequat. diff --git a/examples/brochure/products.markdown b/examples/brochure/products.markdown new file mode 100644 index 0000000..64b66f3 --- /dev/null +++ b/examples/brochure/products.markdown @@ -0,0 +1,13 @@ +--- +title: Products +--- +Etiam condimentum auctor semper. Donec lobortis, magna id sodales sollicitudin, +lectus mi egestas nulla, pulvinar lobortis nunc eros id nisl. Curabitur +imperdiet, erat at accumsan vulputate, purus nunc blandit nulla, dictum +vestibulum sem lorem eget ipsum. Nunc tincidunt, turpis ut fermentum dapibus, +justo tortor bibendum sem, at facilisis justo odio luctus lectus. Quisque nec +ligula ipsum. Nunc augue lacus, ullamcorper vel dapibus in, mattis eget elit. + +Integer ut dui eu felis mollis vestibulum. Etiam at nibh id diam aliquet +vestibulum sit amet a nibh. Aliquam erat volutpat. Etiam vitae nulla at dolor +fringilla tempor ut a nunc. Pellentesque elementum elit lorem. diff --git a/examples/brochure/templates/default.html b/examples/brochure/templates/default.html new file mode 100644 index 0000000..2e41112 --- /dev/null +++ b/examples/brochure/templates/default.html @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>MyAweSomeCompany - $title</title> + <link rel="stylesheet" type="text/css" href="css/default.css" /> + </head> + <body> + <h1>MyAweSomeCompany - $title</h1> + <div id="navigation"> + <a href="index.html">Home</a> + <a href="about.html">About</a> + <a href="products.html">Products</a> + </div> + + $body + </body> +</html> diff --git a/examples/simpleblog/css/default.css b/examples/simpleblog/css/default.css new file mode 100644 index 0000000..9ed2b01 --- /dev/null +++ b/examples/simpleblog/css/default.css @@ -0,0 +1,17 @@ +body { + width: 600px; + margin: 0px auto 0px auto; +} + +div#navigation { + text-align: center; + border-bottom: 4px solid black; +} + +div#navigation a { + color: white; + text-decoration: none; + background-color: black; + padding: 3px 10px 3px 10px; + margin: 0px 10px 0px 10px; +} diff --git a/examples/simpleblog/hakyll.hs b/examples/simpleblog/hakyll.hs new file mode 100644 index 0000000..d97584b --- /dev/null +++ b/examples/simpleblog/hakyll.hs @@ -0,0 +1,34 @@ +module Main where + +import Text.Hakyll (hakyll) +import Text.Hakyll.Render (renderAndConcat, renderChain, css) +import Text.Hakyll.File (getRecursiveContents, directory) +import Text.Hakyll.Renderables (createPagePath, createCustomPage) +import Data.List (sort) +import Control.Monad (mapM_, liftM) +import Data.Either (Either(..)) + +main = hakyll $ do + -- Static directory. + directory css "css" + + -- Find all post paths. + postPaths <- liftM (reverse . sort) $ getRecursiveContents "posts" + let renderablePosts = map createPagePath postPaths + + -- Render index, including recent posts. + let recentPosts = renderAndConcat "templates/postitem.html" $ take 3 renderablePosts + renderChain ["index.html", "templates/default.html"] $ + createCustomPage "index.html" ("templates/postitem.html" : postPaths) + [("title", Left "Home"), ("posts", Right recentPosts)] + + -- Render all posts list. + let postItems = renderAndConcat "templates/postitem.html" $ renderablePosts + renderChain ["posts.html", "templates/default.html"] $ + createCustomPage "posts.html" ("templates/postitem.html" : postPaths) + [("title", Left "All posts"), ("posts", Right postItems)] + + -- Render all posts. + putStrLn "Generating posts..." + mapM_ (renderChain ["templates/post.html", "templates/default.html"]) renderablePosts + diff --git a/examples/simpleblog/index.html b/examples/simpleblog/index.html new file mode 100644 index 0000000..e628bd6 --- /dev/null +++ b/examples/simpleblog/index.html @@ -0,0 +1,14 @@ +<div id="posts"> + <h1>Recent posts</h1> + <ul> + $posts + </ul> + <a href="/posts.html">All posts...</a> +</div> + +<div class="about"> + <h1>About</h1> + <p> + This is a sample blog for educational purposes. + </p> +</div> diff --git a/examples/simpleblog/posts.html b/examples/simpleblog/posts.html new file mode 100644 index 0000000..bc1741b --- /dev/null +++ b/examples/simpleblog/posts.html @@ -0,0 +1,4 @@ +<h1>All posts</h1> +<ul> + $posts +</ul> diff --git a/examples/simpleblog/posts/2009-11-05-a-first-post.markdown b/examples/simpleblog/posts/2009-11-05-a-first-post.markdown new file mode 100644 index 0000000..56b0405 --- /dev/null +++ b/examples/simpleblog/posts/2009-11-05-a-first-post.markdown @@ -0,0 +1,21 @@ +--- +title: A first post +author: Julius Caesar +date: November 5, 2009 +--- +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pretium leo +adipiscing lectus iaculis lobortis. Vivamus scelerisque velit dignissim metus +gravida sit amet dapibus ligula tempor. Quisque sit amet viverra nunc. +Suspendisse cursus elementum ante, ut venenatis nisi dictum eu. Nulla diam +ligula, eleifend in varius quis, malesuada a nibh. Vivamus consequat +pellentesque erat non blandit. Nunc sit amet eros vel massa semper ullamcorper +quis iaculis magna. Vestibulum ullamcorper urna sit amet est elementum +pulvinar. Vestibulum consequat lacus ac quam hendrerit tincidunt. Praesent +bibendum vehicula diam, nec sagittis risus tempus a. Nulla quis odio sit amet +odio vehicula cursus ut id odio. Curabitur semper magna euismod magna mollis +venenatis. Nunc eget eleifend velit. Mauris sed posuere sem. Fusce id nunc +nisi, a aliquam orci. Suspendisse laoreet justo non enim laoreet eget consequat +velit porttitor. Aenean faucibus sodales metus at tincidunt. Donec vestibulum +leo pulvinar erat auctor ac ultrices massa euismod. Phasellus blandit cursus +magna, eget lacinia mi lobortis sed. Suspendisse ultricies enim ligula, vel +scelerisque mauris. diff --git a/examples/simpleblog/posts/2009-11-10-another-post.markdown b/examples/simpleblog/posts/2009-11-10-another-post.markdown new file mode 100644 index 0000000..69b64c9 --- /dev/null +++ b/examples/simpleblog/posts/2009-11-10-another-post.markdown @@ -0,0 +1,15 @@ +--- +title: Another post +author: Marcus Tullius Cicero +date: November 10, 2009 +--- +Vestibulum in ultrices urna. Etiam tempor enim dui, nec malesuada elit. Donec +tempor ligula et quam volutpat quis fermentum eros congue. Sed ut pulvinar sem. +Sed aliquam ipsum id purus sollicitudin vulputate. Cras et mauris dui, vel +hendrerit leo. Ut metus ipsum, fermentum ac malesuada id, tempus pharetra quam. +Donec diam felis, consequat ac scelerisque cursus, gravida non lectus. Sed +faucibus elit dapibus diam elementum id varius nisi tristique. Proin consequat +faucibus neque in aliquam. Vestibulum ligula odio, pulvinar vel hendrerit +vitae, egestas ut nibh. Praesent ut velit elit, in consequat dolor. Praesent +sem enim, commodo in gravida sed, adipiscing vel eros. Lorem ipsum dolor sit +amet, consectetur adipiscing elit. Proin non aliquam nunc. diff --git a/examples/simpleblog/posts/2009-11-28-a-third-post.markdown b/examples/simpleblog/posts/2009-11-28-a-third-post.markdown new file mode 100644 index 0000000..76b0606 --- /dev/null +++ b/examples/simpleblog/posts/2009-11-28-a-third-post.markdown @@ -0,0 +1,19 @@ +--- +title: A third post +author: Publius Ovidius Naso +date: November 28, 2009 +--- +Pellentesque tempor blandit elit, vel ultricies arcu congue egestas. Fusce +vitae rutrum nisl. Fusce id mauris libero, a venenatis tellus. Fusce iaculis, +lorem et ornare molestie, mauris risus mollis nisi, non fermentum lacus lacus +sit amet ipsum. Praesent lobortis ullamcorper dolor, eget convallis ligula +dignissim a. Suspendisse nulla nisi, congue et pharetra vel, convallis non +libero. Ut a nulla ipsum. Phasellus cursus velit id neque viverra ut +pellentesque justo posuere. Curabitur laoreet enim et velit tempor consectetur. +Donec eu pretium urna. Suspendisse vitae nisi at metus vestibulum aliquam in +sit amet nisl. Donec convallis lacinia odio, vestibulum molestie nunc feugiat +a. Suspendisse vehicula, sapien id aliquet consectetur, sem sapien ullamcorper +arcu, scelerisque porttitor elit ipsum posuere ligula. Nulla at velit eu metus +tincidunt auctor ut sit amet enim. Donec placerat dapibus nisi id facilisis. +Maecenas pellentesque pulvinar auctor. Curabitur gravida quam sit amet purus +consectetur blandit. diff --git a/examples/simpleblog/posts/2009-12-04-this-blog-aint-dead.markdown b/examples/simpleblog/posts/2009-12-04-this-blog-aint-dead.markdown new file mode 100644 index 0000000..015ce8d --- /dev/null +++ b/examples/simpleblog/posts/2009-12-04-this-blog-aint-dead.markdown @@ -0,0 +1,12 @@ +--- +title: This blog ain't dead +author: Marcus Antonius +date: December 4, 2009 +--- +Etiam non felis aliquet tellus dictum vestibulum. Aliquam accumsan mauris non +lacus ultricies nec lacinia enim rhoncus. Curabitur vel tortor massa, elementum +tincidunt elit. Maecenas venenatis luctus arcu ut ullamcorper. Donec interdum +dolor eu enim tristique vel vehicula risus mollis. Nunc nec tortor quam. Nulla +a mauris arcu. Phasellus venenatis tortor vel odio tincidunt consequat. Integer +venenatis nibh vitae lectus laoreet eu feugiat nunc pretium. Integer nec turpis +metus, in fermentum lorem. diff --git a/examples/simpleblog/posts/2009-12-23-almost-christmas.markdown b/examples/simpleblog/posts/2009-12-23-almost-christmas.markdown new file mode 100644 index 0000000..cf24399 --- /dev/null +++ b/examples/simpleblog/posts/2009-12-23-almost-christmas.markdown @@ -0,0 +1,13 @@ +--- +title: Almost Christmas! +author: Publius Vergilius Maro +date: December 23, 2009 +--- +Morbi tincidunt eleifend ante, eu gravida ante rutrum vel. Nunc bibendum nulla +tellus, eget egestas sapien. Nam rhoncus interdum libero, eget congue orci +imperdiet eu. Quisque pellentesque fringilla urna, ac venenatis ante ultricies +et. Pellentesque habitant morbi tristique senectus et netus et malesuada fames +ac turpis egestas. Mauris eleifend sagittis ultrices. Quisque ultrices accumsan +nisl, sed pellentesque metus porta vitae. Nulla facilisi. In et nibh tincidunt +mi volutpat pellentesque vitae nec sapien. Integer massa ipsum, pellentesque in +elementum at, cursus sit amet diam. diff --git a/examples/simpleblog/templates/default.html b/examples/simpleblog/templates/default.html new file mode 100644 index 0000000..5fd7cc8 --- /dev/null +++ b/examples/simpleblog/templates/default.html @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>SimpleBlog - $title</title> + <link rel="stylesheet" type="text/css" href="/css/default.css" /> + </head> + <body> + <h1>SimpleBlog - $title</h1> + <div id="navigation"> + <a href="/index.html">Home</a> + <a href="/posts.html">All posts</a> + </div> + + $body + </body> +</html> diff --git a/examples/simpleblog/templates/post.html b/examples/simpleblog/templates/post.html new file mode 100644 index 0000000..46797a4 --- /dev/null +++ b/examples/simpleblog/templates/post.html @@ -0,0 +1,4 @@ +<h1>$title</h1> +by <em>$author</em> on <strong>$date</strong> + +$body diff --git a/examples/simpleblog/templates/postitem.html b/examples/simpleblog/templates/postitem.html new file mode 100644 index 0000000..a14687b --- /dev/null +++ b/examples/simpleblog/templates/postitem.html @@ -0,0 +1,4 @@ +<li> + <a href="/$url">$title</a> + - <em>$date</em> - by <em>$author</em> +</li> diff --git a/hakyll.cabal b/hakyll.cabal index fd69539..d5a607c 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -3,8 +3,8 @@ Version: 0.3.2 Synopsis: A simple static site generator library. Description: - A simple static site generator library , mainly aimed at - creating blogs. + 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 |