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

Safe Haskell | Safe-Infered

Network.Gitit.Types

Description

Types for Gitit modules.

Synopsis

- data PageType
  - = Markdown
  - | RST
  - | LaTeX
  - | HTML
  - | Textile
- data FileStoreType
  - = Git
  - | Darcs
  - | Mercurial
- data MathMethod
  - = MathML
  - | JsMathScript
  - | WebTeX String
  - | RawTeX
  - | MathJax String
- data AuthenticationLevel
  - = Never
  - | ForModify
  - | ForRead
- data Config = Config {
  - repositoryPath :: FilePath
  - repositoryType :: FileStoreType
  - defaultPageType :: PageType
  - mathMethod :: MathMethod
  - defaultLHS :: Bool
  - showLHSBirdTracks :: Bool
  - withUser :: Handler -> Handler
  - requireAuthentication :: AuthenticationLevel
  - authHandler :: Handler
  - userFile :: FilePath
  - sessionTimeout :: Int
  - templatesDir :: FilePath
  - logFile :: FilePath
  - logLevel :: Priority
  - staticDir :: FilePath
  - pluginModules :: [String]
  - tableOfContents :: Bool
  - maxUploadSize :: Integer
  - maxPageSize :: Integer
  - portNumber :: Int
  - debugMode :: Bool
  - frontPage :: String
  - noEdit :: [String]
  - noDelete :: [String]
  - defaultSummary :: String
  - accessQuestion :: Maybe (String, [String])
  - useRecaptcha :: Bool
  - recaptchaPublicKey :: String
  - recaptchaPrivateKey :: String
  - rpxDomain :: String
  - rpxKey :: String
  - compressResponses :: Bool
  - useCache :: Bool
  - cacheDir :: FilePath
  - mimeMap :: Map String String
  - mailCommand :: String
  - resetPasswordMessage :: String
  - markupHelp :: String
  - useFeed :: Bool
  - baseUrl :: String
  - useAbsoluteUrls :: Bool
  - wikiTitle :: String
  - feedDays :: Integer
  - feedRefreshTime :: Integer
  - pdfExport :: Bool
  - pandocUserData :: Maybe FilePath
  - xssSanitize :: Bool
  }
- data Page = Page {
  - pageName :: String
  - pageFormat :: PageType
  - pageLHS :: Bool
  - pageTOC :: Bool
  - pageTitle :: String
  - pageCategories :: [String]
  - pageText :: String
  - pageMeta :: [(String, String)]
  }
- type SessionKey = Integer
- data SessionData = SessionData {
  - sessionUser :: String
  }
- data Sessions a = Sessions {
  - unsession :: Map SessionKey a
  }
- data Password = Password {
  - pSalt :: String
  - pHashed :: String
  }
- data User = User {
  - uUsername :: String
  - uPassword :: Password
  - uEmail :: String
  }
- data GititState = GititState {
  - sessions :: Sessions SessionData
  - users :: Map String User
  - templatesPath :: FilePath
  - renderPage :: PageLayout -> Html -> Handler
  - plugins :: [Plugin]
  }
- type ContentTransformer = StateT Context GititServerPart
- data Plugin
  - = PageTransform (Pandoc -> PluginM Pandoc)
  - | PreParseTransform (String -> PluginM String)
  - | PreCommitTransform (String -> PluginM String)
- data PluginData = PluginData {
  - pluginConfig :: Config
  - pluginUser :: Maybe User
  - pluginRequest :: Request
  - pluginFileStore :: FileStore
  }
- type PluginM = ReaderT PluginData (StateT Context IO)
- runPluginM :: PluginM a -> PluginData -> Context -> IO (a, Context)
- data Context = Context {
  - ctxFile :: String
  - ctxLayout :: PageLayout
  - ctxCacheable :: Bool
  - ctxTOC :: Bool
  - ctxBirdTracks :: Bool
  - ctxCategories :: [String]
  - ctxMeta :: [(String, String)]
  }
- class Monad m => HasContext m where
  - getContext :: m Context
  - modifyContext :: (Context -> Context) -> m ()
- data PageLayout = PageLayout {
  - pgPageName :: String
  - pgRevision :: Maybe String
  - pgPrintable :: Bool
  - pgMessages :: [String]
  - pgTitle :: String
  - pgScripts :: [String]
  - pgShowPageTools :: Bool
  - pgShowSiteNav :: Bool
  - pgMarkupHelp :: Maybe String
  - pgTabs :: [Tab]
  - pgSelectedTab :: Tab
  - pgLinkToFeed :: Bool
  }
- data Tab
  - = ViewTab
  - | EditTab
  - | HistoryTab
  - | DiscussTab
  - | DiffTab
- data Recaptcha = Recaptcha {
  - recaptchaChallengeField :: String
  - recaptchaResponseField :: String
  }
- data Params = Params {
  - pUsername :: String
  - pPassword :: String
  - pPassword2 :: String
  - pRevision :: Maybe String
  - pDestination :: String
  - pForUser :: Maybe String
  - pSince :: Maybe UTCTime
  - pRaw :: String
  - pLimit :: Int
  - pPatterns :: [String]
  - pGotoPage :: String
  - pFileToDelete :: String
  - pEditedText :: Maybe String
  - pMessages :: [String]
  - pFrom :: Maybe String
  - pTo :: Maybe String
  - pFormat :: String
  - pSHA1 :: String
  - pLogMsg :: String
  - pEmail :: String
  - pFullName :: String
  - pAccessCode :: String
  - pWikiname :: String
  - pPrintable :: Bool
  - pOverwrite :: Bool
  - pFilename :: String
  - pFilePath :: FilePath
  - pConfirm :: Bool
  - pSessionKey :: Maybe SessionKey
  - pRecaptcha :: Recaptcha
  - pResetCode :: String
  }
- data Command = Command (Maybe String)
- data WikiState = WikiState {
  - wikiConfig :: Config
  - wikiFileStore :: FileStore
  }
- type GititServerPart = ServerPartT (ReaderT WikiState IO)
- type Handler = GititServerPart Response
- fromEntities :: String -> String

# Documentation

data PageType

Constructors

Markdown |
RST |
LaTeX |
HTML |
Textile |

Instances

Eq PageType |
Read PageType |
Show PageType |

data FileStoreType

Constructors

Git |
Darcs |
Mercurial |

Instances

Show FileStoreType |

data MathMethod

Constructors

MathML |
JsMathScript |
WebTeX String |
RawTeX |
MathJax String |

Instances

Eq MathMethod |
Read MathMethod |
Show MathMethod |

data AuthenticationLevel

Constructors

Never |
ForModify |
ForRead |

Instances

Eq AuthenticationLevel |
Ord AuthenticationLevel |
Read AuthenticationLevel |
Show AuthenticationLevel |

data Config

Data structure for information read from config file.

Constructors

Config |

Fields

repositoryPath :: FilePath

  Path of repository containing filestore

repositoryType :: FileStoreType

  Type of repository

defaultPageType :: PageType

  Default page markup type for this wiki

mathMethod :: MathMethod

  How to handle LaTeX math in pages?

defaultLHS :: Bool

  Treat as literate haskell by default?

showLHSBirdTracks :: Bool

  Show Haskell code with bird tracks

withUser :: Handler -> Handler

  Combinator to set `REMOTE_USER` request header

requireAuthentication :: AuthenticationLevel

  Handler for login, logout, register, etc.

authHandler :: Handler

  Specifies which actions require authentication.

userFile :: FilePath

  Path of users database

sessionTimeout :: Int

  Seconds of inactivity before session expires

templatesDir :: FilePath

  Directory containing page templates

logFile :: FilePath

  Path of server log file

logLevel :: Priority

  Severity filter for log messages (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)

staticDir :: FilePath

  Path of static directory

pluginModules :: [String]

  Names of plugin modules to load

tableOfContents :: Bool

  Show table of contents on each page?

maxUploadSize :: Integer

  Max size of file uploads

maxPageSize :: Integer

  Max size of page uploads

portNumber :: Int

  Port number to serve content on

debugMode :: Bool

  Print debug info to the console?

frontPage :: String

  The front page of the wiki

noEdit :: [String]

  Pages that cannot be edited via web

noDelete :: [String]

  Pages that cannot be deleted via web

defaultSummary :: String

  Default summary if description left blank

accessQuestion :: Maybe (String, [String])

  `Nothing` = anyone can register. `Just (prompt, answers)` = a user will be given the prompt and must give one of the answers to register.

useRecaptcha :: Bool

  Use ReCAPTCHA for user registration.

recaptchaPublicKey :: String
recaptchaPrivateKey :: String
rpxDomain :: String

  RPX domain and key

rpxKey :: String
compressResponses :: Bool

  Should responses be compressed?

useCache :: Bool

  Should responses be cached?

cacheDir :: FilePath

  Directory to hold cached pages

mimeMap :: Map String String

  Map associating mime types with file extensions

mailCommand :: String

  Command to send notification emails

resetPasswordMessage :: String

  Text of password reset email

markupHelp :: String

  Markup syntax help for edit sidebar

useFeed :: Bool

  Provide an atom feed?

baseUrl :: String

  Base URL of wiki, for use in feed

useAbsoluteUrls :: Bool

  Title of wiki, used in feed

wikiTitle :: String

  Should WikiLinks be absolute w.r.t. the base URL?

feedDays :: Integer

  Number of days history to be included in feed

feedRefreshTime :: Integer

  Number of minutes to cache feeds before refreshing

pdfExport :: Bool

  Allow PDF export?

pandocUserData :: Maybe FilePath

  Directory to search for pandoc customizations

xssSanitize :: Bool

  Filter HTML through xss-sanitize

data Page

Data for rendering a wiki page.

Constructors

Page |

Fields

pageName :: String
pageFormat :: PageType
pageLHS :: Bool
pageTOC :: Bool
pageTitle :: String
pageCategories :: [String]
pageText :: String
pageMeta :: [(String, String)]

Instances

Read Page |
Show Page |

type SessionKey = Integer

data SessionData

Constructors

SessionData |

Fields

sessionUser :: String

Instances

Eq SessionData |
Read SessionData |
Show SessionData |

data Sessions a

Constructors

Sessions |

Fields

unsession :: Map SessionKey a

Instances

Eq a => Eq (Sessions a) |
Read a => Read (Sessions a) |
Show a => Show (Sessions a) |

data Password

Constructors

Password |

Fields

pSalt :: String
pHashed :: String

Instances

Eq Password |
Read Password |
Show Password |

data User

Constructors

User |

Fields

uUsername :: String
uPassword :: Password
uEmail :: String

Instances

Read User |
Show User |

data GititState

Common state for all gitit wikis in an application.

Constructors

GititState |

Fields

sessions :: Sessions SessionData
users :: Map String User
templatesPath :: FilePath
renderPage :: PageLayout -> Html -> Handler
plugins :: [Plugin]

type ContentTransformer = StateT Context GititServerPart

data Plugin

Constructors

PageTransform (Pandoc -> PluginM Pandoc) |
PreParseTransform (String -> PluginM String) |
PreCommitTransform (String -> PluginM String) |

data PluginData

Constructors

PluginData |

Fields

pluginConfig :: Config
pluginUser :: Maybe User
pluginRequest :: Request
pluginFileStore :: FileStore

Instances

HasContext PluginM |

type PluginM = ReaderT PluginData (StateT Context IO)

runPluginM :: PluginM a -> PluginData -> Context -> IO (a, Context)

data Context

Constructors

Context |

Fields

ctxFile :: String
ctxLayout :: PageLayout
ctxCacheable :: Bool
ctxTOC :: Bool
ctxBirdTracks :: Bool
ctxCategories :: [String]
ctxMeta :: [(String, String)]

Instances

HasContext PluginM |
HasContext ContentTransformer |

class Monad m => HasContext m where

Methods

getContext :: m Context

modifyContext :: (Context -> Context) -> m ()

Instances

HasContext PluginM |
HasContext ContentTransformer |

data PageLayout

Abstract representation of page layout (tabs, scripts, etc.)

Constructors

PageLayout |

Fields

pgPageName :: String
pgRevision :: Maybe String
pgPrintable :: Bool
pgMessages :: [String]
pgTitle :: String
pgScripts :: [String]
pgShowPageTools :: Bool
pgShowSiteNav :: Bool
pgMarkupHelp :: Maybe String
pgTabs :: [Tab]
pgSelectedTab :: Tab
pgLinkToFeed :: Bool

data Tab

Constructors

ViewTab |
EditTab |
HistoryTab |
DiscussTab |
DiffTab |

Instances

Eq Tab |
Show Tab |

data Recaptcha

Constructors

Recaptcha |

Fields

recaptchaChallengeField :: String
recaptchaResponseField :: String

Instances

Read Recaptcha |
Show Recaptcha |

data Params

Constructors

Params |

Fields

pUsername :: String
pPassword :: String
pPassword2 :: String
pRevision :: Maybe String
pDestination :: String
pForUser :: Maybe String
pSince :: Maybe UTCTime
pRaw :: String
pLimit :: Int
pPatterns :: [String]
pGotoPage :: String
pFileToDelete :: String
pEditedText :: Maybe String
pMessages :: [String]
pFrom :: Maybe String
pTo :: Maybe String
pFormat :: String
pSHA1 :: String
pLogMsg :: String
pEmail :: String
pFullName :: String
pAccessCode :: String
pWikiname :: String
pPrintable :: Bool
pOverwrite :: Bool
pFilename :: String
pFilePath :: FilePath
pConfirm :: Bool
pSessionKey :: Maybe SessionKey
pRecaptcha :: Recaptcha
pResetCode :: String

Instances

Show Params |
FromData Params |

data Command

Constructors

Command (Maybe String) |

Instances

Show Command |
FromData Command |

data WikiState

State for a single wiki.

Constructors

WikiState |

Fields

wikiConfig :: Config
wikiFileStore :: FileStore

Instances

HasContext ContentTransformer |

type GititServerPart = ServerPartT (ReaderT WikiState IO)

type Handler = GititServerPart Response

fromEntities :: String -> String