-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A static website compiler library
--   
--   Hakyll is a static website compiler library. It provides you with the
--   tools to create a simple or advanced static website using a Haskell
--   DSL and formats such as markdown or RST. You can find more
--   information, including a tutorial, on the website:
--   
--   <ul>
--   <li><a>http://jaspervdj.be/hakyll</a></li>
--   </ul>
--   
--   If you seek assistance, there's:
--   
--   <ul>
--   <li>A google group: <a>http://groups.google.com/group/hakyll</a></li>
--   <li>An IRC channel, <tt>#hakyll</tt> on irc.libera.chat (we *do not*
--   have a channel on Freenode anymore)</li>
--   </ul>
--   
--   Additionally, there's the Haddock documentation in the different
--   modules, meant as a reference.
@package hakyll
@version 4.16.2.0


-- | Exports a datastructure for the top-level hakyll configuration
module Hakyll.Core.Configuration
data Configuration
Configuration :: FilePath -> FilePath -> FilePath -> FilePath -> (FilePath -> Bool) -> (FilePath -> Bool) -> (FilePath -> Bool) -> String -> (Configuration -> IO ExitCode) -> Bool -> String -> Int -> (FilePath -> StaticSettings) -> Configuration

-- | Directory in which the output written
[destinationDirectory] :: Configuration -> FilePath

-- | Directory where hakyll's internal store is kept
[storeDirectory] :: Configuration -> FilePath

-- | Directory in which some temporary files will be kept
[tmpDirectory] :: Configuration -> FilePath

-- | Directory where hakyll finds the files to compile. This is <tt>.</tt>
--   by default.
[providerDirectory] :: Configuration -> FilePath

-- | Function to determine ignored files
--   
--   In <a>defaultConfiguration</a>, the following files are ignored:
--   
--   <ul>
--   <li>files starting with a <tt>.</tt></li>
--   <li>files starting with a <tt>#</tt></li>
--   <li>files ending with a <tt>~</tt></li>
--   <li>files ending with <tt>.swp</tt></li>
--   </ul>
--   
--   Note that the files in <a>destinationDirectory</a> and
--   <a>storeDirectory</a> will also be ignored. Note that this is the
--   configuration parameter, if you want to use the test, you should use
--   <a>shouldIgnoreFile</a>.
[ignoreFile] :: Configuration -> FilePath -> Bool

-- | Function to determine HTML files whose links are to be checked.
--   
--   In <a>defaultConfiguration</a>, files with the <tt>.html</tt>
--   extension are checked.
[checkHtmlFile] :: Configuration -> FilePath -> Bool

-- | Function to determine files and directories that should not trigger a
--   rebuild when touched in watch mode.
--   
--   Paths are passed in relative to the providerDirectory.
--   
--   All files that are ignored by <a>ignoreFile</a> are also always
--   ignored by <a>watchIgnore</a>.
[watchIgnore] :: Configuration -> FilePath -> Bool

-- | Here, you can plug in a system command to upload/deploy your site.
--   
--   Example:
--   
--   <pre>
--   rsync -ave 'ssh -p 2217' _site jaspervdj@jaspervdj.be:hakyll
--   </pre>
--   
--   You can execute this by using
--   
--   <pre>
--   ./site deploy
--   </pre>
[deployCommand] :: Configuration -> String

-- | Function to deploy the site from Haskell.
--   
--   By default, this command executes the shell command stored in
--   <a>deployCommand</a>. If you override it, <a>deployCommand</a> will
--   not be used implicitely.
--   
--   The <a>Configuration</a> object is passed as a parameter to this
--   function.
[deploySite] :: Configuration -> Configuration -> IO ExitCode

-- | Use an in-memory cache for items. This is faster but uses more memory.
[inMemoryCache] :: Configuration -> Bool

-- | Override default host for preview server. Default is "127.0.0.1",
--   which binds only on the loopback address. One can also override the
--   host as a command line argument: ./site preview -h "0.0.0.0"
[previewHost] :: Configuration -> String

-- | Override default port for preview server. Default is 8000. One can
--   also override the port as a command line argument: ./site preview -p
--   1234
[previewPort] :: Configuration -> Int

-- | Override other settings used by the preview server. Default is
--   <a>defaultFileServerSettings</a>.
[previewSettings] :: Configuration -> FilePath -> StaticSettings

-- | Check if a file should be ignored
shouldIgnoreFile :: Configuration -> FilePath -> IO Bool

-- | Returns a function to check if a file should be ignored in watch mode
shouldWatchIgnore :: Configuration -> IO (FilePath -> IO Bool)

-- | Default configuration for a hakyll application
defaultConfiguration :: Configuration
instance Data.Default.Class.Default Hakyll.Core.Configuration.Configuration


-- | An identifier is a type used to uniquely name an item. An identifier
--   is similar to a file path, but can contain additional details (e.g.
--   item's version). Examples of identifiers are:
--   
--   <ul>
--   <li><pre>posts/foo.markdown</pre></li>
--   <li><pre>index</pre></li>
--   <li><pre>error/404</pre></li>
--   </ul>
--   
--   See <a>Identifier</a> for details.
module Hakyll.Core.Identifier

-- | A key data type to identify a compiled <a>Item</a> in the
--   <a>Store</a>. Conceptually, it's a combination of a file path and a
--   version name. The version is used only when a file is compiled within
--   a rule using the <tt>version</tt> wrapper function (the same source
--   file can be compiled into several items in the store, so the version
--   exists to distinguish them). Use functions like <a>fromFilePath</a>,
--   <a>setVersion</a>, <a>getMatches</a> to build an <a>Identifier</a>.
--   
--   <h3><b>Usage Examples</b></h3>
--   
--   Normally, compiled items are saved to the store by <a>Rules</a> with
--   an automatic, implicit identifier and loaded from the store by the
--   user in another rule with a manual, explicit identifier.
--   
--   <b>Identifiers when using match</b>. Using <a>match</a> builds an
--   implicit identifier that corresponds to the expanded, relative path of
--   the source file on disk (relative to the project directory configured
--   with <a>providerDirectory</a>):
--   
--   <pre>
--   -- e.g. file on disk: 'posts/hakyll.md'
--   match "posts/*" $ do                                          -- saved with implicit identifier 'posts/hakyll.md'
--       compile pandocCompiler
--   
--   match "about/*" $ do
--       compile $ do
--           compiledPost &lt;- load (fromFilePath "posts/hakyll.md") -- load with explicit identifier
--           ...
--   </pre>
--   
--   Normally, the identifier is only explicitly created to pass to one of
--   the <a>load</a> functions.
--   
--   <b>Identifiers when using create</b>. Using <a>create</a> (thereby
--   inventing a file path with no underlying file on disk) builds an
--   implicit identifier that corresponds to the invented file path:
--   
--   <pre>
--   create ["index.html"] $ do                                -- saved with implicit identifier 'index.html'
--       compile $ makeItem ("Hello world" :: String)
--   
--   match "about/*" $ do
--       compile $ do
--           compiledIndex &lt;- load (fromFilePath "index.html") -- load with an explicit identifier
--           ...
--   </pre>
--   
--   <b>Identifiers when using versions</b>. With <a>version</a> the same
--   file can be compiled into several items in the store. A version name
--   is needed to distinguish them:
--   
--   <pre>
--   -- e.g. file on disk: 'posts/hakyll.md'
--   match "posts/*" $ do                              -- saved with implicit identifier ('posts/hakyll.md', no-version)
--       compile pandocCompiler
--   
--   match "posts/*" $ version "raw" $ do              -- saved with implicit identifier ('posts/hakyll.md', version <tt>raw</tt>)
--       compile getResourceBody
--   
--   match "about/*" $ do
--       compile $ do
--           compiledPost &lt;- load (fromFilePath "posts/hakyll.md")                      -- load no-version version
--           rawPost &lt;- load . setVersion (Just "raw") $ fromFilePath "posts/hakyll.md" -- load version <tt>raw</tt>
--       ...
--   </pre>
--   
--   Use <a>setVersion</a> to set (or replace) the version of an identifier
--   like <tt>fromFilePath "posts/hakyll.md"</tt>.
data Identifier

-- | Parse an identifier from a file path string. For example,
--   
--   <pre>
--   -- e.g. file on disk: 'posts/hakyll.md'
--   match "posts/*" $ do                                          -- saved with implicit identifier 'posts/hakyll.md'
--       compile pandocCompiler
--   
--   match "about/*" $ do
--       compile $ do
--           compiledPost &lt;- load (fromFilePath "posts/hakyll.md") -- load with explicit identifier
--           ...
--   </pre>
fromFilePath :: FilePath -> Identifier

-- | Convert an identifier back to a relative <a>FilePath</a>.
toFilePath :: Identifier -> FilePath
identifierVersion :: Identifier -> Maybe String

-- | Set or override the version of an identifier in order to specify which
--   version of an <a>Item</a> to <a>load</a> from the <a>Store</a>. For
--   example,
--   
--   <pre>
--   match "posts/*" $ version "raw" $ do              -- saved with implicit identifier ('posts/hakyll.md', version <tt>raw</tt>)
--       compile getResourceBody
--   
--   match "about/*" $ do
--       compile $ do
--           rawPost &lt;- load . setVersion (Just "raw") $ fromFilePath "posts/hakyll.md" -- load version <tt>raw</tt>
--           ...
--   </pre>
setVersion :: Maybe String -> Identifier -> Identifier
instance GHC.Classes.Ord Hakyll.Core.Identifier.Identifier
instance GHC.Classes.Eq Hakyll.Core.Identifier.Identifier
instance Data.Binary.Class.Binary Hakyll.Core.Identifier.Identifier
instance Data.String.IsString Hakyll.Core.Identifier.Identifier
instance Control.DeepSeq.NFData Hakyll.Core.Identifier.Identifier
instance GHC.Show.Show Hakyll.Core.Identifier.Identifier


-- | Produce pretty, thread-safe logs
module Hakyll.Core.Logger
data Verbosity
Error :: Verbosity
Message :: Verbosity
Debug :: Verbosity
data Logger

-- | Create a new logger
new :: Verbosity -> IO Logger

-- | Flush the logger (blocks until flushed)
flush :: Logger -> forall m. MonadIO m => m ()
error :: MonadIO m => Logger -> String -> m ()
header :: MonadIO m => Logger -> String -> m ()
message :: MonadIO m => Logger -> String -> m ()
debug :: MonadIO m => Logger -> String -> m ()

-- | Create a new logger that just stores all the messages, useful for
--   writing tests.
newInMem :: IO (Logger, IO [(Verbosity, String)])
instance GHC.Show.Show Hakyll.Core.Logger.Verbosity
instance GHC.Classes.Ord Hakyll.Core.Logger.Verbosity
instance GHC.Classes.Eq Hakyll.Core.Logger.Verbosity


-- | A store for storing and retreiving items
module Hakyll.Core.Store
data Store

-- | Result of a store query
data Result a

-- | Found, result
Found :: a -> Result a

-- | Not found
NotFound :: Result a

-- | Expected, true type
WrongType :: TypeRep -> TypeRep -> Result a

-- | Convert result to <a>Maybe</a>
toMaybe :: Result a -> Maybe a

-- | Initialize the store
new :: Bool -> FilePath -> IO Store

-- | Store an item
set :: (Binary a, Typeable a) => Store -> [String] -> a -> IO ()

-- | Load an item
get :: forall a. (Binary a, Typeable a) => Store -> [String] -> IO (Result a)

-- | Strict function
isMember :: Store -> [String] -> IO Bool

-- | Delete an item
delete :: Store -> [String] -> IO ()

-- | Mostly meant for internal usage
hash :: [String] -> String
instance GHC.Classes.Eq a => GHC.Classes.Eq (Hakyll.Core.Store.Result a)
instance GHC.Show.Show a => GHC.Show.Show (Hakyll.Core.Store.Result a)
instance GHC.Show.Show Hakyll.Core.Store.Store


-- | A module containing various file utility functions
module Hakyll.Core.Util.File

-- | Given a path to a file, try to make the path writable by making all
--   directories on the path.
makeDirectories :: FilePath -> IO ()

-- | Get all contents of a directory.
getRecursiveContents :: (FilePath -> IO Bool) -> FilePath -> IO [FilePath]
removeDirectory :: FilePath -> IO ()


-- | Miscellaneous string manipulation functions.
module Hakyll.Core.Util.String

-- | Trim a string (drop spaces, tabs and newlines at both sides).
trim :: String -> String

-- | A simple (but inefficient) regex replace funcion
replaceAll :: String -> (String -> String) -> String -> String

-- | A simple regex split function. The resulting list will contain no
--   empty strings.
splitAll :: String -> String -> [String]

-- | Find the first instance of needle (must be non-empty) in haystack. We
--   return the prefix of haystack before needle is matched.
--   
--   Examples:
--   
--   <pre>
--   needlePrefix "cd" "abcde" = "ab"
--   </pre>
--   
--   <pre>
--   needlePrefix "ab" "abc" = ""
--   </pre>
--   
--   <pre>
--   needlePrefix "ab" "xxab" = "xx"
--   </pre>
--   
--   <pre>
--   needlePrefix "a" "xx" = "xx"
--   </pre>
needlePrefix :: String -> String -> Maybe String

-- | Translate native Windows path separators <tt>\\</tt> to <a>/</a> if
--   present.
removeWinPathSeparator :: String -> String


-- | As <a>Identifier</a> is used to specify a single item, a
--   <a>Pattern</a> is used to specify a list of items.
--   
--   In most cases, globs are used for patterns.
--   
--   A very simple pattern of such a pattern is <tt>"foo/bar"</tt>. This
--   pattern will only match the exact <tt>foo/bar</tt> identifier.
--   
--   To match more than one identifier, there are different captures that
--   one can use:
--   
--   <ul>
--   <li><tt>"*"</tt>: matches at most one element of an identifier;</li>
--   <li><tt>"**"</tt>: matches one or more elements of an identifier.</li>
--   </ul>
--   
--   Some examples:
--   
--   <ul>
--   <li><tt>"foo/*"</tt> will match <tt>"foo/bar"</tt> and
--   <tt>"foo/foo"</tt>, but not <tt>"foo/bar/qux"</tt>;</li>
--   <li><tt>"**"</tt> will match any identifier;</li>
--   <li><tt>"foo/**"</tt> will match <tt>"foo/bar"</tt> and
--   <tt>"foo/bar/qux"</tt>, but not <tt>"bar/foo"</tt>;</li>
--   <li><tt>"foo/*.html"</tt> will match all HTML files in the
--   <tt>"foo/"</tt> directory.</li>
--   </ul>
--   
--   The <a>capture</a> function allows the user to get access to the
--   elements captured by the capture elements in a glob or regex pattern.
module Hakyll.Core.Identifier.Pattern

-- | Type that allows matching on identifiers
data Pattern

-- | Parse a pattern from a string
fromGlob :: String -> Pattern

-- | Create a <a>Pattern</a> from a list of <a>Identifier</a>s it should
--   match.
--   
--   <i>Warning</i>: use this carefully with <a>hasNoVersion</a> and
--   <a>hasVersion</a>. The <a>Identifier</a>s in the list <i>already</i>
--   have versions assigned, and the pattern will then only match the
--   intersection of both versions.
--   
--   A more concrete example,
--   
--   <pre>
--   fromList ["foo.markdown"] .&amp;&amp;. hasVersion "pdf"
--   </pre>
--   
--   will not match anything! The <tt>"foo.markdown"</tt> <a>Identifier</a>
--   has no version assigned, so the LHS of <a>.&amp;&amp;.</a> will only
--   match this <a>Identifier</a> with no version. The RHS only matches
--   <a>Identifier</a>s with version set to <tt>"pdf"</tt> -- hence, this
--   pattern matches nothing.
--   
--   The correct way to use this is:
--   
--   <pre>
--   fromList $ map (setVersion $ Just "pdf") ["foo.markdown"]
--   </pre>
fromList :: [Identifier] -> Pattern

-- | Create a <a>Pattern</a> from a regex
--   
--   Example:
--   
--   <pre>
--   regex "^foo/[^x]*$
--   </pre>
fromRegex :: String -> Pattern

-- | Create a pattern which matches all items with the given version.
fromVersion :: Maybe String -> Pattern

-- | Specify a version, e.g.
--   
--   <pre>
--   "foo/*.markdown" .&amp;&amp;. hasVersion "pdf"
--   </pre>
hasVersion :: String -> Pattern

-- | Match only if the identifier has no version set, e.g.
--   
--   <pre>
--   "foo/*.markdown" .&amp;&amp;. hasNoVersion
--   </pre>
hasNoVersion :: Pattern

-- | <a>&amp;&amp;</a> for patterns: the given identifier must match both
--   subterms
(.&&.) :: Pattern -> Pattern -> Pattern
infixr 3 .&&.

-- | <a>||</a> for patterns: the given identifier must match any subterm
(.||.) :: Pattern -> Pattern -> Pattern
infixr 2 .||.

-- | Inverts a pattern, e.g.
--   
--   <pre>
--   complement "foo/bar.html"
--   </pre>
--   
--   will match <i>anything</i> except <tt>"foo/bar.html"</tt>
complement :: Pattern -> Pattern

-- | Check if an identifier matches a pattern
matches :: Pattern -> Identifier -> Bool

-- | Given a list of identifiers, retain only those who match the given
--   pattern
filterMatches :: Pattern -> [Identifier] -> [Identifier]

-- | Match a glob or regex pattern against an identifier, generating a list
--   of captures
capture :: Pattern -> Identifier -> Maybe [String]

-- | Create an identifier from a pattern by filling in the captures with a
--   given string
--   
--   Example:
--   
--   <pre>
--   fromCapture (fromGlob "tags/*") "foo"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   "tags/foo"
--   </pre>
fromCapture :: Pattern -> String -> Identifier

-- | Create an identifier from a pattern by filling in the captures with
--   the given list of strings
fromCaptures :: Pattern -> [String] -> Identifier
instance Data.String.IsString Hakyll.Core.Identifier.Pattern.Internal.Pattern

module Hakyll.Core.Dependencies
data Dependency
PatternDependency :: Pattern -> Set Identifier -> Dependency
IdentifierDependency :: Identifier -> Dependency
AlwaysOutOfDate :: Dependency
type DependencyFacts = Map Identifier [Dependency]
outOfDate :: [Identifier] -> Set Identifier -> DependencyFacts -> (Set Identifier, DependencyFacts, [String])
instance GHC.Show.Show Hakyll.Core.Dependencies.Dependency
instance GHC.Show.Show Hakyll.Core.Dependencies.DependencyState
instance GHC.Show.Show Hakyll.Core.Dependencies.Dependencies
instance GHC.Base.Semigroup Hakyll.Core.Dependencies.Dependencies
instance GHC.Base.Monoid Hakyll.Core.Dependencies.Dependencies
instance Data.Binary.Class.Binary Hakyll.Core.Dependencies.Dependency

module Hakyll.Core.Metadata
type Metadata = Object
lookupString :: String -> Metadata -> Maybe String
lookupStringList :: String -> Metadata -> Maybe [String]
class Monad m => MonadMetadata m
getMetadata :: MonadMetadata m => Identifier -> m Metadata
getMatches :: MonadMetadata m => Pattern -> m [Identifier]
getAllMetadata :: MonadMetadata m => Pattern -> m [(Identifier, Metadata)]
getMetadataField :: MonadMetadata m => Identifier -> String -> m (Maybe String)

-- | Version of <a>getMetadataField</a> which throws an error if the field
--   does not exist.
getMetadataField' :: (MonadFail m, MonadMetadata m) => Identifier -> String -> m String
makePatternDependency :: MonadMetadata m => Pattern -> m Dependency

-- | Newtype wrapper for serialization.
newtype BinaryMetadata
BinaryMetadata :: Metadata -> BinaryMetadata
[unBinaryMetadata] :: BinaryMetadata -> Metadata
instance Data.Binary.Class.Binary Hakyll.Core.Metadata.BinaryMetadata
instance Data.Binary.Class.Binary Hakyll.Core.Metadata.BinaryYaml


-- | Internal module to parse metadata
module Hakyll.Core.Provider.Metadata
loadMetadata :: Provider -> Identifier -> IO (Metadata, Maybe String)
parsePage :: String -> Either ParseException (Metadata, String)

-- | Thrown in the IO monad if things go wrong. Provides a nice-ish error
--   message.
data MetadataException
MetadataException :: FilePath -> ParseException -> MetadataException
instance GHC.Exception.Type.Exception Hakyll.Core.Provider.Metadata.MetadataException
instance GHC.Show.Show Hakyll.Core.Provider.Metadata.MetadataException


-- | This module provides an wrapper API around the file system which does
--   some caching.
module Hakyll.Core.Provider

-- | Responsible for retrieving and listing resources
data Provider

-- | Create a resource provider
newProvider :: Store -> (FilePath -> IO Bool) -> FilePath -> IO Provider
resourceList :: Provider -> [Identifier]

-- | Check if a given resource exists
resourceExists :: Provider -> Identifier -> Bool
resourceFilePath :: Provider -> Identifier -> FilePath

-- | A resource is modified if it or its metadata has changed
resourceModified :: Provider -> Identifier -> Bool
resourceModificationTime :: Provider -> Identifier -> UTCTime

-- | Get the raw body of a resource as string
resourceString :: Provider -> Identifier -> IO String

-- | Get the raw body of a resource of a lazy bytestring
resourceLBS :: Provider -> Identifier -> IO ByteString
resourceMetadata :: Provider -> Identifier -> IO Metadata
resourceBody :: Provider -> Identifier -> IO String


-- | <a>Routes</a> is part of the <a>Rules</a> processing pipeline. It
--   determines if and where the compilation result of the underlying
--   <a>Item</a> being processed is written out to (relative to the
--   destination directory as configured in <a>destinationDirectory</a>).
--   
--   <ul>
--   <li>__If there is no route for an item, the compiled item won't be
--   written out to a file__ and so won't appear in the destination (site)
--   directory.</li>
--   <li>If an item matches multiple routes, the first route will be
--   chosen.</li>
--   </ul>
--   
--   <b>Examples</b>
--   
--   Suppose we have a markdown file <tt>posts/hakyll.md</tt>. We can route
--   its compilation result to <tt>posts/hakyll.html</tt> using
--   <a>setExtension</a>:
--   
--   <pre>
--   -- file on disk: '&lt;project-directory&gt;/posts/hakyll.md'
--   match "posts/*" $ do
--       -- compilation result is written to '&lt;destination-directory&gt;/posts/hakyll.html'
--       route (setExtension "html")
--       compile pandocCompiler
--   </pre>
--   
--   Hint: You can configure the destination directory with
--   <a>destinationDirectory</a>.
--   
--   If we do not want to change the extension, we can replace
--   <a>setExtension</a> with <a>idRoute</a> (the simplest route
--   available):
--   
--   <pre>
--   -- compilation result is written to '&lt;destination-directory&gt;/posts/hakyll.md'
--   route idRoute
--   </pre>
--   
--   That will route the file <tt>posts/hakyll.md</tt> from the project
--   directory to <tt>posts/hakyll.md</tt> in the destination directory.
--   
--   Note: __The extension of the destination filepath says nothing about
--   the content!__ If you set the extension to <tt>.html</tt>, you have to
--   ensure that the compilation result is indeed HTML (for example with
--   the <a>pandocCompiler</a> to transform Markdown to HTML).
--   
--   Take a look at the built-in routes here for detailed usage examples.
module Hakyll.Core.Routes

-- | Type used for a route
data Routes

-- | When you ran a route, it's useful to know whether or not this used
--   metadata. This allows us to do more granular dependency analysis.
type UsedMetadata = Bool

-- | Apply a route to an identifier
runRoutes :: Routes -> Provider -> Identifier -> IO (Maybe FilePath, UsedMetadata)

-- | An "identity" route that interprets the identifier (of the item being
--   processed) as the destination filepath. This identifier is normally
--   the filepath of the source file being processed. See <a>Identifier</a>
--   for details.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Route when using match</b>
--   
--   <pre>
--   -- e.g. file on disk: '&lt;project-directory&gt;/posts/hakyll.md'
--   
--   -- 'hakyll.md' source file implicitly gets filepath as identifier:
--   -- 'posts/hakyll.md'
--   match "posts/*" $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/posts/hakyll.md'
--       route idRoute
--   
--       compile getResourceBody
--   </pre>
idRoute :: Routes

-- | Create a route like <a>idRoute</a> that interprets the identifier (of
--   the item being processed) as the destination filepath but also sets
--   (or replaces) the extension suffix of that path. This identifier is
--   normally the filepath of the source file being processed. See
--   <a>Identifier</a> for details.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Route with an existing extension</b>
--   
--   <pre>
--   -- e.g. file on disk: '&lt;project-directory&gt;/posts/hakyll.md'
--   
--   -- 'hakyll.md' source file implicitly gets filepath as identifier:
--   -- 'posts/hakyll.md'
--   match "posts/*" $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/posts/hakyll.html'
--       route (setExtension "html")
--   
--       compile pandocCompiler
--   </pre>
--   
--   <b>Route without an existing extension</b>
--   
--   <pre>
--   -- implicitly gets identifier: 'about'
--   create ["about"] $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/about.html'
--       route (setExtension "html")
--   
--       compile $ makeItem ("Hello world" :: String)
--   </pre>
setExtension :: String -> Routes

-- | Apply the route if the identifier matches the given pattern, fail
--   otherwise
matchRoute :: Pattern -> Routes -> Routes

-- | Create a route where the destination filepath is built with the given
--   construction function. The provided identifier for that function is
--   normally the filepath of the source file being processed. See
--   <a>Identifier</a> for details.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Route that appends a custom extension</b>
--   
--   <pre>
--   -- e.g. file on disk: '&lt;project-directory&gt;/posts/hakyll.md'
--   
--   -- 'hakyll.md' source file implicitly gets filepath as identifier:
--   -- 'posts/hakyll.md'
--   match "posts/*" $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/posts/hakyll.md.html'
--       route $ customRoute ((&lt;&gt; ".html") . toFilePath)
--   
--       compile pandocCompiler
--   </pre>
--   
--   Note that the last part of the destination filepath becomes
--   <tt>.md.html</tt>
customRoute :: (Identifier -> FilePath) -> Routes

-- | Create a route that writes the compiled item to the given destination
--   filepath (ignoring any identifier or other data about the item being
--   processed). Warning: you should __use a specific destination path only
--   for a single file in a single compilation rule__. Otherwise it's
--   unclear which of the contents should be written to that route.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Route to a specific filepath</b>
--   
--   <pre>
--   -- implicitly gets identifier: 'main' (ignored on next line)
--   create ["main"] $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/index.html'
--       route $ constRoute "index.html"
--   
--       compile $ makeItem ("&lt;h1&gt;Hello World&lt;/h1&gt;" :: String)
--   </pre>
constRoute :: FilePath -> Routes

-- | Create a "substituting" route that searches for substrings (in the
--   underlying identifier) that match the given pattern and transforms
--   them according to the given replacement function. The identifier here
--   is that of the underlying item being processed and is interpreted as
--   an destination filepath. It's normally the filepath of the source file
--   being processed. See <a>Identifier</a> for details.
--   
--   Hint: The name "gsub" comes from a similar function in <a>R</a> and
--   can be read as "globally substituting" (globally in the Unix sense of
--   repeated, not just once).
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Route that replaces part of the filepath</b>
--   
--   <pre>
--   -- e.g. file on disk: '&lt;project-directory&gt;/posts/hakyll.md'
--   
--   -- 'hakyll.md' source file implicitly gets filepath as identifier:
--   -- 'posts/hakyll.md'
--   match "posts/*" $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/haskell/hakyll.md'
--       route $ gsubRoute "posts/" (const "haskell/")
--   
--       compile getResourceBody
--   </pre>
--   
--   Note that "posts/" is replaced with "haskell/" in the destination
--   filepath.
--   
--   <b>Route that removes part of the filepath</b>
--   
--   <pre>
--   -- implicitly gets identifier: 'tags/rss/bar.xml'
--   create ["tags/rss/bar.xml"] $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/tags/bar.xml'
--       route $ gsubRoute "rss/" (const "")
--   
--       compile ...
--   </pre>
--   
--   Note that "rss/" is removed from the destination filepath.
gsubRoute :: String -> (String -> String) -> Routes

-- | Wrapper function around other route construction functions to get
--   access to the metadata (of the underlying item being processed) and
--   use that for the destination filepath construction. Warning: you have
--   to __ensure that the accessed metadata fields actually exists__.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Route that uses a custom slug markdown metadata field</b>
--   
--   To create a search engine optimized yet human-readable url, we can
--   introduce a <a>slug</a> metadata field to our files, e.g. like in the
--   following Markdown file: 'posts/hakyll.md'
--   
--   <pre>
--   ---
--   title: Hakyll Post
--   slug: awesome-post
--   ...
--   ---
--   In this blog post we learn about Hakyll ...
--   </pre>
--   
--   Then we can construct a route whose destination filepath is based on
--   that field:
--   
--   <pre>
--   match "posts/*" $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/awesome-post.html'
--       route $ metadataRoute $ \meta -&gt;
--           constRoute $ fromJust (lookupString "slug" meta) &lt;&gt; ".html"
--   
--       compile pandocCompiler
--   </pre>
--   
--   Note how we wrap <a>metadataRoute</a> around the <a>constRoute</a>
--   function and how the slug is looked up from the markdown field to
--   construct the destination filepath. You can use helper functions like
--   <a>lookupString</a> to access a specific metadata field.
metadataRoute :: (Metadata -> Routes) -> Routes

-- | Compose two routes where <b>the first route is applied before the
--   second</b>. So <tt>f `composeRoutes` g</tt> is more or less equivalent
--   with <tt>g . f</tt>.
--   
--   Warning: If the first route fails (e.g. when using <a>matchRoute</a>),
--   Hakyll will not apply the second route (if you need Hakyll to try the
--   second route, use <a>&lt;&gt;</a> on <a>Routes</a> instead).
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Route that applies two transformations</b>
--   
--   <pre>
--   -- e.g. file on disk: '&lt;project-directory&gt;/posts/hakyll.md'
--   
--   -- 'hakyll.md' source file implicitly gets filepath as identifier:
--   -- 'posts/hakyll.md'
--   match "posts/*" $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/hakyll.html'
--       route $ gsubRoute "posts/" (const "") `composeRoutes` setExtension "html"
--   
--       compile pandocCompiler
--   </pre>
--   
--   The identifier here is that of the underlying item being processed and
--   is interpreted as an destination filepath. See <a>Identifier</a> for
--   details. Note how we first remove the "posts/" substring from that
--   destination filepath with <a>gsubRoute</a> and then replace the
--   extension with <a>setExtension</a>.
composeRoutes :: Routes -> Routes -> Routes
instance GHC.Base.Semigroup Hakyll.Core.Routes.Routes
instance GHC.Base.Monoid Hakyll.Core.Routes.Routes


-- | Internally used compiler module
module Hakyll.Core.Compiler.Internal

-- | Whilst compiling an item, it possible to save multiple snapshots of
--   it, and not just the final result.
type Snapshot = String

-- | Environment in which a compiler runs
data CompilerRead
CompilerRead :: Configuration -> Identifier -> Provider -> Set Identifier -> Routes -> Store -> Logger -> CompilerRead

-- | Main configuration
[compilerConfig] :: CompilerRead -> Configuration

-- | Underlying identifier
[compilerUnderlying] :: CompilerRead -> Identifier

-- | Resource provider
[compilerProvider] :: CompilerRead -> Provider

-- | List of all known identifiers
[compilerUniverse] :: CompilerRead -> Set Identifier

-- | Site routes
[compilerRoutes] :: CompilerRead -> Routes

-- | Compiler store
[compilerStore] :: CompilerRead -> Store

-- | Logger
[compilerLogger] :: CompilerRead -> Logger
data CompilerWrite
CompilerWrite :: [Dependency] -> Int -> CompilerWrite
[compilerDependencies] :: CompilerWrite -> [Dependency]
[compilerCacheHits] :: CompilerWrite -> Int

-- | Distinguishes reasons in a <a>CompilerError</a>
data CompilerErrors a

-- | One or more exceptions occured during compilation
CompilationFailure :: NonEmpty a -> CompilerErrors a

-- | Absence of any result, most notably in template contexts. May still
--   have error messages.
CompilationNoResult :: [a] -> CompilerErrors a

-- | An intermediate result of a compilation step
data CompilerResult a
CompilerDone :: a -> CompilerWrite -> CompilerResult a
CompilerSnapshot :: Snapshot -> Compiler a -> CompilerResult a
CompilerRequire :: [(Identifier, Snapshot)] -> Compiler a -> CompilerResult a
CompilerError :: CompilerErrors String -> CompilerResult a

-- | A monad which lets you compile items and takes care of dependency
--   tracking for you.
newtype Compiler a
Compiler :: (CompilerRead -> IO (CompilerResult a)) -> Compiler a
[unCompiler] :: Compiler a -> CompilerRead -> IO (CompilerResult a)

-- | Like <a>unCompiler</a> but treating IO exceptions as
--   <a>CompilerError</a>s
runCompiler :: Compiler a -> CompilerRead -> IO (CompilerResult a)

-- | Put the result back in a compiler
compilerResult :: CompilerResult a -> Compiler a

-- | Put a <a>CompilerWrite</a>
compilerTell :: CompilerWrite -> Compiler ()

-- | Get the current environment
compilerAsk :: Compiler CompilerRead

-- | Run an IO computation without dependencies in a Compiler
compilerUnsafeIO :: IO a -> Compiler a

-- | Throw errors in the <a>Compiler</a>.
--   
--   If no messages are given, this is considered a
--   <a>CompilationNoResult</a> error. Otherwise, it is treated as a proper
--   compilation failure.
compilerThrow :: [String] -> Compiler a

-- | Put a <a>CompilerError</a> with multiple messages as
--   <a>CompilationNoResult</a>
compilerNoResult :: [String] -> Compiler a

-- | Allows you to recover from <a>CompilerError</a>s. Uses the same
--   parameter order as <a>catchError</a> so that it can be used infix.
--   
--   <pre>
--   c `compilerCatch` f = compilerTry c &gt;&gt;= either f return
--   </pre>
compilerCatch :: Compiler a -> (CompilerErrors String -> Compiler a) -> Compiler a

-- | Allows to distinguish <a>CompilerError</a>s and branch on them with
--   <a>Either</a>
--   
--   <pre>
--   compilerTry = (`compilerCatch` return . Left) . fmap Right
--   </pre>
compilerTry :: Compiler a -> Compiler (Either (CompilerErrors String) a)

-- | Unwrap a <a>CompilerErrors</a>
compilerErrorMessages :: CompilerErrors a -> [a]

-- | Pass a list of messages with a heading to the debug logger
compilerDebugEntries :: String -> [String] -> Compiler ()
compilerTellDependencies :: [Dependency] -> Compiler ()
compilerTellCacheHits :: Int -> Compiler ()
instance GHC.Show.Show Hakyll.Core.Compiler.Internal.CompilerWrite
instance GHC.Base.Functor Hakyll.Core.Compiler.Internal.CompilerErrors
instance GHC.Base.Functor Hakyll.Core.Compiler.Internal.Compiler
instance GHC.Base.Monad Hakyll.Core.Compiler.Internal.Compiler
instance Control.Monad.Fail.MonadFail Hakyll.Core.Compiler.Internal.Compiler
instance GHC.Base.Applicative Hakyll.Core.Compiler.Internal.Compiler
instance Hakyll.Core.Metadata.MonadMetadata Hakyll.Core.Compiler.Internal.Compiler
instance Control.Monad.Error.Class.MonadError [GHC.Base.String] Hakyll.Core.Compiler.Internal.Compiler
instance GHC.Base.Alternative Hakyll.Core.Compiler.Internal.Compiler
instance GHC.Base.Semigroup Hakyll.Core.Compiler.Internal.CompilerWrite
instance GHC.Base.Monoid Hakyll.Core.Compiler.Internal.CompilerWrite


-- | An item is a combination of some content and its <a>Identifier</a>.
--   This way, we can still use the <a>Identifier</a> to access metadata.
module Hakyll.Core.Item
data Item a
Item :: Identifier -> a -> Item a
[itemIdentifier] :: Item a -> Identifier
[itemBody] :: Item a -> a
itemSetBody :: a -> Item b -> Item a

-- | Perform a compiler action on the item body. This is the same as
--   <a>traverse</a>, but looks less intimidating.
--   
--   <pre>
--   withItemBody = traverse
--   </pre>
withItemBody :: (a -> Compiler b) -> Item a -> Compiler (Item b)
instance Data.Traversable.Traversable Hakyll.Core.Item.Item
instance Data.Foldable.Foldable Hakyll.Core.Item.Item
instance GHC.Base.Functor Hakyll.Core.Item.Item
instance GHC.Show.Show a => GHC.Show.Show (Hakyll.Core.Item.Item a)
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Hakyll.Core.Item.Item a)

module Hakyll.Core.Compiler

-- | A monad which lets you compile items and takes care of dependency
--   tracking for you.
data Compiler a

-- | Get the underlying identifier.
getUnderlying :: Compiler Identifier

-- | Get the extension of the underlying identifier. Returns something like
--   <tt>".html"</tt>
getUnderlyingExtension :: Compiler String

-- | Create an item from the underlying identifier and a given value.
makeItem :: a -> Compiler (Item a)

-- | Get the route for a specified item
getRoute :: Identifier -> Compiler (Maybe FilePath)

-- | Get the full contents of the matched source file as a string, but
--   without metadata preamble, if there was one.
getResourceBody :: Compiler (Item String)

-- | Get the full contents of the matched source file as a string.
getResourceString :: Compiler (Item String)

-- | Get the full contents of the matched source file as a lazy bytestring.
getResourceLBS :: Compiler (Item ByteString)

-- | Get the file path of the resource we are compiling
getResourceFilePath :: Compiler FilePath

-- | Whilst compiling an item, it possible to save multiple snapshots of
--   it, and not just the final result.
type Snapshot = String

-- | Save a snapshot of the item. This function returns the same item,
--   which convenient for building <a>&gt;&gt;=</a> chains.
saveSnapshot :: (Binary a, Typeable a) => Snapshot -> Item a -> Compiler (Item a)

-- | Load an item compiled elsewhere. If the required item is not yet
--   compiled, the build system will take care of that automatically.
load :: (Binary a, Typeable a) => Identifier -> Compiler (Item a)

-- | Require a specific snapshot of an item.
loadSnapshot :: (Binary a, Typeable a) => Identifier -> Snapshot -> Compiler (Item a)

-- | A shortcut for only requiring the body of an item.
--   
--   <pre>
--   loadBody = fmap itemBody . load
--   </pre>
loadBody :: (Binary a, Typeable a) => Identifier -> Compiler a

-- | A shortcut for only requiring the body for a specific snapshot of an
--   item
loadSnapshotBody :: (Binary a, Typeable a) => Identifier -> Snapshot -> Compiler a

-- | This function allows you to <a>load</a> a dynamic list of items
loadAll :: (Binary a, Typeable a) => Pattern -> Compiler [Item a]

-- | Load a specific snapshot for each of dynamic list of items
loadAllSnapshots :: (Binary a, Typeable a) => Pattern -> Snapshot -> Compiler [Item a]

-- | Turn on caching for a compilation value to avoid recomputing it on
--   subsequent Hakyll runs. The storage key consists of the underlying
--   identifier of the compiled ressource and the given name.
cached :: (Binary a, Typeable a) => String -> Compiler a -> Compiler a

-- | Run an IO computation in a Compiler. Unlike <a>unsafeCompiler</a>,
--   this function will cause the item to be recompiled every time.
recompilingUnsafeCompiler :: IO a -> Compiler a

-- | Run an IO computation without dependencies in a Compiler. You probably
--   want <a>recompilingUnsafeCompiler</a> instead.
unsafeCompiler :: IO a -> Compiler a

-- | Compiler for debugging purposes. Passes a message to the debug logger
--   that is printed in verbose mode.
debugCompiler :: String -> Compiler ()

-- | Fail so that it is treated as non-defined in an <tt>$if()$</tt>
--   branching <a>Hakyll.Web.Template</a> macro, and alternative
--   <a>Context</a>s are tried
noResult :: String -> Compiler a

-- | Prepend an error line to the error, if there is one. This allows you
--   to add helpful context to error messages.
withErrorMessage :: String -> Compiler a -> Compiler a


-- | A Compiler that supports unix filters.
module Hakyll.Core.UnixFilter

-- | Use a unix filter as compiler. For example, we could use the
--   <tt>rev</tt> program as a compiler.
--   
--   <pre>
--   rev :: Compiler (Item String)
--   rev = getResourceString &gt;&gt;= withItemBody (unixFilter "rev" [])
--   </pre>
--   
--   A more realistic example: one can use this to call, for example, the
--   sass compiler on CSS files. More information about sass can be found
--   here:
--   
--   <a>http://sass-lang.com/</a>
--   
--   The code is fairly straightforward, given that we use <tt>.scss</tt>
--   for sass:
--   
--   <pre>
--   match "style.scss" $ do
--       route   $ setExtension "css"
--       compile $ getResourceString &gt;&gt;=
--           withItemBody (unixFilter "sass" ["-s", "--scss"]) &gt;&gt;=
--           return . fmap compressCss
--   </pre>
unixFilter :: String -> [String] -> String -> Compiler String

-- | Variant of <a>unixFilter</a> that should be used for binary files
--   
--   <pre>
--   match "music.wav" $ do
--       route   $ setExtension "ogg"
--       compile $ getResourceLBS &gt;&gt;= withItemBody (unixFilterLBS "oggenc" ["-"])
--   </pre>
unixFilterLBS :: String -> [String] -> ByteString -> Compiler ByteString


-- | Describes writable items; items that can be saved to the disk
module Hakyll.Core.Writable

-- | Describes an item that can be saved to the disk
class Writable a

-- | Save an item to the given filepath
write :: Writable a => FilePath -> Item a -> IO ()
instance Hakyll.Core.Writable.Writable ()
instance Hakyll.Core.Writable.Writable [GHC.Types.Char]
instance Hakyll.Core.Writable.Writable Data.ByteString.Internal.Type.ByteString
instance Hakyll.Core.Writable.Writable Data.ByteString.Lazy.Internal.ByteString
instance Hakyll.Core.Writable.Writable [GHC.Word.Word8]
instance Hakyll.Core.Writable.Writable Text.Blaze.Html.Html

module Hakyll.Core.Rules.Internal
data RulesRead
RulesRead :: Provider -> [Identifier] -> Maybe String -> RulesRead
[rulesProvider] :: RulesRead -> Provider
[rulesMatches] :: RulesRead -> [Identifier]
[rulesVersion] :: RulesRead -> Maybe String
data RuleSet
RuleSet :: Routes -> [(Identifier, Compiler SomeItem)] -> Set Identifier -> Pattern -> RuleSet

-- | Accumulated routes
[rulesRoutes] :: RuleSet -> Routes

-- | Accumulated compilers
[rulesCompilers] :: RuleSet -> [(Identifier, Compiler SomeItem)]

-- | A set of the actually used files
[rulesResources] :: RuleSet -> Set Identifier

-- | A pattern we can use to check if a file *would* be used. This is
--   needed for the preview server.
[rulesPattern] :: RuleSet -> Pattern
data RulesState
RulesState :: Maybe Routes -> Maybe (Compiler SomeItem) -> RulesState
[rulesRoute] :: RulesState -> Maybe Routes
[rulesCompiler] :: RulesState -> Maybe (Compiler SomeItem)
emptyRulesState :: RulesState

-- | The monad used to compose rules
newtype Rules a
Rules :: RWST RulesRead RuleSet RulesState IO a -> Rules a
[unRules] :: Rules a -> RWST RulesRead RuleSet RulesState IO a

-- | Run a Rules monad, resulting in a <a>RuleSet</a>
runRules :: Rules a -> Provider -> IO RuleSet
instance GHC.Base.Applicative Hakyll.Core.Rules.Internal.Rules
instance GHC.Base.Functor Hakyll.Core.Rules.Internal.Rules
instance Control.Monad.Fail.MonadFail Hakyll.Core.Rules.Internal.Rules
instance GHC.Base.Monad Hakyll.Core.Rules.Internal.Rules
instance Hakyll.Core.Metadata.MonadMetadata Hakyll.Core.Rules.Internal.Rules
instance GHC.Base.Semigroup Hakyll.Core.Rules.Internal.RuleSet
instance GHC.Base.Monoid Hakyll.Core.Rules.Internal.RuleSet

module Hakyll.Core.Runtime
run :: RunMode -> Configuration -> Logger -> Rules a -> IO (ExitCode, RuleSet)

-- | Whether to execute a normal run (build the site) or a dry run.
data RunMode
RunModeNormal :: RunMode
RunModePrintOutOfDate :: RunMode
instance GHC.Show.Show Hakyll.Core.Runtime.RunMode


-- | This module provides a declarative Domain Specific Language (DSL) to
--   generate a static site by specifying transformation <a>Rules</a>
--   (although the use case is not limited to static sites). Each rule
--   normally consists of three parts:
--   
--   <ol>
--   <li>Source files (like Markdown files) to process (collected with e.g.
--   <a>match</a> or <a>create</a>).</li>
--   <li>Compilation steps (like Markdown to HTML) to transform files'
--   content to some output content (steps are collected within
--   <a>Compiler</a> and executed with <a>compile</a>).</li>
--   <li>Routing to determine if and where an output content will be
--   written out. For a static site this determines under which URL the
--   output content will be available (configured with <a>route</a> and
--   <a>Routes</a>).</li>
--   </ol>
--   
--   A typical usage example looks as follows:
--   
--   <pre>
--   -- write 'match "posts/**.md"' instead of 'match $ fromGlob "posts/**.md"'
--   {-# LANGUAGE OverloadedStrings #-}    
--   ...
--   
--   main = hakyll $ do
--   
--       -- Rule 1
--       -- Source files: all Markdown files like 'hakyll.md' in the 'posts' directory
--       match "posts/**.md" $ do          
--           -- Routing: Only replace extension, so '&lt;destination-directory&gt;/posts/hakyll.html'.
--           route $ setExtension "html"   
--           -- Compilation step(s): Transform Markdown file content into HTML output.
--           compile pandocCompiler        
--   
--       -- Rule 2
--       match "css/*" $ do
--           route idRoute
--           compile compressCssCompiler
--       ...
--   </pre>
--   
--   <b>The order of rules doesn't matter.</b>
--   
--   See official <a>Hakyll Rules tutorial</a> for other examples.
module Hakyll.Core.Rules

-- | The monad used to compose rules
data Rules a

-- | Add a selection of which source files to process (using the given
--   <a>glob pattern</a>) to the given remaining <a>Rules</a> value.
--   
--   The expanded, relative path of the matched source file on disk
--   (relative to the project directory configured with
--   <a>providerDirectory</a>) becomes the identifier under which the
--   compilation result is saved to the <a>Store</a> (in case you want to
--   <a>load</a> it within another rule). See <a>Identifier</a> for
--   details.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Select all markdown files within a directory (but without
--   subdirectories)</b>
--   
--   <pre>
--   -- Match all Markdown files in the immediate 'posts' directory
--   -- e.g. '&lt;project-directory&gt;/posts/hakyll.md'
--   -- but NOT  '&lt;project-directory&gt;/posts/haskell/monad.md'
--   match "posts/*.md" $ do
--       route $ setExtension "html"
--       compile pandocCompiler
--   </pre>
--   
--   <b>Select all markdown files within a directory (including
--   subdirectories recursively)</b>
--   
--   <pre>
--   -- Match all Markdown files in the 'posts' directory and any subdirectory
--   -- e.g. '&lt;project-directory&gt;/posts/hakyll.md'
--   -- and  '&lt;project-directory&gt;/posts/haskell/monad.md'
--   match "posts/**.md" $ do
--       route $ setExtension "html"
--       compile pandocCompiler
--   </pre>
--   
--   See <a>Pattern</a> or search "glob patterns" online for more details.
--   To control where the compilation result will be written out, use
--   routing functions like <a>setExtension</a>.
match :: Pattern -> Rules () -> Rules ()

-- | Add a selection of which source files to process (using the given
--   <a>glob pattern</a> and metadata predicate) to the given remaining
--   <a>Rules</a> values. Same as <a>match</a> but allows to filter files
--   further based on their (metadata) content (a file is added only when
--   the metadata predicate returns <tt>True</tt>).
--   
--   The expanded, relative path of the matched source file on disk
--   (relative to the project directory configured with
--   <a>providerDirectory</a>) becomes the identifier under which the
--   compilation result is saved to the <a>Store</a> (in case you want to
--   <a>load</a> it within another rule). See <a>Identifier</a> for
--   details.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Select all markdown files with enabled draft flag within a
--   directory</b>
--   
--   <pre>
--   matchMetadata "posts/*.md" (\meta -&gt; maybe False (=="true") $ lookupString "draft" meta) $ do
--       route $ setExtension "html"
--       compile pandocCompiler
--   </pre>
--   
--   For example, the following 'posts/hakyll.md' file with <tt>draft:
--   true</tt> metadata would match:
--   
--   <pre>
--   ---
--   draft: true
--   title: Hakyll Post
--   ...
--   ---
--   In this blog post we learn about Hakyll ...
--   </pre>
--   
--   Note that files that have <tt>draft: false</tt> or no such draft field
--   at all, would not match. You can use helper functions like
--   <a>lookupString</a> to access a specific metadata field, and
--   <a>maybe</a> to work with <a>Maybe</a>. To control where the
--   compilation result will be written out, use routing functions like
--   <a>setExtension</a>.
matchMetadata :: Pattern -> (Metadata -> Bool) -> Rules () -> Rules ()

-- | Assign (and thereby create) the given identifier(s) to content that
--   has no underlying source file on disk. That content must be created
--   within the <a>compile</a> part of the given remaining <a>Rules</a>
--   value. The given identifier is the id under which the compilation is
--   saved to the <a>Store</a> (in case you want to <a>load</a> it within
--   another rule). See <a>Identifier</a> for details.
--   
--   Use this function for example to create an overview page that doesn't
--   have or need its content prepared in a file (unlike blog posts which
--   normally have a corresponding Markdown source file on disk).
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Create a webpage without an underlying source file</b>
--   
--   <pre>
--   -- saved with implicit identifier 'index.html' to Store
--   create ["index.html"] $ do
--   
--       -- compilation result is written to '&lt;destination-directory&gt;/index.html'
--       route idRoute
--   
--       -- create content without a source file from disk
--       compile $ makeItem ("&lt;h1&gt;Hello World&lt;/h1&gt;" :: String)
--   </pre>
--   
--   Note how you can use <a>makeItem</a> to create content inline (to be
--   processed as a <a>Compiler</a> value) as if that content was loaded
--   from a file (as it's the case when using <a>match</a>). To control
--   where the compilation result will be written out, use routing
--   functions like <a>idRoute</a>.
create :: [Identifier] -> Rules () -> Rules ()

-- | Add the given version name to the implicit identifier(s) under which
--   the compilation result of the given remaining <a>Rules</a> value is
--   saved to the <a>Store</a>. See <a>Identifier</a> for details.
--   
--   Use this wrapper function for example when you need to compile the
--   same source file into two or more different results, each with a
--   different version name. The version is needed to distinguish between
--   these different compilation results in the store, otherwise they would
--   get the same conflicting identifier in the store.
--   
--   Warning: <b>If you add a version name with this function, you need to
--   supply the same name</b> when you <a>load</a> the content from the
--   store from within another rule.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Compile source file into differently versioned outputs and load
--   both</b>
--   
--   <pre>
--   -- e.g. file on disk: 'posts/hakyll.md'
--   
--   -- saved with implicit identifier ('posts/hakyll.md', no-version)
--   match "posts/*" $ do
--       route $ setExtension "html"
--       compile pandocCompiler
--   
--   -- saved with implicit identifier ('posts/hakyll.md', version 'raw')
--   match "posts/*" $ version "raw" $ do
--       route idRoute
--       compile getResourceBody
--   
--   -- use compilation results from rules above
--   create ["index.html"] $ do
--       route idRoute
--       compile $ do
--           -- load no-version version
--           compiledPost &lt;- load (fromFilePath "posts/hakyll.md")
--           -- load version 'raw'
--           rawPost &lt;- load . setVersion (Just "raw") $ fromFilePath "posts/hakyll.md"
--           ...
--   </pre>
--   
--   Note how a version name is needed to distinguish the unversioned and
--   the "raw" version when loading the Hakyll post for the
--   <tt>index.html</tt> page. To control where the compilation result will
--   be written out, use routing functions like <a>idRoute</a> and
--   <a>setExtension</a>.
version :: String -> Rules () -> Rules ()

-- | Add (or replace) the given compilation steps within the given
--   <a>Compiler</a> value to the current <a>Rules</a> value. <b>This
--   functions controls HOW the content within a rule is processed</b> (use
--   one of the <a>match</a> functions to control WHAT content is
--   processed).
--   
--   The compilation result is saved to the <a>Store</a> under an implicit
--   identifier. See <a>Identifier</a> for details.
--   
--   If there's routing attached to the rule where this function is used,
--   the compilation result is also written out to a file according to that
--   route. See <a>route</a> and <a>Routes</a> for details.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Compile Markdown to HTML</b>
--   
--   <pre>
--   -- Select all Markdown files in 'posts' directory
--   match "posts/**.md" $ do
--   
--       route $ setExtension "html"
--   
--       -- use pandoc to transform Markdown to HTML in a single step
--       compile pandocCompiler
--   </pre>
--   
--   Note how we set the content to be processed with
--   <a>pandocCompiler</a>. The content comes implicitly from the matched
--   Markdown files on disk. We don't have to pass that content around
--   manually. Every file is processed the same way within this one rule.
--   
--   To control where the compilation result will be written out, use
--   routing functions like <a>setExtension</a>. Here the compilation
--   result of a file like <tt>posts/hakyll.md</tt> is written out to
--   <tt>posts/hakyll.html</tt>.
--   
--   <b>Compile Markdown to HTML and embed it in a template</b>
--   
--   <pre>
--   -- Select all Markdown files in 'posts' directory
--   match "posts/**.md" $ do
--       route $ setExtension "html"
--       compile $
--           pandocCompiler &gt;&gt;=
--             loadAndApplyTemplate "templates/post.html" defaultContext
--   
--   -- To Hakyll templates are just plain files that have to be processed
--   -- and placed into the store like any other file (but without routing).
--   -- e.g. file on disk: 'templates/post.html'
--   match "templates/*" $ compile templateBodyCompiler
--   </pre>
--   
--   Note how a Markdown post that is compiled to HTML using
--   <a>pandocCompiler</a> in a first step and then embedded into a HTMl
--   <a>Template</a> in a second step by using <a>loadAndApplyTemplate</a>.
--   We can use templates to control the design and layout of a webpage. A
--   template may look as follows:
--   
--   <pre>
--   &lt;h1&gt;$title$&lt;/h1&gt;
--   $body$
--   </pre>
--   
--   See <a>Hakyll.Web.Template</a> to see examples of the templating
--   syntax.
compile :: (Binary a, Typeable a, Writable a) => Compiler (Item a) -> Rules ()

-- | Add (or replace) routing in the current <a>Rules</a> value. <b>This
--   functions controls IF and WHERE the compiled results are written
--   out</b> (use one of the <a>match</a> functions to control WHAT content
--   is processed and <a>compile</a> to control HOW). See <a>Routes</a> and
--   <a>Identifier</a> for details on how output filepaths are computed.
--   
--   Hint: <b>If there's no route attached to a rule, the compilation
--   result is not written out</b>. However, the compilation result is
--   saved to the <a>Store</a> and can be loaded and used within another
--   rule. This behavior is needed, for example, for templates.
--   
--   <h3><b>Examples</b></h3>
--   
--   <b>Rules with and without routing</b>
--   
--   <pre>
--   -- e.g. file on disk: 'templates/post.html'
--   
--   -- Rule 1 (without routing)
--   match "templates/*" $ do
--       -- compilation result saved to store with implicit identifier, e.g. 'templates/post.html'
--       compile templateCompiler
--   
--   -- Rule 2 (with routing)
--   match "posts/**.md" $ do
--       route $ setExtension "html"
--       compile $ do
--          -- load compiled result of other rule with explicit identifier.
--          postTemplate &lt;- loadBody "templates/post.html"
--          pandocCompiler &gt;&gt;= applyTemplate postTemplate defaultContext
--   </pre>
--   
--   Note that we don't set a route in the first rule to avoid writing out
--   our compiled templates. However, we can still <a>load</a> (or
--   <a>loadBody</a>) the compiled templates to apply them in a second
--   rule. The content for <a>templateCompiler</a> comes implicitly from
--   the matched template files on disk. We don't have to pass that content
--   around manually. See <a>match</a> and <a>compile</a> for details.
--   
--   To control where a compilation result will be written out (as done in
--   the second rule), use routing functions like <a>setExtension</a>.
--   
--   See <a>Hakyll.Web.Template</a> for examples of templates and the
--   templating syntax.
route :: Routes -> Rules ()

-- | Execute an <a>IO</a> action immediately while the rules are being
--   evaluated. This should be avoided if possible, but occasionally comes
--   in useful.
preprocess :: IO a -> Rules a
data Dependency
PatternDependency :: Pattern -> Set Identifier -> Dependency
IdentifierDependency :: Identifier -> Dependency
AlwaysOutOfDate :: Dependency

-- | Advanced usage: add extra dependencies to compilers. Basically this is
--   needed when you're doing unsafe tricky stuff in the rules monad, but
--   you still want correct builds.
--   
--   A useful utility for this purpose is <a>makePatternDependency</a>.
rulesExtraDependencies :: [Dependency] -> Rules a -> Rules a


-- | Exports simple compilers to just copy files
module Hakyll.Core.File

-- | This will copy any file directly by using a system call
newtype CopyFile
CopyFile :: FilePath -> CopyFile
copyFileCompiler :: Compiler (Item CopyFile)
newtype TmpFile
TmpFile :: FilePath -> TmpFile

-- | Create a tmp file
newTmpFile :: String -> Compiler TmpFile
instance GHC.Show.Show Hakyll.Core.File.CopyFile
instance GHC.Classes.Ord Hakyll.Core.File.CopyFile
instance GHC.Classes.Eq Hakyll.Core.File.CopyFile
instance Data.Binary.Class.Binary Hakyll.Core.File.CopyFile
instance Data.Binary.Class.Binary Hakyll.Core.File.TmpFile
instance Hakyll.Core.Writable.Writable Hakyll.Core.File.TmpFile
instance Hakyll.Core.Writable.Writable Hakyll.Core.File.CopyFile


-- | Module used for CSS compression. The compression is currently in a
--   simple state, but would typically reduce the number of bytes by about
--   25%.
module Hakyll.Web.CompressCss

-- | Compiler form of <a>compressCss</a>
compressCssCompiler :: Compiler (Item String)

-- | Compress CSS to speed up your site.
compressCss :: String -> String


-- | Provides utilities to manipulate HTML pages
module Hakyll.Web.Html

-- | Map over all tags in the document
withTags :: (Tag String -> Tag String) -> String -> String

-- | Map over all tags (as list) in the document
withTagList :: ([Tag String] -> [Tag String]) -> String -> String

-- | Map over all tags (as list) in the document, in a monad
withTagListM :: Monad m => ([Tag String] -> m [Tag String]) -> String -> m String

-- | Map every <tt>h1</tt> to an <tt>h2</tt>, <tt>h2</tt> to <tt>h3</tt>,
--   etc.
demoteHeaders :: String -> String

-- | Maps any <tt>hN</tt> to an <tt>hN+amount</tt> for any <tt>amount &gt;
--   0 &amp;&amp; 1 &lt;= N+amount &lt;= 6</tt>.
demoteHeadersBy :: Int -> String -> String

-- | Extract URLs from tags' attributes. Those would be the same URLs on
--   which <a>withUrls</a> would act.
getUrls :: [Tag String] -> [String]

-- | Apply a function to each URL on a webpage
withUrls :: (String -> String) -> String -> String

-- | Convert a filepath to an URL starting from the site root
--   
--   Example:
--   
--   <pre>
--   toUrl "foo/bar.html"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   "/foo/bar.html"
--   </pre>
--   
--   This also sanitizes the URL, e.g. converting spaces into '%20'
toUrl :: FilePath -> String

-- | Get the relative url to the site root, for a given (absolute) url
toSiteRoot :: String -> String

-- | Check if an URL links to an external HTTP(S) source
isExternal :: String -> Bool

-- | Strip all HTML tags from a string
--   
--   Example:
--   
--   <pre>
--   stripTags "&lt;p&gt;foo&lt;/p&gt;"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   "foo"
--   </pre>
--   
--   This also works for incomplete tags
--   
--   Example:
--   
--   <pre>
--   stripTags "&lt;p&gt;foo&lt;/p"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   "foo"
--   </pre>
stripTags :: String -> String

-- | HTML-escape a string
--   
--   Example:
--   
--   <pre>
--   escapeHtml "Me &amp; Dean"
--   </pre>
--   
--   Result:
--   
--   <pre>
--   "Me &amp;amp; Dean"
--   </pre>
escapeHtml :: String -> String
instance GHC.Show.Show Hakyll.Web.Html.Srcset
instance GHC.Show.Show Hakyll.Web.Html.SrcsetImageCandidate


-- | This module exposes a function which can relativize URL's on a
--   webpage.
--   
--   This means that one can deploy the resulting site on
--   <tt>http://example.com/</tt>, but also on
--   <tt>http://example.com/some-folder/</tt> without having to change
--   anything (simply copy over the files).
--   
--   To use it, you should use absolute URL's from the site root
--   everywhere. For example, use
--   
--   <pre>
--   &lt;img src="/images/lolcat.png" alt="Funny zomgroflcopter" /&gt;
--   </pre>
--   
--   in a blogpost. When running this through the relativize URL's module,
--   this will result in (suppose your blogpost is located at
--   <tt>/posts/foo.html</tt>:
--   
--   <pre>
--   &lt;img src="../images/lolcat.png" alt="Funny zomgroflcopter" /&gt;
--   </pre>
module Hakyll.Web.Html.RelativizeUrls

-- | Compiler form of <a>relativizeUrls</a> which automatically picks the
--   right root path
relativizeUrls :: Item String -> Compiler (Item String)

-- | Relativize URL's in HTML
relativizeUrlsWith :: String -> String -> String


-- | A module dealing with pandoc file extensions and associated file types
module Hakyll.Web.Pandoc.FileType

-- | Datatype to represent the different file types Hakyll can deal with by
--   default
data FileType
Binary :: FileType
Css :: FileType
DocBook :: FileType
Html :: FileType
Jupyter :: FileType
LaTeX :: FileType
LiterateHaskell :: FileType -> FileType
Markdown :: FileType
MediaWiki :: FileType
OrgMode :: FileType
PlainText :: FileType
Rst :: FileType
Textile :: FileType

-- | Get the file type for a certain file. The type is determined by
--   extension.
fileType :: FilePath -> FileType

-- | Get the file type for the current file
itemFileType :: Item a -> FileType
instance GHC.Read.Read Hakyll.Web.Pandoc.FileType.FileType
instance GHC.Show.Show Hakyll.Web.Pandoc.FileType.FileType
instance GHC.Classes.Ord Hakyll.Web.Pandoc.FileType.FileType
instance GHC.Classes.Eq Hakyll.Web.Pandoc.FileType.FileType


-- | Module exporting convenient pandoc bindings
module Hakyll.Web.Pandoc

-- | Read a string using pandoc, with the default options
readPandoc :: Item String -> Compiler (Item Pandoc)

-- | Read a string using pandoc, with the supplied options
readPandocWith :: ReaderOptions -> Item String -> Compiler (Item Pandoc)

-- | Write a document (as HTML) using pandoc, with the default options
writePandoc :: Item Pandoc -> Item String

-- | Write a document (as HTML) using pandoc, with the supplied options
writePandocWith :: WriterOptions -> Item Pandoc -> Item String

-- | Render the resource using pandoc
renderPandoc :: Item String -> Compiler (Item String)

-- | Render the resource using pandoc
renderPandocWith :: ReaderOptions -> WriterOptions -> Item String -> Compiler (Item String)

-- | An extension of <a>renderPandocWith</a>, which allows you to specify a
--   custom Pandoc transformation on the input <a>Item</a>. Useful if you
--   want to do your own transformations before running custom Pandoc
--   transformations, e.g. using a <tt>funcField</tt> to transform raw
--   content.
renderPandocWithTransform :: ReaderOptions -> WriterOptions -> (Pandoc -> Pandoc) -> Item String -> Compiler (Item String)

-- | Similar to <a>renderPandocWithTransform</a>, but the Pandoc
--   transformation is monadic. This is useful when you want the pandoc
--   transformation to use the <a>Compiler</a> information such as routes,
--   metadata, etc. along with your own transformations beforehand.
renderPandocWithTransformM :: ReaderOptions -> WriterOptions -> (Pandoc -> Compiler Pandoc) -> Item String -> Compiler (Item String)

-- | Read a page render using pandoc
pandocCompiler :: Compiler (Item String)

-- | A version of <a>pandocCompiler</a> which allows you to specify your
--   own pandoc options
pandocCompilerWith :: ReaderOptions -> WriterOptions -> Compiler (Item String)

-- | An extension of <a>pandocCompilerWith</a> which allows you to specify
--   a custom pandoc transformation for the content
pandocCompilerWithTransform :: ReaderOptions -> WriterOptions -> (Pandoc -> Pandoc) -> Compiler (Item String)

-- | Similar to <a>pandocCompilerWithTransform</a>, but the transformation
--   function is monadic. This is useful when you want the pandoc
--   transformation to use the <a>Compiler</a> information such as routes,
--   metadata, etc
pandocCompilerWithTransformM :: ReaderOptions -> WriterOptions -> (Pandoc -> Compiler Pandoc) -> Compiler (Item String)

-- | The default reader options for pandoc parsing in hakyll
defaultHakyllReaderOptions :: ReaderOptions

-- | The default writer options for pandoc rendering in hakyll
defaultHakyllWriterOptions :: WriterOptions


-- | Wraps pandocs bibiliography handling
--   
--   In order to add a bibliography, you will need a bibliography file
--   (e.g. <tt>.bib</tt>) and a CSL file (<tt>.csl</tt>). Both need to be
--   compiled with their respective compilers (<a>biblioCompiler</a> and
--   <a>cslCompiler</a>). Then, you can refer to these files when you use
--   <a>readPandocBiblio</a>. This function also takes the reader options
--   for completeness -- you can use <a>defaultHakyllReaderOptions</a> if
--   you're unsure. If you already read the source into a <a>Pandoc</a>
--   type and need to add processing for the bibliography, you can use
--   <a>processPandocBiblio</a> instead. <a>pandocBiblioCompiler</a> is a
--   convenience wrapper which works like <a>pandocCompiler</a>, but also
--   takes paths to compiled bibliography and csl files;
--   <a>pandocBibliosCompiler</a> is similar but instead takes a glob
--   pattern for bib files.
module Hakyll.Web.Pandoc.Biblio
newtype CSL
CSL :: ByteString -> CSL
[unCSL] :: CSL -> ByteString
cslCompiler :: Compiler (Item CSL)
newtype Biblio
Biblio :: ByteString -> Biblio
[unBiblio] :: Biblio -> ByteString
biblioCompiler :: Compiler (Item Biblio)
readPandocBiblio :: ReaderOptions -> Item CSL -> Item Biblio -> Item String -> Compiler (Item Pandoc)
readPandocBiblios :: ReaderOptions -> Item CSL -> [Item Biblio] -> Item String -> Compiler (Item Pandoc)
processPandocBiblio :: Item CSL -> Item Biblio -> Item Pandoc -> Compiler (Item Pandoc)
processPandocBiblios :: Item CSL -> [Item Biblio] -> Item Pandoc -> Compiler (Item Pandoc)

-- | Compiles a markdown file via Pandoc. Requires the .csl and .bib files
--   to be known to the compiler via match statements.
pandocBiblioCompiler :: String -> String -> Compiler (Item String)

-- | Compiles a markdown file via Pandoc. Requires the .csl and .bib files
--   to be known to the compiler via match statements.
pandocBibliosCompiler :: String -> String -> Compiler (Item String)
instance GHC.Show.Show Hakyll.Web.Pandoc.Biblio.CSL
instance Data.Binary.Class.Binary Hakyll.Web.Pandoc.Biblio.CSL
instance GHC.Show.Show Hakyll.Web.Pandoc.Biblio.Biblio
instance Data.Binary.Class.Binary Hakyll.Web.Pandoc.Biblio.Biblio
instance Hakyll.Core.Writable.Writable Hakyll.Web.Pandoc.Biblio.Biblio
instance Hakyll.Core.Writable.Writable Hakyll.Web.Pandoc.Biblio.CSL


-- | Module used for generating HTML redirect pages. This allows renaming
--   pages to avoid breaking existing links without requiring server-side
--   support for formal 301 Redirect error codes
module Hakyll.Web.Redirect

-- | This datatype can be used directly if you want a lower-level interface
--   to generate redirects. For example, if you want to redirect
--   <tt>foo.html</tt> to <tt>bar.jpg</tt>, you can use:
--   
--   <pre>
--   create ["foo.html"] $ do
--       route idRoute
--       compile $ makeItem $ Redirect "bar.jpg"
--   </pre>
data Redirect
Redirect :: String -> Redirect
[redirectTo] :: Redirect -> String

-- | This function exposes a higher-level interface compared to using the
--   <a>Redirect</a> type manually.
--   
--   This creates, using a database mapping broken URLs to working ones,
--   HTML files which will do HTML META tag redirect pages (since, as a
--   static site, we can't use web-server-level 301 redirects, and using JS
--   is gross).
--   
--   This is useful for sending people using old URLs to renamed versions,
--   dealing with common typos etc, and will increase site traffic. Such
--   broken URLs can be found by looking at server logs or by using Google
--   Webmaster Tools. Broken URLs must be valid Haskell strings,
--   non-URL-escaped valid POSIX filenames, and relative links, since they
--   will be defined in a <tt>hakyll.hs</tt> and during generation, written
--   to disk with the filename corresponding to the broken URLs. (Target
--   URLs can be absolute or relative, but should be URL-escaped.) So
--   broken incoming links like <a>http://www.gwern.net/foo/</a> which
--   should be <a>http://www.gwern.net/foobar</a> cannot be fixed (since
--   you cannot create a HTML file named <tt>"foo/"</tt> on disk, as that
--   would be a directory).
--   
--   An example of a valid association list would be:
--   
--   <pre>
--   brokenLinks =
--       [ ("projects.html", "http://github.com/gwern")
--       , ("/Black-market archive", "Black-market%20archives")
--       ]
--   </pre>
--   
--   In which case the functionality can then be used in <tt>main</tt> with
--   a line like:
--   
--   <pre>
--   version "redirects" $ createRedirects brokenLinks
--   </pre>
--   
--   The <a>version</a> is recommended to separate these items from your
--   other pages.
--   
--   The on-disk files can then be uploaded with HTML mimetypes (either
--   explicitly by generating and uploading them separately, by
--   auto-detection of the filetype, or an upload tool defaulting to HTML
--   mimetype, such as calling <tt>s3cmd</tt> with
--   <tt>--default-mime-type=text/html</tt>) and will redirect browsers and
--   search engines going to the old/broken URLs.
--   
--   See also
--   <a>https://groups.google.com/d/msg/hakyll/sWc6zxfh-uM/fUpZPsFNDgAJ</a>.
createRedirects :: [(Identifier, String)] -> Rules ()
instance GHC.Show.Show Hakyll.Web.Redirect.Redirect
instance GHC.Classes.Ord Hakyll.Web.Redirect.Redirect
instance GHC.Classes.Eq Hakyll.Web.Redirect.Redirect
instance Data.Binary.Class.Binary Hakyll.Web.Redirect.Redirect
instance Hakyll.Core.Writable.Writable Hakyll.Web.Redirect.Redirect


-- | This module provides <a>Context</a>s which are used to expand
--   expressions in templates and allow for arbitrary customisation.
--   
--   <tt>Template</tt>s define a small expression DSL which consists of
--   strings, identifiers and function application. There is no type
--   system, every value is a string and on the top level they get
--   substituted verbatim into the page.
--   
--   For example, you can build a context that contains
--   
--   <pre>
--   … &lt;&gt; functionField "concat" (const . concat) &lt;&gt; …
--   </pre>
--   
--   which will allow you to use the <tt>concat</tt> identifier as a
--   function that takes arbitrarily many strings and concatenates them to
--   a new string:
--   
--   <pre>
--   $partial(concat("templates/categories/", category))$
--   </pre>
--   
--   This will evaluate the <tt>category</tt> field in the context, then
--   prepend the path, and include the referenced file as a template.
module Hakyll.Web.Template.Context

-- | Mostly for internal usage
data ContextField
EmptyField :: ContextField
StringField :: String -> ContextField
ListField :: Context a -> [Item a] -> ContextField

-- | The <a>Context</a> monoid. Please note that the order in which you
--   compose the items is important. For example in
--   
--   <pre>
--   field "A" f1 &lt;&gt; field "A" f2
--   </pre>
--   
--   the first context will overwrite the second. This is especially
--   important when something is being composed with <a>metadataField</a>
--   (or <a>defaultContext</a>). If you want your context to be overwritten
--   by the metadata fields, compose it from the right:
--   
--   <pre>
--   <a>metadataField</a> &lt;&gt; field "date" fDate
--   </pre>
newtype Context a
Context :: (String -> [String] -> Item a -> Compiler ContextField) -> Context a
[unContext] :: Context a -> String -> [String] -> Item a -> Compiler ContextField

-- | Constructs a new field for a <a>Context</a>. If the key matches, the
--   compiler is run and its result is substituted in the template.
--   
--   If the compiler fails, the field will be considered non-existent in an
--   <tt>$if()$</tt> macro or ultimately break the template application
--   (unless the key is found in another context when using
--   <a>&lt;&gt;</a>). Use <a>empty</a> or <a>noResult</a> for intentional
--   failures of fields used in <tt>$if()$</tt>, to distinguish them from
--   exceptions thrown with <a>fail</a>.
field :: String -> (Item a -> Compiler String) -> Context a

-- | Creates a <a>field</a> to use with the <tt>$if()$</tt> template macro.
--   Attempting to substitute the field into the template will cause an
--   error.
boolField :: String -> (Item a -> Bool) -> Context a

-- | Creates a <a>field</a> that does not depend on the <a>Item</a> but
--   always yields the same string
constField :: String -> String -> Context a

-- | Creates a list field to be consumed by a <tt>$for(…)$</tt> expression.
--   The compiler returns multiple items which are rendered in the loop
--   body with the supplied context.
listField :: String -> Context a -> Compiler [Item a] -> Context b

-- | Creates a list field like <a>listField</a>, but supplies the current
--   page to the compiler.
listFieldWith :: String -> Context a -> (Item b -> Compiler [Item a]) -> Context b

-- | Creates a variadic function field.
--   
--   The function will be called with the dynamically evaluated string
--   arguments from the template as well as the page that is currently
--   rendered.
functionField :: String -> ([String] -> Item a -> Compiler String) -> Context a

-- | Transform the respective string results of all fields in a context.
--   For example,
--   
--   <pre>
--   mapContext (++"c") (constField "x" "a" &lt;&gt; constField "y" "b")
--   </pre>
--   
--   is equivalent to
--   
--   <pre>
--   constField "x" "ac" &lt;&gt; constField "y" "bc"
--   </pre>
mapContext :: (String -> String) -> Context a -> Context a

-- | Transform the respective string results of all fields in a context
--   satisfying a predicate. For example,
--   
--   <pre>
--   mapContextBy (=="y") (++"c") (constField "x" "a" &lt;&gt; constField "y" "b")
--   </pre>
--   
--   is equivalent to
--   
--   <pre>
--   constField "x" "a" &lt;&gt; constField "y" "bc"
--   </pre>
mapContextBy :: (String -> Bool) -> (String -> String) -> Context a -> Context a

-- | A context that contains (in that order)
--   
--   <ol>
--   <li>A <tt>$body$</tt> field</li>
--   <li>Metadata fields</li>
--   <li>A <tt>$url$</tt> <a>urlField</a></li>
--   <li>A <tt>$path$</tt> <a>pathField</a></li>
--   <li>A <tt>$title$</tt> <a>titleField</a></li>
--   </ol>
defaultContext :: Context String

-- | Constructs a <a>field</a> that contains the body of the item.
bodyField :: String -> Context String

-- | Map any field to its metadata value, if present
metadataField :: Context a

-- | Absolute url to the resulting item
urlField :: String -> Context a

-- | Filepath of the underlying file of the item
pathField :: String -> Context a

-- | This title <a>field</a> takes the basename of the underlying file by
--   default
titleField :: String -> Context a

-- | A context that allows snippet inclusion. In processed file, use as:
--   
--   <pre>
--   ...
--   $snippet("path/to/snippet/")$
--   ...
--   </pre>
--   
--   The contents of the included file will not be interpolated like
--   <tt>partial</tt> does it.
snippetField :: Context String

-- | When the metadata has a field called <tt>published</tt> in one of the
--   following formats then this function can render the date.
--   
--   <ul>
--   <li><pre>Mon, 06 Sep 2010 00:01:00 +0000</pre></li>
--   <li><pre>Mon, 06 Sep 2010 00:01:00 UTC</pre></li>
--   <li><pre>Mon, 06 Sep 2010 00:01:00</pre></li>
--   <li><pre>2010-09-06T00:01:00+0000</pre></li>
--   <li><pre>2010-09-06T00:01:00Z</pre></li>
--   <li><pre>2010-09-06T00:01:00</pre></li>
--   <li><pre>2010-09-06 00:01:00+0000</pre></li>
--   <li><pre>2010-09-06 00:01:00</pre></li>
--   <li><pre>September 06, 2010 00:01 AM</pre></li>
--   </ul>
--   
--   Following date-only formats are supported too (<tt>00:00:00</tt> for
--   time is assumed)
--   
--   <ul>
--   <li><pre>2010-09-06</pre></li>
--   <li><pre>06.09.2010</pre></li>
--   <li><pre>September 06, 2010</pre></li>
--   </ul>
--   
--   Alternatively, when the metadata has a field called <tt>path</tt> in a
--   <tt>folder/yyyy-mm-dd-title.extension</tt> format (the convention for
--   pages) and no <tt>published</tt> metadata field set, this function can
--   render the date. This pattern matches the file name or directory names
--   that begins with <tt>yyyy-mm-dd</tt> . For example:
--   <tt>folder/<i>yyyy-mm-dd-title</i><i>dist</i>/main.extension</tt> . In
--   case of multiple matches, the rightmost one is used.
--   
--   As another alternative, if none of the above matches, and the file has
--   a path which contains nested directories specifying a date, then that
--   date will be used. In other words, if the path is of the form
--   <tt>**/<i>yyyy</i><i>mm</i><i>dd</i>/main.extension</tt> . As above,
--   in case of multiple matches, the rightmost one is used.
dateField :: String -> String -> Context a

-- | This is an extended version of <a>dateField</a> that allows you to
--   specify a time locale that is used for outputting the date. For more
--   details, see <a>dateField</a> and <a>formatTime</a>.
dateFieldWith :: TimeLocale -> String -> String -> Context a

-- | Parser to try to extract and parse the time from the
--   <tt>published</tt> field or from the filename. See <a>dateField</a>
--   for more information. Exported for user convenience.
getItemUTC :: (MonadMetadata m, MonadFail m) => TimeLocale -> Identifier -> m UTCTime

-- | Get the time on which the actual file was last modified. This only
--   works if there actually is an underlying file, of couse.
getItemModificationTime :: Identifier -> Compiler UTCTime

-- | Creates a field with the last modification date of the underlying
--   item.
modificationTimeField :: String -> String -> Context a

-- | Creates a field with the last modification date of the underlying item
--   in a custom localisation format (see <a>formatTime</a>).
modificationTimeFieldWith :: TimeLocale -> String -> String -> Context a

-- | A context with "teaser" key which contain a teaser of the item. The
--   item is loaded from the given snapshot (which should be saved in the
--   user code before any templates are applied).
teaserField :: String -> Snapshot -> Context String

-- | A context with "teaser" key which contain a teaser of the item,
--   defined as the snapshot content before the teaser separator. The item
--   is loaded from the given snapshot (which should be saved in the user
--   code before any templates are applied).
teaserFieldWithSeparator :: String -> String -> Snapshot -> Context String

-- | Constantly reports any field as missing. Mostly for internal usage, it
--   is the last choice in every context used in a template application.
missingField :: Context a
instance GHC.Base.Semigroup (Hakyll.Web.Template.Context.Context a)
instance GHC.Base.Monoid (Hakyll.Web.Template.Context.Context a)


-- | This module containing some specialized functions to deal with tags.
--   It assumes you follow some conventions.
--   
--   We support two types of tags: tags and categories.
--   
--   To use default tags, use <a>buildTags</a>. Tags are placed in a
--   comma-separated metadata field like this:
--   
--   <pre>
--   ---
--   author: Philip K. Dick
--   title: Do androids dream of electric sheep?
--   tags: future, science fiction, humanoid
--   ---
--   The novel is set in a post-apocalyptic near future, where the Earth and
--   its populations have been damaged greatly by Nuclear...
--   </pre>
--   
--   To use categories, use the <a>buildCategories</a> function. Categories
--   are determined by the directory a page is in, for example, the post
--   
--   <pre>
--   posts/coding/2010-01-28-hakyll-categories.markdown
--   </pre>
--   
--   will receive the <tt>coding</tt> category.
--   
--   Advanced users may implement custom systems using <a>buildTagsWith</a>
--   if desired.
--   
--   In the above example, we would want to create a page which lists all
--   pages in the <tt>coding</tt> category, for example, with the
--   <a>Identifier</a>:
--   
--   <pre>
--   tags/coding.html
--   </pre>
--   
--   This is where the first parameter of <a>buildTags</a> and
--   <a>buildCategories</a> comes in. In the above case, we used the
--   function:
--   
--   <pre>
--   fromCapture "tags/*.html" :: String -&gt; Identifier
--   </pre>
--   
--   The <a>tagsRules</a> function lets you generate such a page for each
--   tag in the <a>Rules</a> monad.
module Hakyll.Web.Tags

-- | Data about tags
data Tags
Tags :: [(String, [Identifier])] -> (String -> Identifier) -> Dependency -> Tags
[tagsMap] :: Tags -> [(String, [Identifier])]
[tagsMakeId] :: Tags -> String -> Identifier
[tagsDependency] :: Tags -> Dependency

-- | Obtain tags from a page in the default way: parse them from the
--   <tt>tags</tt> metadata field. This can either be a list or a
--   comma-separated string.
getTags :: MonadMetadata m => Identifier -> m [String]

-- | Obtain tags from a page by name of the metadata field. These can be a
--   list or a comma-separated string
getTagsByField :: MonadMetadata m => String -> Identifier -> m [String]

-- | Obtain category from a page.
getCategory :: MonadMetadata m => Identifier -> m [String]

-- | Higher-order function to read tags
buildTagsWith :: MonadMetadata m => (Identifier -> m [String]) -> Pattern -> (String -> Identifier) -> m Tags
buildTags :: MonadMetadata m => Pattern -> (String -> Identifier) -> m Tags
buildCategories :: MonadMetadata m => Pattern -> (String -> Identifier) -> m Tags
tagsRules :: Tags -> (String -> Pattern -> Rules ()) -> Rules ()

-- | Render tags in HTML (the flexible higher-order function)
renderTags :: (String -> String -> Int -> Int -> Int -> String) -> ([String] -> String) -> Tags -> Compiler String

-- | Render a tag cloud in HTML
renderTagCloud :: Double -> Double -> Tags -> Compiler String

-- | Render a tag cloud in HTML
renderTagCloudWith :: (Double -> Double -> String -> String -> Int -> Int -> Int -> String) -> ([String] -> String) -> Double -> Double -> Tags -> Compiler String

-- | Render a tag cloud in HTML as a context
tagCloudField :: String -> Double -> Double -> Tags -> Context a

-- | Render a tag cloud in HTML as a context
tagCloudFieldWith :: String -> (Double -> Double -> String -> String -> Int -> Int -> Int -> String) -> ([String] -> String) -> Double -> Double -> Tags -> Context a

-- | Render a simple tag list in HTML, with the tag count next to the item
--   TODO: Maybe produce a Context here
renderTagList :: Tags -> Compiler String

-- | Render tags with links
tagsField :: String -> Tags -> Context a

-- | Render tags with links with custom functions to get tags and to render
--   links
tagsFieldWith :: (Identifier -> Compiler [String]) -> (String -> Maybe FilePath -> Maybe Html) -> ([Html] -> Html) -> String -> Tags -> Context a

-- | Render the category in a link
categoryField :: String -> Tags -> Context a

-- | Render one tag link
simpleRenderLink :: String -> Maybe FilePath -> Maybe Html

-- | Sort tags using supplied function. First element of the tuple passed
--   to the comparing function is the actual tag name.
sortTagsBy :: ((String, [Identifier]) -> (String, [Identifier]) -> Ordering) -> Tags -> Tags

-- | Sample sorting function that compares tags case insensitively.
caseInsensitiveTags :: (String, [Identifier]) -> (String, [Identifier]) -> Ordering

module Hakyll.Web.Paginate
type PageNumber = Int

-- | Data about paginators
data Paginate
Paginate :: Map PageNumber [Identifier] -> (PageNumber -> Identifier) -> Dependency -> Paginate
[paginateMap] :: Paginate -> Map PageNumber [Identifier]
[paginateMakeId] :: Paginate -> PageNumber -> Identifier
[paginateDependency] :: Paginate -> Dependency
buildPaginateWith :: MonadMetadata m => ([Identifier] -> m [[Identifier]]) -> Pattern -> (PageNumber -> Identifier) -> m Paginate
paginateEvery :: Int -> [a] -> [[a]]
paginateRules :: Paginate -> (PageNumber -> Pattern -> Rules ()) -> Rules ()

-- | A default paginate context which provides the following keys:
--   
--   <ul>
--   <li><pre>firstPageNum</pre></li>
--   <li><pre>firstPageUrl</pre></li>
--   <li><pre>previousPageNum</pre></li>
--   <li><pre>previousPageUrl</pre></li>
--   <li><pre>nextPageNum</pre></li>
--   <li><pre>nextPageUrl</pre></li>
--   <li><pre>lastPageNum</pre></li>
--   <li><pre>lastPageUrl</pre></li>
--   <li><pre>currentPageNum</pre></li>
--   <li><pre>currentPageUrl</pre></li>
--   <li><pre>numPages</pre></li>
--   <li><pre>allPages</pre></li>
--   </ul>
paginateContext :: Paginate -> PageNumber -> Context a


-- | Module containing the elements used in a template. A template is
--   generally just a list of these elements.
module Hakyll.Web.Template.Internal.Element
newtype TemplateKey
TemplateKey :: String -> TemplateKey

-- | Expression in a template
data TemplateExpr
Ident :: TemplateKey -> TemplateExpr
Call :: TemplateKey -> [TemplateExpr] -> TemplateExpr
StringLiteral :: String -> TemplateExpr

-- | Elements of a template.
data TemplateElement
Chunk :: String -> TemplateElement
Expr :: TemplateExpr -> TemplateElement
Escaped :: TemplateElement
If :: TemplateExpr -> [TemplateElement] -> Maybe [TemplateElement] -> TemplateElement
For :: TemplateExpr -> [TemplateElement] -> Maybe [TemplateElement] -> TemplateElement
Partial :: TemplateExpr -> TemplateElement
TrimL :: TemplateElement
TrimR :: TemplateElement
templateElems :: Parser [TemplateElement]
parseTemplateElemsFile :: FilePath -> String -> Either String [TemplateElement]
instance GHC.Classes.Eq Hakyll.Web.Template.Internal.Element.TemplateKey
instance GHC.Show.Show Hakyll.Web.Template.Internal.Element.TemplateKey
instance Data.Binary.Class.Binary Hakyll.Web.Template.Internal.Element.TemplateKey
instance GHC.Classes.Eq Hakyll.Web.Template.Internal.Element.TemplateExpr
instance GHC.Classes.Eq Hakyll.Web.Template.Internal.Element.TemplateElement
instance GHC.Show.Show Hakyll.Web.Template.Internal.Element.TemplateElement
instance Data.Binary.Class.Binary Hakyll.Web.Template.Internal.Element.TemplateElement
instance GHC.Show.Show Hakyll.Web.Template.Internal.Element.TemplateExpr
instance Data.Binary.Class.Binary Hakyll.Web.Template.Internal.Element.TemplateExpr
instance Data.String.IsString Hakyll.Web.Template.Internal.Element.TemplateKey


-- | Module for trimming whitespace from tempaltes.
module Hakyll.Web.Template.Internal.Trim
trim :: [TemplateElement] -> [TemplateElement]

module Hakyll.Web.Template.Internal

-- | Datatype used for template substitutions.
data Template
Template :: [TemplateElement] -> FilePath -> Template
[tplElements] :: Template -> [TemplateElement]
[tplOrigin] :: Template -> FilePath

-- | Wrap the constructor to ensure trim is called.
template :: FilePath -> [TemplateElement] -> Template

-- | Read a template, without metadata header
templateBodyCompiler :: Compiler (Item Template)

-- | Read complete file contents as a template
templateCompiler :: Compiler (Item Template)

-- | Interpolate template expressions from context values in a page
applyTemplate :: Template -> Context a -> Item a -> Compiler (Item String)

-- | The following pattern is so common:
--   
--   <pre>
--   tpl &lt;- loadBody "templates/foo.html"
--   someCompiler
--       &gt;&gt;= applyTemplate tpl context
--   </pre>
--   
--   That we have a single function which does this:
--   
--   <pre>
--   someCompiler
--       &gt;&gt;= loadAndApplyTemplate "templates/foo.html" context
--   </pre>
loadAndApplyTemplate :: Identifier -> Context a -> Item a -> Compiler (Item String)

-- | It is also possible that you want to substitute <tt>$key$</tt>s within
--   the body of an item. This function does that by interpreting the item
--   body as a template, and then applying it to itself.
applyAsTemplate :: Context String -> Item String -> Compiler (Item String)

-- | Parse a string into a template. You should prefer
--   <a>compileTemplateItem</a> over this.

-- | <i>Deprecated: Use templateCompiler instead</i>
readTemplate :: String -> Template

-- | Parse an item body into a template. Provides useful error messages in
--   the <a>Compiler</a> monad.
compileTemplateItem :: Item String -> Compiler Template

-- | <i>Deprecated: Use templateCompiler</i>
unsafeReadTemplateFile :: FilePath -> Compiler Template
instance Data.Binary.Class.Binary Hakyll.Web.Template.Internal.Template
instance GHC.Generics.Generic Hakyll.Web.Template.Internal.Template
instance GHC.Classes.Eq Hakyll.Web.Template.Internal.Template
instance GHC.Show.Show Hakyll.Web.Template.Internal.Template
instance Hakyll.Core.Writable.Writable Hakyll.Web.Template.Internal.Template
instance Data.String.IsString Hakyll.Web.Template.Internal.Template


-- | This module provides means for reading and applying <a>Template</a>s.
--   
--   Templates are tools to convert items into a string. They are perfectly
--   suited for laying out your site.
--   
--   Let's look at an example template:
--   
--   <pre>
--   &lt;html&gt;
--       &lt;head&gt;
--           &lt;title&gt;My crazy homepage - $title$&lt;/title&gt;
--       &lt;/head&gt;
--       &lt;body&gt;
--           &lt;div id="header"&gt;
--               &lt;h1&gt;My crazy homepage - $title$&lt;/h1&gt;
--           &lt;/div&gt;
--           &lt;div id="content"&gt;
--               $body$
--           &lt;/div&gt;
--           &lt;div id="footer"&gt;
--               By reading this you agree that I now own your soul
--           &lt;/div&gt;
--       &lt;/body&gt;
--   &lt;/html&gt;
--   </pre>
--   
--   As you can see, the format is very simple -- <tt>$key$</tt> is used to
--   render the <tt>$key$</tt> field from the page, everything else is
--   literally copied. If you want to literally insert <tt>"$key$"</tt>
--   into your page (for example, when you're writing a Hakyll tutorial)
--   you can use
--   
--   <pre>
--   &lt;p&gt;
--       A literal $$key$$.
--   &lt;/p&gt;
--   </pre>
--   
--   Because of it's simplicity, these templates can be used for more than
--   HTML: you could make, for example, CSS or JS templates as well.
--   
--   Apart from interpolating <tt>$key$</tt>s from the <tt>Context</tt> you
--   can also use the following macros:
--   
--   <ul>
--   <li><pre>$if(key)$</pre></li>
--   </ul>
--   
--   <pre>
--   $if(key)$
--    &lt;b&gt; Defined &lt;/b&gt;
--   $else$
--    &lt;b&gt; Non-defined &lt;/b&gt;
--   $endif$
--   </pre>
--   
--   This example will print <tt>Defined</tt> if <tt>key</tt> is defined in
--   the context and <tt>Non-defined</tt> otherwise. The <tt>$else$</tt>
--   clause is optional.
--   
--   <ul>
--   <li><pre>$for(key)$</pre></li>
--   </ul>
--   
--   The <tt>for</tt> macro is used for enumerating <tt>Context</tt>
--   elements that are lists, i.e. constructed using the <tt>listField</tt>
--   function. Assume that in a context we have an element <tt>listField
--   "key" c itms</tt>. Then the snippet
--   
--   <pre>
--   $for(key)$
--     $x$
--   $sep$,
--   $endfor$
--   </pre>
--   
--   would, for each item <tt>i</tt> in <tt>itms</tt>, lookup <tt>$x$</tt>
--   in the context <tt>c</tt> with item <tt>i</tt>, interpolate it, and
--   join the resulting list with <tt>,</tt>.
--   
--   Another concrete example one may consider is the following. Given the
--   context
--   
--   <pre>
--   listField "things" (field "thing" (return . itemBody))
--      (sequence [makeItem "fruits", makeItem "vegetables"])
--   </pre>
--   
--   and a template
--   
--   <pre>
--   I like
--   $for(things)$
--     fresh $thing$$sep$, and
--   $endfor$
--   </pre>
--   
--   the resulting page would look like
--   
--   <pre>
--   &lt;p&gt;
--    I like
--   
--     fresh fruits, and
--   
--     fresh vegetables
--   &lt;/p&gt;
--   </pre>
--   
--   The <tt>$sep$</tt> part can be omitted. Usually, you can get by using
--   the <tt>applyListTemplate</tt> and <tt>applyJoinListTemplate</tt>
--   functions.
--   
--   <ul>
--   <li><pre>$partial(path)$</pre></li>
--   </ul>
--   
--   Loads a template located in a separate file and interpolates it under
--   the current context.
--   
--   Assuming that the file <tt>test.html</tt> contains
--   
--   <pre>
--   &lt;b&gt;$key$&lt;/b&gt;
--   </pre>
--   
--   The result of rendering
--   
--   <pre>
--   &lt;p&gt;
--     $partial("test.html")$
--   &lt;/p&gt;
--   </pre>
--   
--   is the same as the result of rendering
--   
--   <pre>
--   &lt;p&gt;
--     &lt;b&gt;$key$&lt;/b&gt;
--   &lt;/p&gt;
--   </pre>
--   
--   That is, calling <tt>$partial$</tt> is equivalent to just copying and
--   pasting template code.
--   
--   In the examples above you can see that the outputs contain a lot of
--   leftover whitespace that you may wish to remove. Using
--   <tt><tt>$-</tt></tt> or <tt><tt>-$</tt></tt> instead of
--   <tt><a>$</a></tt> in a macro strips all whitespace to the left or
--   right of that clause respectively. Given the context
--   
--   <pre>
--   listField "counts" (field "count" (return . itemBody))
--      (sequence [makeItem "3", makeItem "2", makeItem "1"])
--   </pre>
--   
--   and a template
--   
--   <pre>
--   &lt;p&gt;
--       $for(counts)-$
--         $count$
--         $-sep$...
--       $-endfor$
--   &lt;/p&gt;
--   </pre>
--   
--   the resulting page would look like
--   
--   <pre>
--   &lt;p&gt;
--       3...2...1
--   &lt;/p&gt;
--   </pre>
module Hakyll.Web.Template

-- | Datatype used for template substitutions.
data Template

-- | Read a template, without metadata header
templateBodyCompiler :: Compiler (Item Template)

-- | Read complete file contents as a template
templateCompiler :: Compiler (Item Template)

-- | Interpolate template expressions from context values in a page
applyTemplate :: Template -> Context a -> Item a -> Compiler (Item String)

-- | The following pattern is so common:
--   
--   <pre>
--   tpl &lt;- loadBody "templates/foo.html"
--   someCompiler
--       &gt;&gt;= applyTemplate tpl context
--   </pre>
--   
--   That we have a single function which does this:
--   
--   <pre>
--   someCompiler
--       &gt;&gt;= loadAndApplyTemplate "templates/foo.html" context
--   </pre>
loadAndApplyTemplate :: Identifier -> Context a -> Item a -> Compiler (Item String)

-- | It is also possible that you want to substitute <tt>$key$</tt>s within
--   the body of an item. This function does that by interpreting the item
--   body as a template, and then applying it to itself.
applyAsTemplate :: Context String -> Item String -> Compiler (Item String)

-- | Parse a string into a template. You should prefer
--   <a>compileTemplateItem</a> over this.

-- | <i>Deprecated: Use templateCompiler instead</i>
readTemplate :: String -> Template

-- | Parse an item body into a template. Provides useful error messages in
--   the <a>Compiler</a> monad.
compileTemplateItem :: Item String -> Compiler Template

-- | <i>Deprecated: Use templateCompiler</i>
unsafeReadTemplateFile :: FilePath -> Compiler Template

-- | Embed template allows you embed a template within the Haskell binary.
--   Example:
--   
--   <pre>
--   myTemplate :: Template
--   myTemplate = $(embedTemplate "test.html")
--   </pre>
embedTemplate :: FilePath -> Q Exp


-- | Twitter Card metadata, as described at
--   <a>https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started</a>.
--   This feature should be used alongside
--   <a>Hakyll.Web.Meta.OpenGraph</a>. The following properties are
--   supported:
--   
--   TODO: table
--   
--   To use, add <tt>openGraphField</tt> and <a>twitterCardField</a> to the
--   template context:
--   
--   <pre>
--   let
--     context = <a>defaultContext</a> &lt;&gt; …
--     postContext =
--       context
--       &lt;&gt; <tt>openGraphField</tt> "opengraph" context
--       &lt;&gt; <a>twitterCardField</a> "twitter" context
--   </pre>
--   
--   and update the template:
--   
--   <pre>
--   &lt;head&gt;
--     &lt;title&gt;$title$&lt;/title&gt;
--     &lt;link rel="stylesheet" type="text/css" href="/css/default.css" /&gt;
--     $if(opengraph)$$opengraph$$endif$
--     $if(twitter)$$twitter$$endif$
--   &lt;/head&gt;
--   </pre>
module Hakyll.Web.Meta.TwitterCard
twitterCardField :: String -> Context String -> Context String


-- | Open Graph metadata, as described at <a>https://ogp.me/</a>. This
--   implementation supports the following properties:
--   
--   TODO: table
--   
--   To use, add <a>openGraphField</a> to the template context:
--   
--   <pre>
--   let
--     context = <a>defaultContext</a> &lt;&gt; …
--     postContext = context &lt;&gt; <a>openGraphField</a> "opengraph" context
--   </pre>
--   
--   and update the template:
--   
--   <pre>
--   &lt;head&gt;
--     &lt;title&gt;$title$<a>/title</a>
--     &lt;link rel="stylesheet" type="text/css" href="/css/default.css" /&gt;
--     $if(opengraph)$$opengraph$$endif$
--   &lt;/head&gt;
--   </pre>
--   
--   See also <a>Hakyll.Web.Meta.TwitterCard</a>.
module Hakyll.Web.Meta.OpenGraph
openGraphField :: String -> Context String -> Context String


-- | JSON-LD metadata, using <a>Schema.org</a> vocabulary for articles.
--   Google applications and other search engines use these data to improve
--   search results and links.
--   
--   This implementation supports the following fields:
--   
--   TODO: table
--   
--   To use, add a <a>jsonldField</a> to your template context:
--   
--   <pre>
--   let
--     context = <a>defaultContext</a> &lt;&gt; …
--     postContext =
--       context
--       &lt;&gt; <a>jsonldField</a> "jsonld" context
--   </pre>
--   
--   And update the template:
--   
--   <pre>
--   &lt;head&gt;
--     &lt;title&gt;$title$&lt;/title&gt;
--     &lt;link rel="stylesheet" type="text/css" href="/css/default.css" /&gt;
--     $if(jsonld)$$jsonld("embed")$$endif$
--   &lt;/head&gt;
--   </pre>
--   
--   The <tt>"embed"</tt> argument generates a <tt>&lt;script …&gt;</tt>
--   tag to be directly included in page HTML. To get the raw JSON string,
--   use <tt>"raw"</tt> instead.
module Hakyll.Web.Meta.JSONLD
jsonldField :: String -> Context String -> Context String


-- | Provides an easy way to combine several items in a list. The
--   applications are obvious:
--   
--   <ul>
--   <li>A post list on a blog</li>
--   <li>An image list in a gallery</li>
--   <li>A sitemap</li>
--   </ul>
module Hakyll.Web.Template.List

-- | Generate a string of a listing of pages, after applying a template to
--   each page.
applyTemplateList :: Template -> Context a -> [Item a] -> Compiler String

-- | Join a listing of pages with a string in between, after applying a
--   template to each page.
applyJoinTemplateList :: String -> Template -> Context a -> [Item a] -> Compiler String

-- | Sort pages chronologically. Uses the same method as <a>dateField</a>
--   for extracting the date.
chronological :: (MonadMetadata m, MonadFail m) => [Item a] -> m [Item a]

-- | The reverse of <a>chronological</a>
recentFirst :: (MonadMetadata m, MonadFail m) => [Item a] -> m [Item a]

-- | Version of <a>chronological</a> which doesn't need the actual items.
sortChronological :: (MonadMetadata m, MonadFail m) => [Identifier] -> m [Identifier]

-- | Version of <a>recentFirst</a> which doesn't need the actual items.
sortRecentFirst :: (MonadMetadata m, MonadFail m) => [Identifier] -> m [Identifier]


-- | A Module that allows easy rendering of RSS feeds.
--   
--   The main rendering functions (<tt>renderRss</tt>, <tt>renderAtom</tt>)
--   all assume that you pass the list of items so that the most recent
--   entry in the feed is the first item in the list.
--   
--   Also note that the context should have (at least) the following fields
--   to produce a correct feed:
--   
--   <ul>
--   <li><tt>$title$</tt>: Title of the item</li>
--   <li><tt>$description$</tt>: Description to appear in the feed</li>
--   <li><tt>$url$</tt>: URL to the item - this is usually set
--   automatically.</li>
--   </ul>
--   
--   In addition, the posts should be named according to the rules for
--   <a>dateField</a>
module Hakyll.Web.Feed

-- | This is a data structure to keep the configuration of a feed.
data FeedConfiguration
FeedConfiguration :: String -> String -> String -> String -> String -> FeedConfiguration

-- | Title of the feed.
[feedTitle] :: FeedConfiguration -> String

-- | Description of the feed.
[feedDescription] :: FeedConfiguration -> String

-- | Name of the feed author.
[feedAuthorName] :: FeedConfiguration -> String

-- | Email of the feed author. Set this to the empty String to leave out
--   the email address.
[feedAuthorEmail] :: FeedConfiguration -> String

-- | Absolute root URL of the feed site (e.g.
--   <tt><a>http://jaspervdj.be</a></tt>)
[feedRoot] :: FeedConfiguration -> String

-- | Render an RSS feed with a number of items.
renderRss :: FeedConfiguration -> Context String -> [Item String] -> Compiler (Item String)

-- | Render an Atom feed with a number of items.
renderAtom :: FeedConfiguration -> Context String -> [Item String] -> Compiler (Item String)

-- | Render a JSON feed with a number of items.
--   
--   Items' bodies will be put into <tt>content_html</tt> field of the
--   resulting JSON; the <tt>content</tt> field will not be set.
renderJson :: FeedConfiguration -> Context String -> [Item String] -> Compiler (Item String)

-- | Render an RSS feed using given templates with a number of items.
renderRssWithTemplates :: Template -> Template -> FeedConfiguration -> Context String -> [Item String] -> Compiler (Item String)

-- | Render an Atom feed using given templates with a number of items.
renderAtomWithTemplates :: Template -> Template -> FeedConfiguration -> Context String -> [Item String] -> Compiler (Item String)

-- | Render a JSON feed using given templates with a number of items.
renderJsonWithTemplates :: Template -> Template -> FeedConfiguration -> Context String -> [Item String] -> Compiler (Item String)
instance GHC.Classes.Eq Hakyll.Web.Feed.FeedConfiguration
instance GHC.Show.Show Hakyll.Web.Feed.FeedConfiguration
instance GHC.Classes.Eq Hakyll.Web.Feed.FeedType
instance GHC.Show.Show Hakyll.Web.Feed.FeedType


-- | Implementation of Hakyll commands: build, preview...
module Hakyll.Commands
data Check
All :: Check
InternalLinks :: Check

-- | Build the site
build :: RunMode -> Configuration -> Logger -> Rules a -> IO ExitCode

-- | Run the checker and exit
check :: Configuration -> Logger -> Check -> IO ExitCode

-- | Remove the output directories
clean :: Configuration -> Logger -> IO ()

-- | Preview the site
preview :: Configuration -> Logger -> Rules a -> Int -> IO ()

-- | Rebuild the site
rebuild :: Configuration -> Logger -> Rules a -> IO ExitCode

-- | Start a server
server :: Configuration -> Logger -> String -> Int -> IO ()

-- | Upload the site
deploy :: Configuration -> IO ExitCode

-- | Watch and recompile for changes
watch :: Configuration -> Logger -> String -> Int -> Bool -> Rules a -> IO ()


-- | Module providing the main hakyll function and command-line argument
--   parsing
module Hakyll.Main

-- | This usually is the function with which the user runs the hakyll
--   compiler
hakyll :: Rules a -> IO ()

-- | A variant of <a>hakyll</a> which allows the user to specify a custom
--   configuration
hakyllWith :: Configuration -> Rules a -> IO ()

-- | A variant of <a>hakyll</a> which expects a <tt>Configuration</tt> and
--   command-line <a>Options</a>. This gives freedom to implement your own
--   parsing.
hakyllWithArgs :: Configuration -> Options -> Rules a -> IO ()

-- | A variant of <a>hakyll</a> which returns an <a>ExitCode</a>
hakyllWithExitCode :: Configuration -> Rules a -> IO ExitCode
hakyllWithExitCodeAndArgs :: Configuration -> Options -> Rules a -> IO ExitCode

-- | The parsed command-line options.
data Options
Options :: Bool -> Command -> Options
[verbosity] :: Options -> Bool
[optCommand] :: Options -> Command

-- | The command to run.
data Command

-- | Generate the site.
Build :: RunMode -> Command

-- | Validate the site output.
Check :: Bool -> Command
[internal_links] :: Command -> Bool

-- | Clean up and remove cache.
Clean :: Command

-- | Upload/deploy your site.
Deploy :: Command

-- | <ul>
--   <li><i>DEPRECATED</i> Please use the watch command.</li>
--   </ul>

-- | <i>Deprecated: Use Watch instead.</i>
Preview :: Int -> Command
[port] :: Command -> Int

-- | Clean and build again.
Rebuild :: Command

-- | Start a preview server.
Server :: String -> Int -> Command
[host] :: Command -> String
[port] :: Command -> Int

-- | Autocompile on changes and start a preview server.
Watch :: String -> Int -> Bool -> Command
[host] :: Command -> String
[port] :: Command -> Int
[no_server] :: Command -> Bool
optionParser :: Configuration -> Parser Options
commandParser :: Configuration -> Parser Command
defaultCommands :: Configuration -> [(String, Parser Command, InfoMod a)]
defaultParser :: Configuration -> IO Options
defaultParserPure :: Configuration -> [String] -> ParserResult Options
defaultParserPrefs :: ParserPrefs
defaultParserInfo :: Configuration -> ParserInfo Options
instance GHC.Show.Show Hakyll.Main.Command
instance GHC.Show.Show Hakyll.Main.Options


-- | Top-level module exporting all modules that are interesting for the
--   user
module Hakyll
