on master help sign in
Document the pattern module a bit
commit10328b890cee125d8b5bd1c2a0a8d3b2489c4267 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateThu 23 Dec 2010, 18:22 (16 years ago) parent3fdf8ab
1 file changed+30−1
src/Hakyll/Core/Identifier/Pattern.hs+30−1
src/Hakyll/Core/Identifier/Pattern.hs+30−1
@@ -1,6 +1,35 @@
11-- | Module providing pattern matching and capturing on 'Identifier's.
22--
3−-- TODO: Documentation
3+-- A very simple pattern could be, for example:
4+--
5+-- > foo/bar
6+--
7+-- This pattern will only match the @foo\/bar@ identifier.
8+--
9+-- To match more than one identifier, there are different captures that one can
10+-- use:
11+--
12+-- * @*@: matches exactly one element of an identifier;
13+--
14+-- * @**@: matches one or more elements of an identifier.
15+--
16+-- Some examples:
17+--
18+-- * @foo\/*@ will match @foo\/bar@ and @foo\/foo@, but not @foo\/bar\/qux@ nor
19+-- @foo@;
20+--
21+-- * @**@ will match any non-empty identifier;
22+--
23+-- * @foo\/**@ will match @foo\/bar@ and @foo\/bar\/qux@, but not @bar\/foo@ nor
24+-- @foo@;
25+--
26+-- A small warning: patterns are not globs. Using @foo\/*.markdown@ will not do
27+-- what you probably intended, as it will only match the file which is literally
28+-- called @foo\/*.markdown@. Remember that these captures only work on elements
29+-- of identifiers as a whole; not on parts of these elements.
30+--
31+-- Furthermore, the 'match' function allows the user to get access to the
32+-- elements captured by the capture elements in the pattern.
433--
534module Hakyll.Core.Identifier.Pattern
635 ( Pattern