summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-12-14 12:12:28 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-12-14 12:12:28 +0100
commitadc8cf8528e7c9d95e2a8406a02e69cce858f088 (patch)
tree7f55b9adb2b74ba1d2c63f6c6114e6fa32b22264
parenta2620eec367711480ee2e34ada39b76dc52dbb17 (diff)
downloadhakyll-adc8cf8528e7c9d95e2a8406a02e69cce858f088.tar.gz
Docs
-rw-r--r--src/Hakyll/Core/Identifier/Pattern.hs35
-rw-r--r--web/tutorials/02-basics.markdown54
2 files changed, 28 insertions, 61 deletions
diff --git a/src/Hakyll/Core/Identifier/Pattern.hs b/src/Hakyll/Core/Identifier/Pattern.hs
index 61efc65..eb79c6e 100644
--- a/src/Hakyll/Core/Identifier/Pattern.hs
+++ b/src/Hakyll/Core/Identifier/Pattern.hs
@@ -1,40 +1,33 @@
--------------------------------------------------------------------------------
--- | Module providing pattern matching and capturing on 'Identifier's.
--- 'Pattern's come in two kinds:
+-- | As 'Identifier' is used to specify a single item, a 'Pattern' is used to
+-- specify a list of items.
--
--- * Simple glob patterns, like @foo\/*@;
+-- In most cases, globs are used for patterns.
--
--- * Custom, arbitrary predicates of the type @Identifier -> Bool@.
---
--- They both have advantages and disadvantages. By default, globs are used,
--- unless you construct your 'Pattern' using the 'predicate' function.
---
--- A very simple pattern could be, for example, @foo\/bar@. This pattern will
+-- A very simple pattern of such a pattern is @\"foo\/bar\"@. This pattern will
-- only match the exact @foo\/bar@ identifier.
--
-- To match more than one identifier, there are different captures that one can
-- use:
--
--- * @*@: matches at most one element of an identifier;
+-- * @\"*\"@: matches at most one element of an identifier;
--
--- * @**@: matches one or more elements of an identifier.
+-- * @\"**\"@: matches one or more elements of an identifier.
--
-- Some examples:
--
--- * @foo\/*@ will match @foo\/bar@ and @foo\/foo@, but not @foo\/bar\/qux@;
+-- * @\"foo\/*\"@ will match @\"foo\/bar\"@ and @\"foo\/foo\"@, but not
+-- @\"foo\/bar\/qux\"@;
--
--- * @**@ will match any identifier;
+-- * @\"**\"@ will match any identifier;
--
--- * @foo\/**@ will match @foo\/bar@ and @foo\/bar\/qux@, but not @bar\/foo@;
+-- * @\"foo\/**\"@ will match @\"foo\/bar\"@ and @\"foo\/bar\/qux\"@, but not
+-- @\"bar\/foo\"@;
--
--- * @foo\/*.html@ will match all HTML files in the @foo\/@ directory.
+-- * @\"foo\/*.html\"@ will match all HTML files in the @\"foo\/\"@ directory.
--
-- The 'capture' function allows the user to get access to the elements captured
-- by the capture elements in the pattern.
---
--- Like an 'Identifier', a 'Pattern' also has a type parameter. This is simply
--- an extra layer of safety, and can be discarded using the 'castPattern'
--- function.
module Hakyll.Core.Identifier.Pattern
( -- * The pattern type
Pattern
@@ -213,8 +206,8 @@ withVersion p v = optimize $ And p $ fromVersion $ Just v
--------------------------------------------------------------------------------
--- | Check if a pattern is a literal. @"*.markdown"@ is not a literal but
--- @"posts.markdown"@ is.
+-- | Check if a pattern is a literal. @\"*.markdown\"@ is not a literal but
+-- @\"posts.markdown\"@ is.
fromLiteral :: Pattern -> Maybe Identifier
fromLiteral pattern = case pattern of
Glob p -> fmap fromFilePath $ foldr fromLiteral' (Just "") p
diff --git a/web/tutorials/02-basics.markdown b/web/tutorials/02-basics.markdown
index 79cbe30..f29b549 100644
--- a/web/tutorials/02-basics.markdown
+++ b/web/tutorials/02-basics.markdown
@@ -3,52 +3,26 @@ title: The basics
author: Jasper Van der Jeugt
---
-## Let's get started!
+Building and cleaning
+---------------------
-We're going to discuss a small brochure site to start with. You can find all
-code and files necessary to build this site
-[right here](http://github.com/jaspervdj/hakyll-examples/tree/master/brochure)
--- feel free to look at them as we go trough the tutorial. To fetch all examples
-in order to play with them locally, use:
+If you followed along with the previous tutorial, you should now have the
+example site up and running. By running `./site build`, you created two
+directories:
- git clone git://github.com/jaspervdj/hakyll-examples.git
+- `_site`, with your site as HTML files, ready to be deployed;
+- `_cache`, which Hakyll uses internally.
-or navigate to the download menu on GitHub.
+`./site clean` removes these directories, and `./site rebuild` performs a
+`clean` and then a `build`.
-Now, for this first tutorial, there's a number of files we will use:
+In general, it's only necessary to use `rebuild` when you made changes to your
+`site.hs`, and not when you just made changes to the contents of your website.
- about.rst A simple page written in RST format
- code.lhs Another page with some code (which can be highlighted)
- css Directory for CSS files
- |- default.css The main CSS file
- \- syntax.css CSS file for code syntax highlighting
- hakyll.hs Our code to generate the site
- images Directory for images
- \- haskell-logo.png The logo of my favorite programming language
- index.markdown A simple page in markdown format
- templates Directory for templates
- \- default.html The main template for the site
+Basic rules
+-----------
-By default, hakyll will compile everything to the `_site` directory. We can try
-this like this:
-
- [jasper@phoenix] ghc --make hakyll.hs
- [jasper@phoenix] ./hakyll build
-
-Instead of using `build`, we can also use `preview`, which will fire up a
-webserver serving the `_site` directory, so have a look!
-
-All files have been compiled, and their output has been placed in the `_site`
-directory as illustrated in this diagram:
-
-![Brochure files](/images/brochure-files.png)
-
-No magic is involved at all -- we will precisely study how and why our items are
-compiled like that. All of this is specified in the `hakyll.hs` file. You can
-view the full `hakyll.hs` file online [here][brochure-hakyll.hs], or you can
-look in the directory you cloned or downloaded.
-
-[brochure-hakyll.hs]: http://github.com/jaspervdj/hakyll-examples/blob/master/brochure/hakyll.hs
+TODO
## Images