diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-23 18:22:16 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-23 18:22:16 +0100 |
commit | 10328b890cee125d8b5bd1c2a0a8d3b2489c4267 (patch) | |
tree | 292fb9e9f50f1ceb43f242096531008dbde4017b /src | |
parent | 3fdf8ab204cfc6f60a250b8ef0cccce8e82a4bcf (diff) | |
download | hakyll-10328b890cee125d8b5bd1c2a0a8d3b2489c4267.tar.gz |
Document the pattern module a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll/Core/Identifier/Pattern.hs | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Identifier/Pattern.hs b/src/Hakyll/Core/Identifier/Pattern.hs index 02b023f..28c31f2 100644 --- a/src/Hakyll/Core/Identifier/Pattern.hs +++ b/src/Hakyll/Core/Identifier/Pattern.hs @@ -1,6 +1,35 @@ -- | Module providing pattern matching and capturing on 'Identifier's. -- --- TODO: Documentation +-- A very simple pattern could be, for example: +-- +-- > foo/bar +-- +-- This pattern will only match the @foo\/bar@ identifier. +-- +-- To match more than one identifier, there are different captures that one can +-- use: +-- +-- * @*@: matches exactly one element 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@ nor +-- @foo@; +-- +-- * @**@ will match any non-empty identifier; +-- +-- * @foo\/**@ will match @foo\/bar@ and @foo\/bar\/qux@, but not @bar\/foo@ nor +-- @foo@; +-- +-- A small warning: patterns are not globs. Using @foo\/*.markdown@ will not do +-- what you probably intended, as it will only match the file which is literally +-- called @foo\/*.markdown@. Remember that these captures only work on elements +-- of identifiers as a whole; not on parts of these elements. +-- +-- Furthermore, the 'match' function allows the user to get access to the +-- elements captured by the capture elements in the pattern. -- module Hakyll.Core.Identifier.Pattern ( Pattern |