gitit-0.10.3.1: Wiki using happstack, git or darcs, and pandoc.

Safe Haskell | None

Network.Gitit.ContentTransformer

Contents

- ContentTransformer runners
- Gitit responders
- Cache support for transformers
- Content retrieval combinators
- Response-generating combinators
- Content-type transformation combinators
- Content or context augmentation combinators
- ContentTransformer context API
- Pandoc and wiki content conversion support

Synopsis

- runPageTransformer :: ToMessage a => ContentTransformer a -> GititServerPart a
- runFileTransformer :: ToMessage a => ContentTransformer a -> GititServerPart a
- showRawPage :: Handler
- showFileAsText :: Handler
- showPage :: Handler
- exportPage :: Handler
- showHighlightedSource :: Handler
- showFile :: Handler
- preview :: Handler
- applyPreCommitPlugins :: String -> GititServerPart String
- cacheHtml :: Response -> ContentTransformer Response
- cachedHtml :: ContentTransformer Response
- rawContents :: ContentTransformer (Maybe String)
- textResponse :: Maybe String -> ContentTransformer Response
- mimeFileResponse :: Maybe String -> ContentTransformer Response
- mimeResponse :: Monad m => String -> String -> m Response
- exportPandoc :: Pandoc -> ContentTransformer Response
- applyWikiTemplate :: Html -> ContentTransformer Response
- pageToWikiPandoc :: Page -> ContentTransformer Pandoc
- pageToPandoc :: Page -> ContentTransformer Pandoc
- pandocToHtml :: Pandoc -> ContentTransformer Html
- highlightSource :: Maybe String -> ContentTransformer Html
- applyPageTransforms :: Pandoc -> ContentTransformer Pandoc
- wikiDivify :: Html -> ContentTransformer Html
- addPageTitleToPandoc :: String -> Pandoc -> ContentTransformer Pandoc
- addMathSupport :: a -> ContentTransformer a
- addScripts :: PageLayout -> [String] -> PageLayout
- getFileName :: ContentTransformer FilePath
- getPageName :: ContentTransformer String
- getLayout :: ContentTransformer PageLayout
- getParams :: ContentTransformer Params
- getCacheable :: ContentTransformer Bool
- inlinesToURL :: [Inline] -> String
- inlinesToString :: [Inline] -> String

# ContentTransformer runners

runPageTransformer :: ToMessage a => ContentTransformer a -> GititServerPart aSource

Converts a `ContentTransformer` into a `GititServerPart`; specialized to wiki pages.

runFileTransformer :: ToMessage a => ContentTransformer a -> GititServerPart aSource

Converts a `ContentTransformer` into a `GititServerPart`; specialized to non-pages.

# Gitit responders

showRawPage :: Handler Source

Responds with raw page source.

showFileAsText :: Handler Source

Responds with raw source (for non-pages such as source code files).

showPage :: Handler Source

Responds with rendered wiki page.

exportPage :: Handler Source

Responds with page exported into selected format.

showHighlightedSource :: Handler Source

Responds with highlighted source code.

showFile :: Handler Source

Responds with non-highlighted source code.

preview :: Handler Source

Responds with rendered page derived from form data.

applyPreCommitPlugins :: String -> GititServerPart String Source

Applies pre-commit plugins to raw page source, possibly modifying it.

# Cache support for transformers

cacheHtml :: Response -> ContentTransformer Response Source

Caches a response (actually just the response body) on disk, unless the context indicates that the page is not cacheable.

cachedHtml :: ContentTransformer Response Source

Returns cached page if available, otherwise mzero.

# Content retrieval combinators

rawContents :: ContentTransformer (Maybe String)Source

Returns raw file contents.

# Response-generating combinators

textResponse :: Maybe String -> ContentTransformer Response Source

Converts raw contents to a text/plain response.

mimeFileResponse :: Maybe String -> ContentTransformer Response Source

Converts raw contents to a response that is appropriate with a mime type derived from the page's extension.

mimeResponse Source

Arguments

:: Monad m |
=> String | Raw contents for response body
-> String | Mime type
-> m Response |

exportPandoc :: Pandoc -> ContentTransformer Response Source

Converts Pandoc to response using format specified in parameters.

applyWikiTemplate :: Html -> ContentTransformer Response Source

Adds the sidebar, page tabs, and other elements of the wiki page layout to the raw content.

# Content-type transformation combinators

pageToWikiPandoc :: Page -> ContentTransformer Pandoc Source

Converts Page to Pandoc, applies page transforms, and adds page title.

pageToPandoc :: Page -> ContentTransformer Pandoc Source

Converts source text to Pandoc using default page type.

pandocToHtml :: Pandoc -> ContentTransformer Html Source

Converts pandoc document to HTML.

highlightSource :: Maybe String -> ContentTransformer Html Source

Returns highlighted source code.

# Content or context augmentation combinators

applyPageTransforms :: Pandoc -> ContentTransformer Pandoc Source

Applies all the page transform plugins to a Pandoc document.

wikiDivify :: Html -> ContentTransformer Html Source

Puts rendered page content into a wikipage div, adding categories.

addPageTitleToPandoc :: String -> Pandoc -> ContentTransformer Pandoc Source

Adds page title to a Pandoc document.

addMathSupport :: a -> ContentTransformer aSource

Adds javascript links for math support.

addScripts :: PageLayout -> [String] -> PageLayout Source

Adds javascripts to page layout.

# ContentTransformer context API

getFileName :: ContentTransformer FilePath Source

getPageName :: ContentTransformer String Source

getLayout :: ContentTransformer PageLayout Source

getParams :: ContentTransformer Params Source

getCacheable :: ContentTransformer Bool Source

# Pandoc and wiki content conversion support

inlinesToURL :: [Inline] -> String Source

Derives a URL from a list of Pandoc Inline elements.

inlinesToString :: [Inline] -> String Source

Convert a list of inlines into a string.