-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Wiki using happstack, git or darcs, and pandoc. -- @package gitit @version 0.11 -- | Types for Gitit modules. module Network.Gitit.Types data PageType Markdown :: PageType CommonMark :: PageType RST :: PageType LaTeX :: PageType HTML :: PageType Textile :: PageType Org :: PageType DocBook :: PageType MediaWiki :: PageType data FileStoreType Git :: FileStoreType Darcs :: FileStoreType Mercurial :: FileStoreType data MathMethod MathML :: MathMethod JsMathScript :: MathMethod WebTeX :: String -> MathMethod RawTeX :: MathMethod MathJax :: String -> MathMethod data AuthenticationLevel Never :: AuthenticationLevel ForModify :: AuthenticationLevel ForRead :: AuthenticationLevel -- | Data structure for information read from config file. data Config Config :: FilePath -> FileStoreType -> PageType -> String -> MathMethod -> Bool -> Bool -> (Handler -> Handler) -> AuthenticationLevel -> Handler -> FilePath -> Int -> FilePath -> FilePath -> Priority -> FilePath -> [String] -> Bool -> Integer -> Integer -> String -> Int -> Bool -> String -> [String] -> [String] -> String -> Maybe (String, [String]) -> Bool -> String -> String -> String -> String -> Bool -> Bool -> FilePath -> Map String String -> String -> String -> String -> Bool -> String -> Bool -> String -> Integer -> Integer -> Bool -> Maybe FilePath -> Bool -> Int -> GithubConfig -> 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 -- | Default file extension for pages in this wiki defaultExtension :: Config -> String -- | 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. requireAuthentication :: Config -> AuthenticationLevel -- | Specifies which actions require authentication. 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 -- | IP address to bind to address :: Config -> String -- | 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 -- | RPX domain and key rpxDomain :: Config -> String rpxKey :: 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 useAbsoluteUrls :: Config -> Bool -- | Should WikiLinks be absolute w.r.t. the base URL? 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 -- | Filter HTML through xss-sanitize xssSanitize :: Config -> Bool -- | The default number of days in the past to look for "recent" activity recentActivityDays :: Config -> Int -- | Github client data for authentication (id, secret, callback, authorize -- endpoint, access token endpoint) githubAuth :: Config -> GithubConfig -- | 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 sessionDataGithubState :: String -> SessionData sessionUser :: SessionData -> Maybe String sessionGithubState :: SessionData -> Maybe String data User User :: String -> Password -> String -> User uUsername :: User -> String uPassword :: User -> Password uEmail :: User -> 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 -- | 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] class Monad m => HasContext m getContext :: HasContext m => m Context modifyContext :: HasContext m => (Context -> Context) -> m () 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)] -- | 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 UTCTime -> String -> Int -> [String] -> String -> String -> Maybe String -> [String] -> Maybe String -> Maybe String -> String -> String -> String -> String -> String -> String -> String -> Bool -> Bool -> String -> FilePath -> Bool -> Maybe SessionKey -> Recaptcha -> String -> Maybe Bool -> Params pUsername :: Params -> String pPassword :: Params -> String pPassword2 :: Params -> String pRevision :: Params -> Maybe String pDestination :: Params -> String pForUser :: Params -> Maybe String pSince :: Params -> Maybe UTCTime 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 pFilePath :: Params -> FilePath pConfirm :: Params -> Bool pSessionKey :: Params -> Maybe SessionKey pRecaptcha :: Params -> Recaptcha pResetCode :: Params -> String pRedirect :: Params -> Maybe Bool 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 fromEntities :: String -> String data GithubConfig oAuth2 :: GithubConfig -> OAuth2 org :: GithubConfig -> Maybe Text githubConfig :: OAuth2 -> Maybe Text -> GithubConfig instance Read PageType instance Show PageType instance Eq PageType instance Show FileStoreType instance Read MathMethod instance Show MathMethod instance Eq MathMethod instance Read AuthenticationLevel instance Show AuthenticationLevel instance Eq AuthenticationLevel instance Ord AuthenticationLevel instance Read Page instance Show Page instance Read SessionData instance Show SessionData instance Eq SessionData instance Read a => Read (Sessions a) instance Show a => Show (Sessions a) instance Eq a => Eq (Sessions a) instance Read Password instance Show Password instance Eq Password instance Show User instance Read User instance Eq Tab instance Show Tab instance Read Recaptcha instance Show Recaptcha instance Show Params instance Show Command instance FromData Command instance FromData Params instance FromReqURI [String] 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 -- | Like authenticate, but with a predicate that the user must -- satisfy. authenticateUserThat :: (User -> Bool) -> AuthenticationLevel -> Handler -> Handler -- | Require a logged in user if the authentication level demands it. Run -- the handler if a user is logged in, otherwise redirect to login page. authenticate :: AuthenticationLevel -> 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 -> GititServerPart Bool isDiscussPage :: String -> Bool isDiscussPageFile :: FilePath -> GititServerPart Bool isNotDiscussPageFile :: FilePath -> GititServerPart Bool isSourceCode :: String -> Bool -- | Runs a server monad in a local context after setting the "message" -- request header. withMessages :: ServerMonad m => [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 -> 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.Authentication.Github loginGithubUser :: OAuth2 -> Handler getGithubUser :: GithubConfig -> GithubCallbackPars -> String -> GititServerPart (Either GithubLoginError User) data GithubCallbackPars data GithubLoginError ghUserMessage :: GithubLoginError -> String ghDetails :: GithubLoginError -> Maybe String instance Show GithubCallbackPars instance Show GithubUser instance Eq GithubUser instance Show GithubUserMail instance Eq GithubUserMail instance FromJSON GithubUserMail instance FromJSON GithubUser instance FromData GithubCallbackPars 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 -- | 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 () module Network.Gitit.Authentication loginUserForm :: Handler formAuthHandlers :: [Handler] httpAuthHandlers :: [Handler] rpxAuthHandlers :: [Handler] githubAuthHandlers :: GithubConfig -> [Handler] instance Show ValidationType instance Read ValidationType instance Show RPars instance FromData RPars -- | Functions for parsing command line options and reading the config -- file. module Network.Gitit.Config -- | Get configuration from config file. getConfigFromFile :: FilePath -> IO Config -- | Get configuration from config files. getConfigFromFiles :: [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) module Network.Gitit.ContentTransformer runPageTransformer :: ToMessage a => ContentTransformer a -> GititServerPart a runFileTransformer :: ToMessage a => ContentTransformer a -> GititServerPart a -- | Converts a ContentTransformer into a -- GititServerPart; specialized to wiki pages. -- runPageTransformer :: ToMessage a => ContentTransformer a -> -- GititServerPart a runPageTransformer = runTransformer pathForPage -- -- Converts a ContentTransformer into a -- GititServerPart; specialized to non-pages. runFileTransformer -- :: ToMessage a => ContentTransformer a -> GititServerPart a -- runFileTransformer = runTransformer id -- -- 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 -- | 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 -> String -> MathMethod -> Bool -> Bool -> (Handler -> Handler) -> AuthenticationLevel -> Handler -> FilePath -> Int -> FilePath -> FilePath -> Priority -> FilePath -> [String] -> Bool -> Integer -> Integer -> String -> Int -> Bool -> String -> [String] -> [String] -> String -> Maybe (String, [String]) -> Bool -> String -> String -> String -> String -> Bool -> Bool -> FilePath -> Map String String -> String -> String -> String -> Bool -> String -> Bool -> String -> Integer -> Integer -> Bool -> Maybe FilePath -> Bool -> Int -> GithubConfig -> 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 -- | Default file extension for pages in this wiki defaultExtension :: Config -> String -- | 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. requireAuthentication :: Config -> AuthenticationLevel -- | Specifies which actions require authentication. 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 -- | IP address to bind to address :: Config -> String -- | 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 -- | RPX domain and key rpxDomain :: Config -> String rpxKey :: 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 useAbsoluteUrls :: Config -> Bool -- | Should WikiLinks be absolute w.r.t. the base URL? 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 -- | Filter HTML through xss-sanitize xssSanitize :: Config -> Bool -- | The default number of days in the past to look for "recent" activity recentActivityDays :: Config -> Int -- | Github client data for authentication (id, secret, callback, authorize -- endpoint, access token endpoint) githubAuth :: Config -> GithubConfig -- | an HTTP request data Request :: * Request :: Bool -> Method -> [String] -> String -> String -> [(String, Input)] -> MVar [(String, Input)] -> [(String, Cookie)] -> HttpVersion -> Headers -> MVar RqBody -> Host -> Request -- | request uses https:// rqSecure :: Request -> Bool -- | request method rqMethod :: Request -> Method -- | the uri, split on /, and then decoded rqPaths :: Request -> [String] -- | the raw rqUri rqUri :: Request -> String -- | the QUERY_STRING rqQuery :: Request -> String -- | the QUERY_STRING decoded as key/value pairs rqInputsQuery :: Request -> [(String, Input)] -- | the request body decoded as key/value pairs (when appropriate) rqInputsBody :: Request -> MVar [(String, Input)] -- | cookies rqCookies :: Request -> [(String, Cookie)] -- | HTTP version rqVersion :: Request -> HttpVersion -- | the HTTP request headers rqHeaders :: Request -> Headers -- | the raw, undecoded request body rqBody :: Request -> MVar RqBody -- | (hostname, port) of the client making the request 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 CommonMark :: PageType RST :: PageType LaTeX :: PageType HTML :: PageType Textile :: PageType Org :: PageType DocBook :: PageType MediaWiki :: 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 -- | Lift a computation from the IO monad. 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 -- | Read a string (the contents of a page file) and produce a Page object, -- using defaults except when overridden by metadata. stringToPage :: Config -> String -> String -> Page -- | Write a string (the contents of a page file) corresponding to a Page -- object, using explicit metadata only when needed. pageToString :: Config -> Page -> String -- | Read categories from metadata strictly. readCategories :: FilePath -> IO [String] getFileStore :: GititServerPart FileStore getUser :: String -> GititServerPart (Maybe User) getConfig :: GititServerPart Config queryGititState :: MonadIO m => (GititState -> a) -> m a updateGititState :: MonadIO m => (GititState -> GititState) -> m ()