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

Network.Gitit.ContentTransformer

Contents

Synopsis

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 :: HandlerSource

Responds with raw page source.

showFileAsText :: HandlerSource

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

showPage :: HandlerSource

Responds with rendered wiki page.

exportPage :: HandlerSource

Responds with page exported into selected format.

showHighlightedSource :: HandlerSource

Responds with highlighted source code.

showFile :: HandlerSource

Responds with non-highlighted source code.

preview :: HandlerSource

Responds with rendered page derived from form data.

applyPreCommitPlugins :: String -> GititServerPart StringSource

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

Cache support for transformers

cacheHtml :: Response -> ContentTransformer ResponseSource

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

cachedHtml :: ContentTransformer ResponseSource

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 ResponseSource

Converts raw contents to a text/plain response.

mimeFileResponse :: Maybe String -> ContentTransformer ResponseSource

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

mimeResponseSource

Arguments

:: Monad m 
=> String

Raw contents for response body

-> String

Mime type

-> m Response 

exportPandoc :: Pandoc -> ContentTransformer ResponseSource

Converts Pandoc to response using format specified in parameters.

applyWikiTemplate :: Html -> ContentTransformer ResponseSource

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

Content-type transformation combinators

pageToWikiPandoc :: Page -> ContentTransformer PandocSource

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

pageToPandoc :: Page -> ContentTransformer PandocSource

Converts source text to Pandoc using default page type.

pandocToHtml :: Pandoc -> ContentTransformer HtmlSource

Converts pandoc document to HTML.

highlightSource :: Maybe String -> ContentTransformer HtmlSource

Returns highlighted source code.

Content or context augmentation combinators

applyPageTransforms :: Pandoc -> ContentTransformer PandocSource

Applies all the page transform plugins to a Pandoc document.

wikiDivify :: Html -> ContentTransformer HtmlSource

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

addPageTitleToPandoc :: String -> Pandoc -> ContentTransformer PandocSource

Adds page title to a Pandoc document.

addMathSupport :: a -> ContentTransformer aSource

Adds javascript links for math support.

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

Adds javascripts to page layout.

ContentTransformer context API

Pandoc and wiki content conversion support

inlinesToURL :: [Inline] -> StringSource

Derives a URL from a list of Pandoc Inline elements.

inlinesToString :: [Inline] -> StringSource

Convert a list of inlines into a string.