@@ -33,6 +33,89 @@
34-- Because of it's simplicity, these templates can be used for more than HTML:
34-- Because of it's simplicity, these templates can be used for more than HTML:
35-- you could make, for example, CSS or JS templates as well.
35-- you could make, for example, CSS or JS templates as well.
37+-- Apart from interpolating @$key$@s from the 'Context' you can also
38+-- use the following macros:
45+-- > <b> Non-defined </b>
48+-- This example will print @Defined@ if @key@ is defined in the
49+-- context and @Non-defined@ otherwise. The @$else$@ clause is
54+-- The @for@ macro is used for enumerating 'Context' elements that are
55+-- lists, i.e. constructed using the 'listField' function. Assume that
56+-- in a context we have an element @listField \"key\" c itms@. Then
64+-- would, for each item @i@ in 'itms', lookup @$x$@ in the context @c@
65+-- with item @i@, interpolate it, and join the resulting list with
68+-- Another concrete example one may consider is the following. Given the
71+-- > listField "things" (field "thing" (return . itemBody))
72+-- > (sequence [makeItem "fruits", makeItem "vegetables"])
78+-- > fresh $thing$$sep$, and
81+-- the resulting page would look like
86+-- > fresh fruits, and
91+-- The @$sep$@ part can be omitted. Usually, you can get by using the
92+-- 'applyListTemplate' and 'applyJoinListTemplate' functions.
94+-- * @$partial(path)$@
96+-- Loads a template located in a separate file and interpolates it
97+-- under the current context.
99+-- Assuming that the file @test.html@ contains
103+-- The result of rendering
106+-- > $partial("test.html")$
109+-- is the same as the result of rendering
115+-- That is, calling @$partial$@ is equivalent to just copying and pasting
36module Hakyll.Web.Template
119module Hakyll.Web.Template
37 ( Template
120 ( Template
38 , templateCompiler
121 , templateCompiler