Added some different formats in the first example as a demonstration.

This commit is contained in:
Jasper Van der Jeugt 2010-01-24 19:38:23 +01:00
parent fe7182d288
commit 81e3df1e11
7 changed files with 56 additions and 18 deletions

View file

@ -5,7 +5,10 @@ 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. 碁
accumsan vitae.
1. Amamus Unicode 碁
2. Interdum nex magna.
Vivamus eget mauris sit amet nulla laoreet lobortis. Nulla in diam elementum
risus convallis commodo. Cras vehicula varius dui vitae facilisis. Proin

View file

@ -1,13 +1,21 @@
---
title: Products
title: Code
---
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
imperdiet, erat at accumsan vulputate.
> reverse' [] = []
> reverse' (x:xs) = (reverse' xs) ++ [x]
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.
> main = print $ reverse' [1 .. 10]
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.

View file

@ -0,0 +1,20 @@
/* Generated by pandoc. */
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
td.sourceCode { padding-left: 5px; }
pre.sourceCode { }
pre.sourceCode span.Normal { }
pre.sourceCode span.Keyword { color: #007020; font-weight: bold; }
pre.sourceCode span.DataType { color: #902000; }
pre.sourceCode span.DecVal { color: #40a070; }
pre.sourceCode span.BaseN { color: #40a070; }
pre.sourceCode span.Float { color: #40a070; }
pre.sourceCode span.Char { color: #4070a0; }
pre.sourceCode span.String { color: #4070a0; }
pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }
pre.sourceCode span.Others { color: #007020; }
pre.sourceCode span.Alert { color: red; font-weight: bold; }
pre.sourceCode span.Function { color: #06287e; }
pre.sourceCode span.RegionMarker { }
pre.sourceCode span.Error { color: red; font-weight: bold; }

View file

@ -5,7 +5,7 @@ import Text.Hakyll.Renderables (createPagePath)
main = hakyll $ do
directory css "css"
render "about.markdown"
render "about.rst"
render "index.markdown"
render "products.markdown"
render "code.lhs"
where render = renderChain ["templates/default.html"] . createPagePath

View file

@ -5,8 +5,11 @@ 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
- 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

View file

@ -6,13 +6,14 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MyAweSomeCompany - $title</title>
<link rel="stylesheet" type="text/css" href="$root/css/default.css" />
<link rel="stylesheet" type="text/css" href="$root/css/syntax.css" />
</head>
<body>
<h1>MyAweSomeCompany - $title</h1>
<div id="navigation">
<a href="$root/index.html">Home</a>
<a href="$root/about.html">About</a>
<a href="$root/products.html">Products</a>
<a href="$root/code.html">Code</a>
</div>
$body

View file

@ -61,10 +61,10 @@ it will generate a very nice main function.
## Pages
An important concept in Hakyll is Pages. Pages are text files that can be
written in markdown, html or TeX. Furthermore, they can also contain some
metadata. The metadata is placed in the file header and surrouded by `---`
lines. Each line should contain a `key: value` pair. Let's have a look at the
`about.markdown` page.
written in markdown, html, rst... basically anything Pandoc supports.
Furthermore, they can also contain some metadata. The metadata is placed in the
file header and surrouded by `---` lines. Each line should contain a
`key: value` pair. Let's have a look at the `index.markdown` page.
---
title: About
@ -91,13 +91,15 @@ html files) containing a number of keys. The syntax for these keys is
<title>MyAweSomeCompany - $title</title>
<link rel="stylesheet" type="text/css"
href="$$root/css/default.css" />
<link rel="stylesheet" type="text/css"
href="$$root/css/syntax.css" />
</head>
<body>
<h1>MyAweSomeCompany - $title</h1>
<div id="navigation">
<a href="$$root/index.html">Home</a>
<a href="$$root/about.html">About</a>
<a href="$$root/products.html">Products</a>
<a href="$$root/code.html">Code</a>
</div>
$body
@ -135,7 +137,7 @@ import Text.Hakyll.Render (renderChain)
import Text.Hakyll.Renderables (createPagePath)
main = hakyll $ do
renderChain ["templates/default.html"]
(createPagePath "about.markdown")
(createPagePath "index.markdown")
~~~~~
Or, to render all our three pages:
@ -145,19 +147,20 @@ import Text.Hakyll (hakyll)
import Text.Hakyll.Render (renderChain)
import Text.Hakyll.Renderables (createPagePath)
main = hakyll $ do
render "about.markdown"
render "about.rst"
render "index.markdown"
render "products.markdown"
render "code.lhs"
where render = renderChain ["templates/default.html"]
. createPagePath
~~~~~
This will create the following files:
As you can see, we can render a variety of formats. This will create the
following files:
~~~~~
_site/about.html
_site/index.html
_site/products.html
_site/code.html
~~~~~
## CSS, images and other static files