-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Wiki using happstack, git or darcs, and pandoc.
--
-- Gitit is a wiki backed by a git, darcs, or mercurial filestore. Pages
-- and uploaded files can be modified either directly via the VCS's
-- command-line tools or through the wiki's web interface. Pandoc is used
-- for markup processing, so pages may be written in (extended) markdown,
-- reStructuredText, LaTeX, HTML, or literate Haskell, and exported in
-- ten different formats, including LaTeX, ConTeXt, DocBook, RTF,
-- OpenOffice ODT, and MediaWiki markup.
--
-- Notable features include
--
--
-- - plugins: dynamically loaded page transformations written in
-- Haskell (see Network.Gitit.Interface)
-- - conversion of TeX math to MathML for display in web browsers
-- - syntax highlighting of source code files and code snippets
-- - Atom feeds (site-wide and per-page)
-- - a library, Network.Gitit, that makes it simple to include a
-- gitit wiki in any happstack application
--
--
-- You can see a running demo at http://gitit.net.
--
-- For usage information: gitit --help
@package gitit
@version 0.7.3.3
-- | Types for Gitit modules.
module Network.Gitit.Types
data PageType
Markdown :: PageType
RST :: PageType
LaTeX :: PageType
HTML :: PageType
data FileStoreType
Git :: FileStoreType
Darcs :: FileStoreType
Mercurial :: FileStoreType
data MathMethod
MathML :: MathMethod
JsMathScript :: MathMethod
RawTeX :: MathMethod
-- | Data structure for information read from config file.
data Config
Config :: FilePath -> FileStoreType -> PageType -> MathMethod -> Bool -> Bool -> (Handler -> Handler) -> Handler -> FilePath -> Int -> FilePath -> FilePath -> Priority -> FilePath -> [String] -> Bool -> Integer -> Integer -> Int -> Bool -> String -> [String] -> [String] -> String -> Maybe (String, [String]) -> Bool -> String -> String -> Bool -> Bool -> FilePath -> Map String String -> String -> String -> String -> Bool -> String -> String -> Integer -> Integer -> Bool -> Maybe FilePath -> Config
-- | Path of repository containing filestore
repositoryPath :: Config -> FilePath
-- | Type of repository
repositoryType :: Config -> FileStoreType
-- | Default page markup type for this wiki
defaultPageType :: Config -> PageType
-- | How to handle LaTeX math in pages?
mathMethod :: Config -> MathMethod
-- | Treat as literate haskell by default?
defaultLHS :: Config -> Bool
-- | Show Haskell code with bird tracks
showLHSBirdTracks :: Config -> Bool
-- | Combinator to set REMOTE_USER request header
withUser :: Config -> Handler -> Handler
-- | Handler for login, logout, register, etc.
authHandler :: Config -> Handler
-- | Path of users database
userFile :: Config -> FilePath
-- | Seconds of inactivity before session expires
sessionTimeout :: Config -> Int
-- | Directory containing page templates
templatesDir :: Config -> FilePath
-- | Path of server log file
logFile :: Config -> FilePath
-- | Severity filter for log messages (DEBUG, INFO, NOTICE, WARNING, ERROR,
-- CRITICAL, ALERT, EMERGENCY)
logLevel :: Config -> Priority
-- | Path of static directory
staticDir :: Config -> FilePath
-- | Names of plugin modules to load
pluginModules :: Config -> [String]
-- | Show table of contents on each page?
tableOfContents :: Config -> Bool
-- | Max size of file uploads
maxUploadSize :: Config -> Integer
-- | Max size of page uploads
maxPageSize :: Config -> Integer
-- | Port number to serve content on
portNumber :: Config -> Int
-- | Print debug info to the console?
debugMode :: Config -> Bool
-- | The front page of the wiki
frontPage :: Config -> String
-- | Pages that cannot be edited via web
noEdit :: Config -> [String]
-- | Pages that cannot be deleted via web
noDelete :: Config -> [String]
-- | Default summary if description left blank
defaultSummary :: Config -> String
-- | Nothing = anyone can register. Just (prompt,
-- answers) = a user will be given the prompt and must give one of
-- the answers to register.
accessQuestion :: Config -> Maybe (String, [String])
-- | Use ReCAPTCHA for user registration.
useRecaptcha :: Config -> Bool
recaptchaPublicKey :: Config -> String
recaptchaPrivateKey :: Config -> String
-- | Should responses be compressed?
compressResponses :: Config -> Bool
-- | Should responses be cached?
useCache :: Config -> Bool
-- | Directory to hold cached pages
cacheDir :: Config -> FilePath
-- | Map associating mime types with file extensions
mimeMap :: Config -> Map String String
-- | Command to send notification emails
mailCommand :: Config -> String
-- | Text of password reset email
resetPasswordMessage :: Config -> String
-- | Markup syntax help for edit sidebar
markupHelp :: Config -> String
-- | Provide an atom feed?
useFeed :: Config -> Bool
-- | Base URL of wiki, for use in feed
baseUrl :: Config -> String
-- | Title of wiki, used in feed
wikiTitle :: Config -> String
-- | Number of days history to be included in feed
feedDays :: Config -> Integer
-- | Number of minutes to cache feeds before refreshing
feedRefreshTime :: Config -> Integer
-- | Allow PDF export?
pdfExport :: Config -> Bool
-- | Directory to search for pandoc customizations
pandocUserData :: Config -> Maybe FilePath
-- | Data for rendering a wiki page.
data Page
Page :: String -> PageType -> Bool -> Bool -> String -> [String] -> String -> [(String, String)] -> Page
pageName :: Page -> String
pageFormat :: Page -> PageType
pageLHS :: Page -> Bool
pageTOC :: Page -> Bool
pageTitle :: Page -> String
pageCategories :: Page -> [String]
pageText :: Page -> String
pageMeta :: Page -> [(String, String)]
type SessionKey = Integer
data SessionData
SessionData :: String -> SessionData
sessionUser :: SessionData -> String
data Sessions a
Sessions :: Map SessionKey a -> Sessions a
unsession :: Sessions a -> Map SessionKey a
data Password
Password :: String -> String -> Password
pSalt :: Password -> String
pHashed :: Password -> String
data User
User :: String -> Password -> String -> User
uUsername :: User -> String
uPassword :: User -> Password
uEmail :: User -> String
-- | Common state for all gitit wikis in an application.
data GititState
GititState :: Sessions SessionData -> Map String User -> FilePath -> (PageLayout -> Html -> Handler) -> [Plugin] -> GititState
sessions :: GititState -> Sessions SessionData
users :: GititState -> Map String User
templatesPath :: GititState -> FilePath
renderPage :: GititState -> PageLayout -> Html -> Handler
plugins :: GititState -> [Plugin]
type ContentTransformer = StateT Context GititServerPart
data Plugin
PageTransform :: (Pandoc -> PluginM Pandoc) -> Plugin
PreParseTransform :: (String -> PluginM String) -> Plugin
PreCommitTransform :: (String -> PluginM String) -> Plugin
data PluginData
PluginData :: Config -> Maybe User -> Request -> FileStore -> PluginData
pluginConfig :: PluginData -> Config
pluginUser :: PluginData -> Maybe User
pluginRequest :: PluginData -> Request
pluginFileStore :: PluginData -> FileStore
type PluginM = ReaderT PluginData (StateT Context IO)
runPluginM :: PluginM a -> PluginData -> Context -> IO (a, Context)
data Context
Context :: String -> PageLayout -> Bool -> Bool -> Bool -> [String] -> [(String, String)] -> Context
ctxFile :: Context -> String
ctxLayout :: Context -> PageLayout
ctxCacheable :: Context -> Bool
ctxTOC :: Context -> Bool
ctxBirdTracks :: Context -> Bool
ctxCategories :: Context -> [String]
ctxMeta :: Context -> [(String, String)]
class (Monad m) => HasContext m
getContext :: (HasContext m) => m Context
modifyContext :: (HasContext m) => (Context -> Context) -> m ()
-- | Abstract representation of page layout (tabs, scripts, etc.)
data PageLayout
PageLayout :: String -> Maybe String -> Bool -> [String] -> String -> [String] -> Bool -> Bool -> Maybe String -> [Tab] -> Tab -> Bool -> PageLayout
pgPageName :: PageLayout -> String
pgRevision :: PageLayout -> Maybe String
pgPrintable :: PageLayout -> Bool
pgMessages :: PageLayout -> [String]
pgTitle :: PageLayout -> String
pgScripts :: PageLayout -> [String]
pgShowPageTools :: PageLayout -> Bool
pgShowSiteNav :: PageLayout -> Bool
pgMarkupHelp :: PageLayout -> Maybe String
pgTabs :: PageLayout -> [Tab]
pgSelectedTab :: PageLayout -> Tab
pgLinkToFeed :: PageLayout -> Bool
data Tab
ViewTab :: Tab
EditTab :: Tab
HistoryTab :: Tab
DiscussTab :: Tab
DiffTab :: Tab
data Recaptcha
Recaptcha :: String -> String -> Recaptcha
recaptchaChallengeField :: Recaptcha -> String
recaptchaResponseField :: Recaptcha -> String
data Params
Params :: String -> String -> String -> Maybe String -> String -> Maybe String -> Maybe DateTime -> String -> Int -> [String] -> String -> String -> Maybe String -> [String] -> Maybe String -> Maybe String -> String -> String -> String -> String -> String -> String -> String -> Bool -> Bool -> String -> ByteString -> Bool -> Maybe SessionKey -> Recaptcha -> String -> Params
pUsername :: Params -> String
pPassword :: Params -> String
pPassword2 :: Params -> String
pRevision :: Params -> Maybe String
pDestination :: Params -> String
pForUser :: Params -> Maybe String
pSince :: Params -> Maybe DateTime
pRaw :: Params -> String
pLimit :: Params -> Int
pPatterns :: Params -> [String]
pGotoPage :: Params -> String
pFileToDelete :: Params -> String
pEditedText :: Params -> Maybe String
pMessages :: Params -> [String]
pFrom :: Params -> Maybe String
pTo :: Params -> Maybe String
pFormat :: Params -> String
pSHA1 :: Params -> String
pLogMsg :: Params -> String
pEmail :: Params -> String
pFullName :: Params -> String
pAccessCode :: Params -> String
pWikiname :: Params -> String
pPrintable :: Params -> Bool
pOverwrite :: Params -> Bool
pFilename :: Params -> String
pFileContents :: Params -> ByteString
pConfirm :: Params -> Bool
pSessionKey :: Params -> Maybe SessionKey
pRecaptcha :: Params -> Recaptcha
pResetCode :: Params -> String
data Command
Command :: (Maybe String) -> Command
-- | State for a single wiki.
data WikiState
WikiState :: Config -> FileStore -> WikiState
wikiConfig :: WikiState -> Config
wikiFileStore :: WikiState -> FileStore
type GititServerPart = ServerPartT (ReaderT WikiState IO)
type Handler = GititServerPart Response
instance Show Command
instance Show Params
instance Read Recaptcha
instance Show Recaptcha
instance Eq Tab
instance Show Tab
instance Show User
instance Read User
instance Read Password
instance Show Password
instance Eq Password
instance (Read a) => Read (Sessions a)
instance (Show a) => Show (Sessions a)
instance (Eq a) => Eq (Sessions a)
instance Read SessionData
instance Show SessionData
instance Eq SessionData
instance Read Page
instance Show Page
instance Read MathMethod
instance Show MathMethod
instance Eq MathMethod
instance Show FileStoreType
instance Read PageType
instance Show PageType
instance Eq PageType
instance FromData Command
instance FromData Params
instance FromData SessionKey
instance HasContext PluginM
instance HasContext ContentTransformer
-- | Useful functions for defining wiki handlers.
module Network.Gitit.Framework
-- | Run the handler after setting REMOTE_USER with the user from
-- the session.
withUserFromSession :: Handler -> Handler
-- | Run the handler after setting REMOTE_USER from the
-- authorization header. Works with simple HTTP authentication or
-- digest authentication.
withUserFromHTTPAuth :: Handler -> Handler
-- | Run the handler if a user satisfying the predicate is logged in.
-- Redirect to login if nobody logged in; raise error if someone is
-- logged in but doesn't satisfy the predicate.
requireUserThat :: (User -> Bool) -> Handler -> Handler
-- | Run the handler if a user is logged in, otherwise redirect to login
-- page.
requireUser :: Handler -> Handler
-- | Returns Just logged in user or Nothing.
getLoggedInUser :: GititServerPart (Maybe User)
-- | unlessNoEdit responder fallback runs responder
-- unless the page has been designated not editable in configuration; in
-- that case, runs fallback.
unlessNoEdit :: Handler -> Handler -> Handler
-- | unlessNoDelete responder fallback runs responder
-- unless the page has been designated not deletable in configuration; in
-- that case, runs fallback.
unlessNoDelete :: Handler -> Handler -> Handler
guardCommand :: String -> GititServerPart ()
guardPath :: (String -> Bool) -> GititServerPart ()
-- | Succeeds if path is an index path: e.g. /foo/bar/.
guardIndex :: GititServerPart ()
guardBareBase :: GititServerPart ()
-- | Returns the current path (subtracting initial commands like
-- /_edit).
getPath :: (ServerMonad m) => m String
-- | Returns the current page name (derived from the path).
getPage :: GititServerPart String
-- | Returns the contents of the referer header.
getReferer :: (ServerMonad m) => m String
-- | Returns the base URL of the wiki in the happstack server. So, if the
-- wiki handlers are behind a dir foo, getWikiBase will return
-- /foo/. getWikiBase doesn't know anything about HTTP proxies,
-- so if you use proxies to map a gitit wiki to /foo/, you'll
-- still need to follow the instructions in README.
getWikiBase :: (ServerMonad m) => m String
-- | Returns path portion of URI, without initial /. Consecutive
-- spaces are collapsed. We don't want to distinguish Hi There
-- and Hi There.
uriPath :: String -> String
isPage :: String -> Bool
isPageFile :: FilePath -> Bool
isDiscussPage :: String -> Bool
isDiscussPageFile :: FilePath -> Bool
isSourceCode :: String -> Bool
-- | Runs a server monad in a local context after setting the
-- messages request header.
withMessages :: (ServerMonad m) => [String] -> m a -> m a
-- | Runs a server monad in a local context after setting request header.
withInput :: (ServerMonad m) => String -> String -> m a -> m a
-- | Returns encoded URL path for the page with the given name, relative to
-- the wiki base.
urlForPage :: String -> String
-- | Returns the filestore path of the file containing the page's source.
pathForPage :: String -> FilePath
-- | Retrieves a mime type based on file extension.
getMimeTypeForExtension :: String -> GititServerPart String
-- | Simple helper for validation of forms.
validate :: [(Bool, String)] -> [String]
-- | Returns a filestore object derived from the repository path and
-- filestore type specified in configuration.
filestoreFromConfig :: Config -> FileStore
module Network.Gitit.Layout
defaultPageLayout :: PageLayout
-- | Given a compiled string template, returns a page renderer.
defaultRenderPage :: StringTemplate String -> PageLayout -> Html -> Handler
-- | Returns formatted page
formattedPage :: PageLayout -> Html -> Handler
-- | Returns a page template with gitit variables filled in.
filledPageTemplate :: String -> Config -> PageLayout -> Html -> StringTemplate String -> StringTemplate String
uploadsAllowed :: Config -> Bool
module Network.Gitit.ContentTransformer
-- | Converts a ContentTransformer into a
-- GititServerPart; specialized to wiki pages.
runPageTransformer :: (ToMessage a) => ContentTransformer a -> GititServerPart a
-- | Converts a ContentTransformer into a
-- GititServerPart; specialized to non-pages.
runFileTransformer :: (ToMessage a) => ContentTransformer a -> GititServerPart a
-- | Responds with raw page source.
showRawPage :: Handler
-- | Responds with raw source (for non-pages such as source code files).
showFileAsText :: Handler
-- | Responds with rendered wiki page.
showPage :: Handler
-- | Responds with page exported into selected format.
exportPage :: Handler
-- | Responds with highlighted source code.
showHighlightedSource :: Handler
-- | Responds with non-highlighted source code.
showFile :: Handler
-- | Responds with rendered page derived from form data.
preview :: Handler
-- | Applies pre-commit plugins to raw page source, possibly modifying it.
applyPreCommitPlugins :: String -> GititServerPart String
-- | Caches a response (actually just the response body) on disk, unless
-- the context indicates that the page is not cacheable.
cacheHtml :: Response -> ContentTransformer Response
-- | Returns cached page if available, otherwise mzero.
cachedHtml :: ContentTransformer Response
-- | Returns raw file contents.
rawContents :: ContentTransformer (Maybe String)
-- | Converts raw contents to a text/plain response.
textResponse :: Maybe String -> ContentTransformer Response
-- | Converts raw contents to a response that is appropriate with a mime
-- type derived from the page's extension.
mimeFileResponse :: Maybe String -> ContentTransformer Response
mimeResponse :: (Monad m) => String -> String -> m Response
-- | Converts Pandoc to response using format specified in parameters.
exportPandoc :: Pandoc -> ContentTransformer Response
-- | Adds the sidebar, page tabs, and other elements of the wiki page
-- layout to the raw content.
applyWikiTemplate :: Html -> ContentTransformer Response
-- | Converts Page to Pandoc, applies page transforms, and adds page title.
pageToWikiPandoc :: Page -> ContentTransformer Pandoc
-- | Converts source text to Pandoc using default page type.
pageToPandoc :: Page -> ContentTransformer Pandoc
-- | Converts pandoc document to HTML.
pandocToHtml :: Pandoc -> ContentTransformer Html
-- | Returns highlighted source code.
highlightSource :: Maybe String -> ContentTransformer Html
-- | Applies all the page transform plugins to a Pandoc document.
applyPageTransforms :: Pandoc -> ContentTransformer Pandoc
-- | Puts rendered page content into a wikipage div, adding categories.
wikiDivify :: Html -> ContentTransformer Html
-- | Adds page title to a Pandoc document.
addPageTitleToPandoc :: String -> Pandoc -> ContentTransformer Pandoc
-- | Adds javascript links for math support.
addMathSupport :: a -> ContentTransformer a
-- | Adds javascripts to page layout.
addScripts :: PageLayout -> [String] -> PageLayout
getFileName :: ContentTransformer FilePath
getPageName :: ContentTransformer String
getLayout :: ContentTransformer PageLayout
getParams :: ContentTransformer Params
getCacheable :: ContentTransformer Bool
-- | Derives a URL from a list of Pandoc Inline elements.
inlinesToURL :: [Inline] -> String
-- | Convert a list of inlines into a string.
inlinesToString :: [Inline] -> String
-- | Functions for parsing command line options and reading the config
-- file.
module Network.Gitit.Config
-- | Get configuration from config file.
getConfigFromFile :: FilePath -> IO Config
-- | Returns the default gitit configuration.
getDefaultConfig :: IO Config
-- | Read a file associating mime types with extensions, and return a map
-- from extensions to types. Each line of the file consists of a mime
-- type, followed by space, followed by a list of zero or more
-- extensions, separated by spaces. Example: text/plain txt text
readMimeTypesFile :: FilePath -> IO (Map String String)
-- | Functions for initializing a Gitit wiki.
module Network.Gitit.Initialize
-- | Initialize Gitit State.
initializeGititState :: Config -> IO ()
-- | Recompile the page template.
recompilePageTemplate :: IO ()
compilePageTemplate :: FilePath -> IO (StringTemplate String)
-- | Create static directory unless it exists.
createStaticIfMissing :: Config -> IO ()
-- | Create page repository unless it exists.
createRepoIfMissing :: Config -> IO ()
createDefaultPages :: Config -> IO ()
-- | Create templates dir if it doesn't exist.
createTemplateIfMissing :: Config -> IO ()
-- | Interface for plugins.
--
-- A plugin is a Haskell module that is dynamically loaded by gitit.
--
-- There are three kinds of plugins: PageTransforms,
-- PreParseTransforms, and PreCommitTransforms. These
-- plugins differ chiefly in where they are applied.
-- PreCommitTransform plugins are applied just before changes to a
-- page are saved and may transform the raw source that is saved.
-- PreParseTransform plugins are applied when a page is viewed and
-- may alter the raw page source before it is parsed as a Pandoc
-- document. Finally, PageTransform plugins modify the
-- Pandoc document that results after a page's source is parsed,
-- but before it is converted to HTML:
--
--
-- +--------------------------+
-- | edited text from browser |
-- +--------------------------+
-- || <---- PreCommitTransform plugins
-- \/
-- || <---- saved to repository
-- \/
-- +---------------------------------+
-- | raw page source from repository |
-- +---------------------------------+
-- || <---- PreParseTransform plugins
-- \/
-- || <---- markdown or RST reader
-- \/
-- +-----------------+
-- | Pandoc document |
-- +-----------------+
-- || <---- PageTransform plugins
-- \/
-- +---------------------+
-- | new Pandoc document |
-- +---------------------+
-- || <---- HTML writer
-- \/
-- +----------------------+
-- | HTML version of page |
-- +----------------------+
--
--
-- Note that PreParseTransform and PageTransform plugins do
-- not alter the page source stored in the repository. They only affect
-- what is visible on the website. Only PreCommitTransform plugins
-- can alter what is stored in the repository.
--
-- Note also that PreParseTransform and PageTransform
-- plugins will not be run when the cached version of a page is used.
-- Plugins can use the doNotCache command to prevent a page from
-- being cached, if their behavior is sensitive to things that might
-- change from one time to another (such as the time or currently
-- logged-in user).
--
-- You can use the helper functions mkPageTransform and
-- mkPageTransformM to create PageTransform plugins from a
-- transformation of any of the basic types used by Pandoc (for example,
-- Inline, Block, [Inline], even
-- String). Here is a simple (if silly) example:
--
--
-- -- Deprofanizer.hs
-- module Deprofanizer (plugin) where
--
-- -- This plugin replaces profane words with "XXXXX".
--
-- import Network.Gitit.Interface
-- import Data.Char (toLower)
--
-- plugin :: Plugin
-- plugin = mkPageTransform deprofanize
--
-- deprofanize :: Inline -> Inline
-- deprofanize (Str x) | isBadWord x = Str "XXXXX"
-- deprofanize x = x
--
-- isBadWord :: String -> Bool
-- isBadWord x = (map toLower x) `elem` ["darn", "blasted", "stinker"]
-- -- there are more, but this is a family program
--
--
-- Further examples can be found in the plugins directory in the
-- source distribution. If you have installed gitit using Cabal, you can
-- also find them in the directory
-- CABALDIR/share/gitit-X.Y.Z/plugins, where CABALDIR
-- is the cabal install directory and X.Y.Z is the version
-- number of gitit.
module Network.Gitit.Interface
data Plugin
PageTransform :: (Pandoc -> PluginM Pandoc) -> Plugin
PreParseTransform :: (String -> PluginM String) -> Plugin
PreCommitTransform :: (String -> PluginM String) -> Plugin
type PluginM = ReaderT PluginData (StateT Context IO)
-- | Lifts a function from a -> a (for example, Inline
-- -> Inline, Block -> Block, [Inline] ->
-- [Inline], or String -> String) to a
-- PageTransform plugin.
mkPageTransform :: (Data a) => (a -> a) -> Plugin
-- | Monadic version of mkPageTransform. Lifts a function from a
-- -> m a to a PageTransform plugin.
mkPageTransformM :: (Data a) => (a -> PluginM a) -> Plugin
-- | Data structure for information read from config file.
data Config
Config :: FilePath -> FileStoreType -> PageType -> MathMethod -> Bool -> Bool -> (Handler -> Handler) -> Handler -> FilePath -> Int -> FilePath -> FilePath -> Priority -> FilePath -> [String] -> Bool -> Integer -> Integer -> Int -> Bool -> String -> [String] -> [String] -> String -> Maybe (String, [String]) -> Bool -> String -> String -> Bool -> Bool -> FilePath -> Map String String -> String -> String -> String -> Bool -> String -> String -> Integer -> Integer -> Bool -> Maybe FilePath -> Config
-- | Path of repository containing filestore
repositoryPath :: Config -> FilePath
-- | Type of repository
repositoryType :: Config -> FileStoreType
-- | Default page markup type for this wiki
defaultPageType :: Config -> PageType
-- | How to handle LaTeX math in pages?
mathMethod :: Config -> MathMethod
-- | Treat as literate haskell by default?
defaultLHS :: Config -> Bool
-- | Show Haskell code with bird tracks
showLHSBirdTracks :: Config -> Bool
-- | Combinator to set REMOTE_USER request header
withUser :: Config -> Handler -> Handler
-- | Handler for login, logout, register, etc.
authHandler :: Config -> Handler
-- | Path of users database
userFile :: Config -> FilePath
-- | Seconds of inactivity before session expires
sessionTimeout :: Config -> Int
-- | Directory containing page templates
templatesDir :: Config -> FilePath
-- | Path of server log file
logFile :: Config -> FilePath
-- | Severity filter for log messages (DEBUG, INFO, NOTICE, WARNING, ERROR,
-- CRITICAL, ALERT, EMERGENCY)
logLevel :: Config -> Priority
-- | Path of static directory
staticDir :: Config -> FilePath
-- | Names of plugin modules to load
pluginModules :: Config -> [String]
-- | Show table of contents on each page?
tableOfContents :: Config -> Bool
-- | Max size of file uploads
maxUploadSize :: Config -> Integer
-- | Max size of page uploads
maxPageSize :: Config -> Integer
-- | Port number to serve content on
portNumber :: Config -> Int
-- | Print debug info to the console?
debugMode :: Config -> Bool
-- | The front page of the wiki
frontPage :: Config -> String
-- | Pages that cannot be edited via web
noEdit :: Config -> [String]
-- | Pages that cannot be deleted via web
noDelete :: Config -> [String]
-- | Default summary if description left blank
defaultSummary :: Config -> String
-- | Nothing = anyone can register. Just (prompt,
-- answers) = a user will be given the prompt and must give one of
-- the answers to register.
accessQuestion :: Config -> Maybe (String, [String])
-- | Use ReCAPTCHA for user registration.
useRecaptcha :: Config -> Bool
recaptchaPublicKey :: Config -> String
recaptchaPrivateKey :: Config -> String
-- | Should responses be compressed?
compressResponses :: Config -> Bool
-- | Should responses be cached?
useCache :: Config -> Bool
-- | Directory to hold cached pages
cacheDir :: Config -> FilePath
-- | Map associating mime types with file extensions
mimeMap :: Config -> Map String String
-- | Command to send notification emails
mailCommand :: Config -> String
-- | Text of password reset email
resetPasswordMessage :: Config -> String
-- | Markup syntax help for edit sidebar
markupHelp :: Config -> String
-- | Provide an atom feed?
useFeed :: Config -> Bool
-- | Base URL of wiki, for use in feed
baseUrl :: Config -> String
-- | Title of wiki, used in feed
wikiTitle :: Config -> String
-- | Number of days history to be included in feed
feedDays :: Config -> Integer
-- | Number of minutes to cache feeds before refreshing
feedRefreshTime :: Config -> Integer
-- | Allow PDF export?
pdfExport :: Config -> Bool
-- | Directory to search for pandoc customizations
pandocUserData :: Config -> Maybe FilePath
data Request :: *
Request :: Method -> [String] -> String -> String -> [(String, Input)] -> [(String, Cookie)] -> Version -> Headers -> RqBody -> Host -> Request
rqMethod :: Request -> Method
rqPaths :: Request -> [String]
rqUri :: Request -> String
rqQuery :: Request -> String
rqInputs :: Request -> [(String, Input)]
rqCookies :: Request -> [(String, Cookie)]
rqVersion :: Request -> Version
rqHeaders :: Request -> Headers
rqBody :: Request -> RqBody
rqPeer :: Request -> Host
data User
User :: String -> Password -> String -> User
uUsername :: User -> String
uPassword :: User -> Password
uEmail :: User -> String
data Context
Context :: String -> PageLayout -> Bool -> Bool -> Bool -> [String] -> [(String, String)] -> Context
ctxFile :: Context -> String
ctxLayout :: Context -> PageLayout
ctxCacheable :: Context -> Bool
ctxTOC :: Context -> Bool
ctxBirdTracks :: Context -> Bool
ctxCategories :: Context -> [String]
ctxMeta :: Context -> [(String, String)]
data PageType
Markdown :: PageType
RST :: PageType
LaTeX :: PageType
HTML :: PageType
-- | Abstract representation of page layout (tabs, scripts, etc.)
data PageLayout
PageLayout :: String -> Maybe String -> Bool -> [String] -> String -> [String] -> Bool -> Bool -> Maybe String -> [Tab] -> Tab -> Bool -> PageLayout
pgPageName :: PageLayout -> String
pgRevision :: PageLayout -> Maybe String
pgPrintable :: PageLayout -> Bool
pgMessages :: PageLayout -> [String]
pgTitle :: PageLayout -> String
pgScripts :: PageLayout -> [String]
pgShowPageTools :: PageLayout -> Bool
pgShowSiteNav :: PageLayout -> Bool
pgMarkupHelp :: PageLayout -> Maybe String
pgTabs :: PageLayout -> [Tab]
pgSelectedTab :: PageLayout -> Tab
pgLinkToFeed :: PageLayout -> Bool
-- | Returns the current wiki configuration.
askConfig :: PluginM Config
-- | Returns Just the logged in user, or Nothing if
-- nobody is logged in.
askUser :: PluginM (Maybe User)
-- | Returns the complete HTTP request.
askRequest :: PluginM Request
-- | Returns the wiki filestore.
askFileStore :: PluginM FileStore
-- | Returns the page meta data
askMeta :: PluginM [(String, String)]
-- | Indicates that the current page or file is not to be cached.
doNotCache :: PluginM ()
getContext :: (HasContext m) => m Context
modifyContext :: (HasContext m) => (Context -> Context) -> m ()
-- | Derives a URL from a list of Pandoc Inline elements.
inlinesToURL :: [Inline] -> String
-- | Convert a list of inlines into a string.
inlinesToString :: [Inline] -> String
liftIO :: (MonadIO m) => forall a. IO a -> m a
-- | Perform a function in a temporary directory and clean up.
withTempDir :: FilePath -> (FilePath -> IO a) -> IO a
-- | Functions for embedding a gitit wiki into a Happstack application.
--
-- The following is a minimal standalone wiki program:
--
--
-- import Network.Gitit
-- import Happstack.Server.SimpleHTTP
--
-- main = do
-- conf <- getDefaultConfig
-- createStaticIfMissing conf
-- createTemplateIfMissing conf
-- createRepoIfMissing conf
-- initializeGititState conf
-- simpleHTTP nullConf{port = 5001} $ wiki conf
--
--
-- Here is a more complex example, which serves different wikis under
-- different paths, and uses a custom authentication scheme:
--
--
-- import Network.Gitit
-- import Control.Monad
-- import Text.XHtml hiding (dir)
-- import Happstack.Server.SimpleHTTP
--
-- type WikiSpec = (String, FileStoreType, PageType)
--
-- wikis = [ ("markdownWiki", Git, Markdown)
-- , ("latexWiki", Darcs, LaTeX) ]
--
-- -- custom authentication
-- myWithUser :: Handler -> Handler
-- myWithUser handler = do
-- -- replace the following with a function that retrieves
-- -- the logged in user for your happstack app:
-- user <- return "testuser"
-- localRq (setHeader "REMOTE_USER" user) handler
--
-- myAuthHandler = msum
-- [ dir "_login" $ seeOther "/your/login/url" $ toResponse ()
-- , dir "_logout" $ seeOther "/your/logout/url" $ toResponse () ]
--
-- handlerFor :: Config -> WikiSpec -> ServerPart Response
-- handlerFor conf (path', fstype, pagetype) = dir path' $
-- wiki conf{ repositoryPath = path'
-- , repositoryType = fstype
-- , defaultPageType = pagetype}
--
-- indexPage :: ServerPart Response
-- indexPage = ok $ toResponse $
-- (p << "Wiki index") +++
-- ulist << map (\(path', _, _) -> li << hotlink (path' ++ "/") << path') wikis
--
-- main = do
-- conf <- getDefaultConfig
-- let conf' = conf{authHandler = myAuthHandler, withUser = myWithUser}
-- forM wikis $ \(path', fstype, pagetype) -> do
-- let conf'' = conf'{ repositoryPath = path'
-- , repositoryType = fstype
-- , defaultPageType = pagetype
-- }
-- createStaticIfMissing conf''
-- createRepoIfMissing conf''
-- createTemplateIfMissing conf'
-- initializeGititState conf'
-- simpleHTTP nullConf{port = 5001} $
-- (nullDir >> indexPage) `mplus` msum (map (handlerFor conf') wikis)
--
module Network.Gitit
-- | Happstack handler for a gitit wiki.
wiki :: Config -> ServerPart Response
-- | Recompiles the gitit templates.
reloadTemplates :: ServerPart Response
-- | Converts a gitit Handler into a standard happstack ServerPart.
runHandler :: WikiState -> Handler -> ServerPart Response
loginUserForm :: Handler
getFileStore :: GititServerPart FileStore
getUser :: String -> GititServerPart (Maybe User)
getConfig :: GititServerPart Config
queryGititState :: (MonadIO m) => (GititState -> a) -> m a
updateGititState :: (MonadIO m) => (GititState -> GititState) -> m ()