summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-04-13 17:52:22 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-04-13 17:52:22 +0200
commit35162f9433f7f1b654de5fba2d0f932064b38da3 (patch)
tree4f5a2bd71128bc179359dc30841b4e4577a020c5 /src/Hakyll/Core
parentc463eb6a16b77558f2992f4b25eaf506a4737bf3 (diff)
downloadhakyll-35162f9433f7f1b654de5fba2d0f932064b38da3.tar.gz
Document `group` function
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r--src/Hakyll/Core/Rules.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Rules.hs b/src/Hakyll/Core/Rules.hs
index 93f5028..155e032 100644
--- a/src/Hakyll/Core/Rules.hs
+++ b/src/Hakyll/Core/Rules.hs
@@ -86,6 +86,35 @@ match pattern = RulesM . local addPredicate . unRulesM
-- | Greate a group of compilers
--
+-- Imagine you have a page that you want to render, but you also want the raw
+-- content available on your site.
+--
+-- > match "test.markdown" $ do
+-- > route $ setExtension "html"
+-- > compile pageCompiler
+-- >
+-- > match "test.markdown" $ do
+-- > route idRoute
+-- > compile copyPageCompiler
+--
+-- Will of course conflict! In this case, Hakyll will pick the first matching
+-- compiler (@pageCompiler@ in this case).
+--
+-- In case you want to have them both, you can use the 'group' function to
+-- create a new group. For example,
+--
+-- > match "test.markdown" $ do
+-- > route $ setExtension "html"
+-- > compile pageCompiler
+-- >
+-- > group "raw" $ do
+-- > match "test.markdown" $ do
+-- > route idRoute
+-- > compile copyPageCompiler
+--
+-- This will put the compiler for the raw content in a separate group
+-- (@\"raw\"@), which causes it to be compiled as well.
+--
group :: String -> Rules -> Rules
group g = RulesM . local setGroup' . unRulesM
where