summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-12 15:16:42 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-12 15:16:42 +0100
commit645ac84b636f1a7725f032c2eeff68214aacda64 (patch)
tree33f4038e09200bcd81b361b2f66fb1c81e510c72
parent6e2cc769289990a6fbe68d50598646008e3f8aa6 (diff)
downloadhakyll-645ac84b636f1a7725f032c2eeff68214aacda64.tar.gz
Update hakyll site to hakyll3
-rw-r--r--examples/hakyll/css/default.css4
-rw-r--r--examples/hakyll/hakyll.hs77
-rw-r--r--examples/hakyll/sidebar.markdown13
-rw-r--r--examples/hakyll/templates/default.html14
-rw-r--r--examples/hakyll/tutorial.markdown5
5 files changed, 64 insertions, 49 deletions
diff --git a/examples/hakyll/css/default.css b/examples/hakyll/css/default.css
index 0e9462c..f895f48 100644
--- a/examples/hakyll/css/default.css
+++ b/examples/hakyll/css/default.css
@@ -75,6 +75,10 @@ h3 {
text-transform: uppercase;
}
+h1 a, h2 a, h3 a {
+ text-decoration: none;
+}
+
div.column {
width: 50%;
float: left;
diff --git a/examples/hakyll/hakyll.hs b/examples/hakyll/hakyll.hs
index ca4cd6e..92f24c7 100644
--- a/examples/hakyll/hakyll.hs
+++ b/examples/hakyll/hakyll.hs
@@ -1,39 +1,50 @@
-import Text.Hakyll
-import Text.Hakyll.Render
-import Text.Hakyll.File
-import Text.Hakyll.CreateContext
-import Control.Monad.Reader (liftIO)
-import System.Directory
-import Control.Monad (mapM_, forM_, liftM)
-import Data.List (sort)
+{-# LANGUAGE OverloadedStrings #-}
+import Hakyll
+import Control.Monad (forM_)
+import Control.Arrow ((>>>), arr)
+import Text.Pandoc (writerTableOfContents, writerTemplate, writerStandalone)
-main = hakyll "http://jaspervdj.be/hakyll" $ do
- directory css "css"
- directory static "images"
- directory static "examples"
- directory static "reference"
+main :: IO ()
+main = hakyll $ do
+ route "css/*" idRoute
+ compile "css/*" defaultCompressCss
- tutorials <- liftM sort $ getRecursiveContents "tutorials"
- let tutorialPage = createListing "tutorials.html"
- ["templates/tutorialitem.html"]
- (map createPage tutorials)
- [("title", Left "Tutorials")]
- renderChain ["templates/tutorials.html", "templates/default.html"]
- (withSidebar tutorialPage)
+ -- Static directories
+ forM_ ["images/*", "examples/*", "reference/*"] $ \f -> do
+ route f idRoute
+ compile f defaultCopyFile
- mapM_ (render' ["templates/default.html"]) $
- [ "about.markdown"
- , "index.markdown"
- , "philosophy.markdown"
- , "reference.markdown"
- , "changelog.markdown"
- ]
+ -- Pages
+ forM_ pages $ \p -> do
+ route p $ setExtension "html"
+ compile p $ defaultPageRead
+ >>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
+ >>> defaultApplyTemplate "templates/default.html"
+ >>> defaultRelativizeUrls
- forM_ tutorials $ render' [ "templates/tutorial.html"
- , "templates/default.html"
- ]
+ -- Tutorial
+ route "tutorial.markdown" $ setExtension "html"
+ compile "tutorial.markdown" $ pageRead
+ >>> pageRenderPandocWith defaultParserState withToc
+ >>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
+ >>> defaultApplyTemplate "templates/default.html"
+ >>> defaultRelativizeUrls
+ -- Sidebar
+ compile "sidebar.markdown" defaultPageRead
+
+ -- Templates
+ compile "templates/*" defaultTemplateRead
where
- render' templates = renderChain templates . withSidebar . createPage
- withSidebar a = a `combine` createPage "sidebar.markdown"
-
+ withToc = defaultWriterOptions
+ { writerTableOfContents = True
+ , writerTemplate = "<h2>Table of contents</h2>\n$toc$\n$body$"
+ , writerStandalone = True
+ }
+
+ pages = [ "about.markdown"
+ , "changelog.markdown"
+ , "index.markdown"
+ , "philosophy.markdown"
+ , "reference.markdown"
+ ]
diff --git a/examples/hakyll/sidebar.markdown b/examples/hakyll/sidebar.markdown
index 9444c58..fb40b5d 100644
--- a/examples/hakyll/sidebar.markdown
+++ b/examples/hakyll/sidebar.markdown
@@ -1,9 +1,8 @@
---- sidebar
## Navigation
-[home]($root/index.html)
-[philosophy]($root/philosophy.html)
-[about]($root/about.html)
-[tutorials]($root/tutorials.html)
-[reference]($root/reference.html)
-[changelog]($root/changelog.html)
+[home](/index.html)
+[philosophy](/philosophy.html)
+[about](/about.html)
+[tutorial](/tutorial.html)
+[reference](/reference.html)
+[changelog](/changelog.html)
diff --git a/examples/hakyll/templates/default.html b/examples/hakyll/templates/default.html
index 2e94f72..139564b 100644
--- a/examples/hakyll/templates/default.html
+++ b/examples/hakyll/templates/default.html
@@ -4,11 +4,11 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Hakyll - $title</title>
+ <title>Hakyll - $title$</title>
<!-- Stylesheets. -->
- <link rel="stylesheet" type="text/css" href="$root/css/default.css" />
- <link rel="stylesheet" type="text/css" href="$root/css/syntax.css" />
+ <link rel="stylesheet" type="text/css" href="/css/default.css" />
+ <link rel="stylesheet" type="text/css" href="/css/syntax.css" />
<!-- Metadata. -->
<meta name="keywords" content="hakyll,static site generator,static,site,generator,haskell,blog"/>
@@ -17,16 +17,16 @@
<body>
<div id="main">
<div id="header">
- <img src="$root/images/lambda.png" alt="lambda" />
- <h1>Hakyll - $title</h1>
+ <img src="/images/lambda.png" alt="lambda" />
+ <h1>Hakyll - $title$</h1>
</div>
<!-- Sidebar. -->
<div id="sidebar">
- $sidebar
+ $sidebar$
</div>
<div id="content">
- $body
+ $body$
</div>
<div id="footer">
diff --git a/examples/hakyll/tutorial.markdown b/examples/hakyll/tutorial.markdown
index 872bc6d..b3892d5 100644
--- a/examples/hakyll/tutorial.markdown
+++ b/examples/hakyll/tutorial.markdown
@@ -1,5 +1,6 @@
-The Hakyll Tutorial
-===================
+---
+title: Tutorial
+---
Why static websites?
--------------------