-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A simple static site generator library. -- -- A simple static site generator library, mainly aimed at creating blogs -- and brochure sites. @package hakyll @version 2.4 -- | This (quite small) module exports the datatype used for contexts. A -- Context is a simple key-value mapping. You can render these -- Contexts with templates, and manipulate them in various ways. module Text.Hakyll.Context -- | Datatype used for key-value mappings. newtype Context Context :: Map String String -> Context -- | Extract the context. unContext :: Context -> Map String String instance Show Context instance Monoid Context instance Binary Context -- | Module describing the Hakyll monad stack. module Text.Hakyll.HakyllMonad -- | Hakyll global configuration type. data HakyllConfiguration HakyllConfiguration :: String -> Context -> FilePath -> FilePath -> Bool -> PreviewMode -> ParserState -> WriterOptions -> HamletSettings -> HakyllConfiguration -- | Absolute URL of the site. absoluteUrl :: HakyllConfiguration -> String -- | An additional context to use when rendering. This additional context -- is used globally. additionalContext :: HakyllConfiguration -> Context -- | Directory where the site is placed. siteDirectory :: HakyllConfiguration -> FilePath -- | Directory for cache files. cacheDirectory :: HakyllConfiguration -> FilePath -- | Enable index links. enableIndexUrl :: HakyllConfiguration -> Bool -- | The preview mode used previewMode :: HakyllConfiguration -> PreviewMode -- | Pandoc parsing options pandocParserState :: HakyllConfiguration -> ParserState -- | Pandoc writer options pandocWriterOptions :: HakyllConfiguration -> WriterOptions -- | Hamlet settings (if you use hamlet for templates) hamletSettings :: HakyllConfiguration -> HamletSettings -- | Preview mode. data PreviewMode BuildOnRequest :: PreviewMode BuildOnInterval :: PreviewMode -- | Our custom monad stack. type Hakyll = ReaderT HakyllConfiguration IO -- | Simplified ask function for the Hakyll monad stack. -- -- Usage would typically be something like: -- --
--   doSomething :: a -> b -> Hakyll c
--   doSomething arg1 arg2 = do
--       siteDirectory' <- askHakyll siteDirectory
--       ...
--   
askHakyll :: (HakyllConfiguration -> a) -> Hakyll a -- | Obtain the globally available, additional context. getAdditionalContext :: HakyllConfiguration -> Context -- | Write some log information. logHakyll :: String -> Hakyll () -- | Perform a concurrent hakyll action. Returns an MVar you can wait on forkHakyllWait :: Hakyll () -> Hakyll (MVar ()) -- | Perform a number of concurrent hakyll actions, and waits for them to -- finish concurrentHakyll :: [Hakyll ()] -> Hakyll () instance Show PreviewMode instance Eq PreviewMode instance Ord PreviewMode -- | A module containing various function for manipulating and examinating -- files and directories. module Text.Hakyll.File -- | Convert a relative filepath to a filepath in the destination (default: -- _site). toDestination :: FilePath -> Hakyll FilePath -- | Convert a relative filepath to a filepath in the cache (default: -- _cache). toCache :: FilePath -> Hakyll FilePath -- | Get the url for a given page. For most extensions, this would be the -- path itself. It's only for rendered extensions (.markdown, -- .rst, .lhs this function returns a path with a -- .html extension instead. toUrl :: FilePath -> Hakyll FilePath -- | Get the relative url to the site root, for a given (absolute) url toRoot :: FilePath -> FilePath -- | Check if a file is in a given directory. inDirectory :: FilePath -> FilePath -> Bool -- | Check if a file is in a Hakyll directory. With a Hakyll directory, we -- mean a directory that should be ignored such as the -- _site or _cache directory. -- -- Example: -- --
--   inHakyllDirectory "_cache/pages/index.html"
--   
-- -- Result: -- --
--   True
--   
inHakyllDirectory :: FilePath -> Hakyll Bool -- | Swaps spaces for -. removeSpaces :: FilePath -> FilePath -- | Given a path to a file, try to make the path writable by making all -- directories on the path. makeDirectories :: FilePath -> Hakyll () -- | Get all contents of a directory. Note that files starting with a dot -- (.) will be ignored. getRecursiveContents :: FilePath -> Hakyll [FilePath] -- | Sort a list of filenames on the basename. sortByBaseName :: [FilePath] -> [FilePath] -- | A filter that takes all file names with a given extension. Prefix the -- extension with a dot: -- --
--   havingExtension ".markdown" [ "index.markdown"
--                               , "style.css"
--                               ] == ["index.markdown"]
--   
havingExtension :: String -> [FilePath] -> [FilePath] -- | Perform a Hakyll action on every file in a given directory. directory :: (FilePath -> Hakyll ()) -> FilePath -> Hakyll () -- | Check if a timestamp is newer then a number of given files. isMoreRecent :: ClockTime -> [FilePath] -> Hakyll Bool -- | Check if a file is newer then a number of given files. isFileMoreRecent :: FilePath -> [FilePath] -> Hakyll Bool -- | This is the module which exports HakyllAction. module Text.Hakyll.HakyllAction -- | Type used for rendering computations that carry along dependencies. data HakyllAction a b HakyllAction :: [FilePath] -> Either (Hakyll FilePath) (Hakyll FilePath -> Hakyll FilePath) -> (a -> Hakyll b) -> HakyllAction a b -- | Dependencies of the HakyllAction. actionDependencies :: HakyllAction a b -> [FilePath] -- | URL pointing to the result of this HakyllAction. actionUrl :: HakyllAction a b -> Either (Hakyll FilePath) (Hakyll FilePath -> Hakyll FilePath) -- | The actual render function. actionFunction :: HakyllAction a b -> a -> Hakyll b -- | Create a HakyllAction from a function. createHakyllAction :: (a -> Hakyll b) -> HakyllAction a b -- | Create a HakyllAction from a simple Hakyll value. createSimpleHakyllAction :: Hakyll b -> HakyllAction () b -- | Create a HakyllAction that operates on one file. createFileHakyllAction :: FilePath -> Hakyll b -> HakyllAction () b -- | Chain a number of HakyllAction computations. chain :: [HakyllAction a a] -> HakyllAction a a -- | Run a HakyllAction now. runHakyllAction :: HakyllAction () a -> Hakyll a -- | Run a HakyllAction, but only when it is out-of-date. At this -- point, the actionUrl field must be set. runHakyllActionIfNeeded :: HakyllAction () () -> Hakyll () instance Arrow HakyllAction instance Category HakyllAction -- | A module that exports a simple regex interface. This code is mostly -- copied from the regex-compat package at hackage. I decided to write -- this module because I want to abstract the regex package used. module Text.Hakyll.Regex -- | Split a list at a certain element. splitRegex :: String -> String -> [String] -- | Substitute a regex. Simplified interface. This function performs a -- global substitution. substituteRegex :: String -> String -> String -> String -- | Simple regex matching. matchesRegex :: String -> String -> Bool -- | This module exports a number of functions that produce -- HakyllActions to manipulate Contexts. module Text.Hakyll.ContextManipulations -- | Do something with a value in a Context, but keep the old -- value as well. If the key given is not present in the -- Context, nothing will happen. renderValue :: String -> String -> (String -> String) -> HakyllAction Context Context -- | Change a value in a Context. -- --
--   import Data.Char (toUpper)
--   changeValue "title" (map toUpper)
--   
-- -- Will put the title in UPPERCASE. changeValue :: String -> (String -> String) -> HakyllAction Context Context -- | Change the URL of a page. This requires a special function, so -- dependency handling can happen correctly. changeUrl :: (String -> String) -> HakyllAction Context Context -- | Copy a value from one key to another in a Context. copyValue :: String -> String -> HakyllAction Context Context -- | When the context has a key called path in a -- folder/yyyy-mm-dd-title.extension format (the convention for -- pages), this function can render the date. -- --
--   renderDate "date" "%B %e, %Y" "Date unknown"
--   
-- -- Will render something like January 32, 2010. renderDate :: String -> String -> String -> HakyllAction Context Context -- | This is an extended version of renderDate that allows you to -- specify a time locale that is used for outputting the date. For more -- details, see renderDate. renderDateWithLocale :: TimeLocale -> String -> String -> String -> HakyllAction Context Context -- | Change the extension of a file. This is only needed when you want to -- render, for example, mardown to .php files instead of -- .html files. -- --
--   changeExtension "php"
--   
-- -- Will render test.markdown to test.php instead of -- test.html. changeExtension :: String -> HakyllAction Context Context -- | Change the body of a file using a certain manipulation. -- --
--   import Data.Char (toUpper)
--   renderBody (map toUpper)
--   
-- -- Will put the entire body of the page in UPPERCASE. renderBody :: (String -> String) -> HakyllAction Context Context -- | Get the resulting body text from a context takeBody :: HakyllAction Context String -- | Miscellaneous text manipulation functions. module Text.Hakyll.Util -- | Trim a string (drop spaces, tabs and newlines at both sides). trim :: String -> String -- | Strip html tags from the given string. stripHtml :: String -> String -- | Make a HTML link. -- --
--   link "foo" "bar.html" == "<a href='bar.html'>foo</a>"
--   
link :: String -> String -> String -- | A module for dealing with Pages. This module is mostly -- internally used. module Text.Hakyll.Page -- | A page is first parsed into a number of page sections. A page section -- consists of: -- -- data PageSection PageSection :: (String, String, Bool) -> PageSection unPageSection :: PageSection -> (String, String, Bool) -- | Read a page from a file. Metadata is supported. readPage :: FilePath -> Hakyll [PageSection] -- | Read a page from a file. Metadata is supported. readPageAction :: FilePath -> HakyllAction () [PageSection] instance Show PageSection -- | Module exporting a pandoc arrow module Text.Hakyll.Pandoc -- | An action that renders the list of page sections to a context using -- pandoc renderAction :: HakyllAction [PageSection] Context -- | An action to render pages, offering just a little more flexibility renderActionWith :: HakyllAction ([PageSection], String -> String) Context -- | Module containing rendering functions. All these functions are used to -- render files to the _site directory. module Text.Hakyll.Render -- | This is the most simple render action. You render a Context -- with a template, and get back the result. render :: FilePath -> HakyllAction Context Context -- | Render each Context with the given templates, then -- concatenate the result. So, basically this function: -- -- renderAndConcat :: [FilePath] -> [HakyllAction () Context] -> HakyllAction () String -- | Chain a render action for a page with a number of templates. This will -- also write the result to the site destination. This is the preferred -- way to do general rendering. -- --
--   renderChain [ "templates/notice.html"
--               , "templates/default.html"
--               ] $ createPagePath "warning.html"
--   
-- -- This code will first render warning.html using -- templates/notice.html, and will then render the result with -- templates/default.html. renderChain :: [FilePath] -> HakyllAction () Context -> Hakyll () -- | Mark a certain file as static, so it will just be copied when the site -- is generated. static :: FilePath -> Hakyll () -- | Render a css file, compressing it. css :: FilePath -> Hakyll () -- | Write a page to the site destination. Final action after render chains -- and such. writePage :: HakyllAction Context () -- | A module that provides different ways to create a Context. -- These functions all use the HakyllAction arrow, so they -- produce values of the type HakyllAction () Context. module Text.Hakyll.CreateContext -- | Create a Context from a page file stored on the disk. This is -- probably the most common way to create a Context. createPage :: FilePath -> HakyllAction () Context -- | Create a custom page Context. -- -- The association list given maps keys to values for substitution. Note -- that as value, you can either give a String or a -- HakyllAction () String. The latter is preferred for more -- complex data, since it allows dependency checking. A String -- is obviously more simple to use in some cases. createCustomPage :: FilePath -> [(String, Either String (HakyllAction () String))] -> HakyllAction () Context -- | A createCustomPage function specialized in creating listings. -- -- This function creates a listing of a certain list of -- Contexts. Every item in the list is created by applying the -- given template to every renderable. You can also specify additional -- context to be included in the CustomPage. createListing :: FilePath -> [FilePath] -> [HakyllAction () Context] -> [(String, Either String (HakyllAction () String))] -> HakyllAction () Context -- | Add a field to a Context. addField :: String -> Either String (HakyllAction () String) -> HakyllAction Context Context -- | Combine two Contexts. The url will always be taken from the -- first Renderable. Also, if a `$key` is present in both -- renderables, the value from the first Context will be taken -- as well. -- -- You can see this as a this as a union between two mappings. combine :: HakyllAction () Context -> HakyllAction () Context -> HakyllAction () Context -- | Combine two Contexts and set a custom URL. This behaves like -- combine, except that for the url field, the given -- URL is always chosen. combineWithUrl :: FilePath -> HakyllAction () Context -> HakyllAction () Context -> HakyllAction () Context -- | Module aimed to paginate web pages. module Text.Hakyll.Paginate -- | A configuration for a pagination. data PaginateConfiguration PaginateConfiguration :: String -> String -> String -> String -> PaginateConfiguration -- | Label for the link to the previous page. previousLabel :: PaginateConfiguration -> String -- | Label for the link to the next page. nextLabel :: PaginateConfiguration -> String -- | Label for the link to the first page. firstLabel :: PaginateConfiguration -> String -- | Label for the link to the last page. lastLabel :: PaginateConfiguration -> String -- | A simple default configuration for pagination. defaultPaginateConfiguration :: PaginateConfiguration -- | The most important function for pagination. This function operates on -- a list of Contexts (the pages), and basically just adds -- fields to them by combining them with a custom page. -- -- The following metadata fields will be added: -- -- -- -- When $previous or $next are not available, they will -- be just a label without a link. The same goes for when we are on the -- first or last page for $first and $last. paginate :: PaginateConfiguration -> [HakyllAction () Context] -> [HakyllAction () Context] -- | A Module that allows easy rendering of RSS feeds. If you use this -- module, you must make sure you set the absoluteUrl field in -- the main Hakyll configuration. -- -- Apart from that, the main rendering functions (renderRss, -- renderAtom) 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 Contexts should have (at least) the -- following fields to produce a correct feed: -- -- -- -- Furthermore, the feed will be generated, but will be incorrect (it -- won't validate) if an empty list is passed. module Text.Hakyll.Feed -- | This is a data structure to keep the configuration of a feed. data FeedConfiguration FeedConfiguration :: String -> String -> String -> String -> FeedConfiguration -- | Url of the feed (relative to site root). For example, -- rss.xml. feedUrl :: FeedConfiguration -> String -- | Title of the feed. feedTitle :: FeedConfiguration -> String -- | Description of the feed. feedDescription :: FeedConfiguration -> String -- | Name of the feed author. feedAuthorName :: FeedConfiguration -> String -- | Render an RSS feed with a number of items. renderRss :: FeedConfiguration -> [HakyllAction () Context] -> Hakyll () -- | Render an Atom feed with a number of items. renderAtom :: FeedConfiguration -> [HakyllAction () Context] -> Hakyll () -- | Module for a simple static configuration of a website. -- -- The configuration works like this: -- -- module Text.Hakyll.Configurations.Static -- | A simple configuration for an entirely static website. staticConfiguration :: Hakyll () -- | Module containing some specialized functions to deal with tags. This -- Module follows certain conventions. Stick with them. -- -- More concrete: all functions in this module assume that the tags are -- located in the tags field, and separated by commas. An -- example file foo.markdown could look like: -- --
--   ---
--   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...
--   
-- -- All the following functions would work with such a format. In addition -- to tags, Hakyll also supports categories. The convention when using -- categories is to place pages in subdirectories. -- -- An example, the page -- posts/coding/2010-01-28-hakyll-categories.markdown Tags or -- categories are read using the readTagMap and -- readCategoryMap functions. Because categories are implemented -- using tags - categories can be seen as tags, with the restriction that -- a page can only have one category - all functions for tags also work -- with categories. -- -- When reading a TagMap (which is also used for category maps) -- using the readTagMap or readCategoryMap function, -- you also have to give a unique identifier to it. This identifier is -- simply for caching reasons, so Hakyll can tell different maps apart; -- it has no other use. module Text.Hakyll.Tags -- | Type for a tag map. -- -- This is a map associating tags or categories to the appropriate pages -- using that tag or category. In the case of categories, each path will -- only appear under one category - this is not the case with tags. type TagMap = Map String [HakyllAction () Context] -- | Read a TagMap, using the tags metadata field. readTagMap :: String -> [FilePath] -> HakyllAction () TagMap -- | Read a TagMap, using the subdirectories the pages are placed -- in. readCategoryMap :: String -> [FilePath] -> HakyllAction () TagMap -- | Perform a Hakyll action on every item in the tag withTagMap :: HakyllAction () TagMap -> (String -> [HakyllAction () Context] -> Hakyll ()) -> Hakyll () -- | Render a tag cloud. renderTagCloud :: (String -> String) -> Float -> Float -> HakyllAction TagMap String -- | Render all tags to links. -- -- On your site, it is nice if you can display the tags on a page, but -- naturally, most people would expect these are clickable. -- -- So, this function takes a function to produce an url for a given tag, -- and applies it on all tags. -- -- Note that it is your own responsibility to ensure a page with such an -- url exists. renderTagLinks :: (String -> String) -> HakyllAction Context Context -- | Module containing a small, simple http file server for testing and -- preview purposes. module Network.Hakyll.SimpleServer -- | Start a simple http server on the given PortNumber, serving the -- given directory. simpleServer :: PortNumber -> FilePath -> IO () -> IO () instance Ord Response instance Eq Response instance Ord Request instance Eq Request instance Show Response instance Show Request -- | This is the main Hakyll module, exporting the important -- hakyll function. -- -- Most configurations would use this hakyll function more or -- less as the main function: -- --
--   main = hakyll $ do
--       directory css "css"
--       directory static "images"
--   
module Text.Hakyll -- | The default hakyll configuration. defaultHakyllConfiguration :: String -> HakyllConfiguration -- | Main function to run Hakyll with the default configuration. The -- absolute URL is only used in certain cases, for example RSS feeds et -- cetera. hakyll :: String -> Hakyll () -> IO () -- | Main function to run hakyll with a custom configuration. hakyllWithConfiguration :: HakyllConfiguration -> Hakyll () -> IO () -- | Run a Hakyll action with default settings. This is mostly aimed at -- testing code. runDefaultHakyll :: Hakyll a -> IO a