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

Safe Haskell | None
Language | Haskell98

Network.Gitit.Types

Description

Types for Gitit modules.

Synopsis

- data PageType
  - = Markdown
  - | CommonMark
  - | RST
  - | LaTeX
  - | HTML
  - | Textile
  - | Org
  - | DocBook
  - | MediaWiki
- 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
  - defaultExtension :: String
  - 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
  - address :: String
  - portNumber :: Int
  - debugMode :: Bool
  - frontPage :: String
  - noEdit :: [String]
  - noDelete :: [String]
  - defaultSummary :: String
  - deleteSummary :: 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
  - recentActivityDays :: Int
  - githubAuth :: GithubConfig
  }
- 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 :: String -> SessionData
- sessionDataGithubState :: String -> SessionData
- sessionUser :: SessionData -> Maybe String
- sessionGithubState :: SessionData -> Maybe String
- data User = User {
  - uUsername :: String
  - uPassword :: Password
  - uEmail :: String
  }
- data Sessions a = Sessions {
  - unsession :: Map SessionKey a
  }
- data Password = Password {
  - pSalt :: String
  - pHashed :: String
  }
- data GititState = GititState {
  - sessions :: Sessions SessionData
  - users :: Map String User
  - templatesPath :: FilePath
  - renderPage :: PageLayout -> Html -> Handler
  - plugins :: [Plugin]
  }
- class Monad m => HasContext m where
  - getContext :: m Context
  - modifyContext :: (Context -> Context) -> m ()
- 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)]
  }
- 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
  - pRedirect :: Maybe Bool
  }
- 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
- data GithubConfig
- oAuth2 :: GithubConfig -> OAuth2
- org :: GithubConfig -> Maybe Text
- githubConfig :: OAuth2 -> Maybe Text -> GithubConfig

# Documentation

data PageType Source

Constructors

Markdown |
CommonMark |
RST |
LaTeX |
HTML |
Textile |
Org |
DocBook |
MediaWiki |

Instances

Eq PageType Source |
Read PageType Source |
Show PageType Source |

data FileStoreType Source

Constructors

Git |
Darcs |
Mercurial |

Instances

Show FileStoreType Source |

data MathMethod Source

Constructors

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

Instances

Eq MathMethod Source |
Read MathMethod Source |
Show MathMethod Source |

data AuthenticationLevel Source

Constructors

Never |
ForModify |
ForRead |

Instances

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

data Config Source

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

defaultExtension :: String

  Default file extension for pages in 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

address :: String

  IP address to bind to

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

deleteSummary :: String

  Delete summary

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

recentActivityDays :: Int

  The default number of days in the past to look for "recent" activity

githubAuth :: GithubConfig

  Github client data for authentication (id, secret, callback, authorize endpoint, access token endpoint)

data Page Source

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 Source |
Show Page Source |

type SessionKey = Integer Source

data SessionData Source

Instances

Eq SessionData Source |
Read SessionData Source |
Show SessionData Source |

sessionData :: String -> SessionData Source

sessionDataGithubState :: String -> SessionData Source

sessionUser :: SessionData -> Maybe String Source

sessionGithubState :: SessionData -> Maybe String Source

data User Source

Constructors

User |

Fields

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

Instances

Read User Source |
Show User Source |

data Sessions a Source

Constructors

Sessions |

Fields

unsession :: Map SessionKey a

Instances

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

data Password Source

Constructors

Password |

Fields

pSalt :: String
pHashed :: String

Instances

Eq Password Source |
Read Password Source |
Show Password Source |

data GititState Source

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]

class Monad m => HasContext m where Source

Methods

getContext :: m Context Source

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

Instances

HasContext PluginM Source |
HasContext ContentTransformer Source |

type ContentTransformer = StateT Context GititServerPart Source

data Plugin Source

Constructors

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

data PluginData Source

Constructors

PluginData |

Fields

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

Instances

HasContext PluginM Source |

type PluginM = ReaderT PluginData (StateT Context IO) Source

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

data Context Source

Constructors

Context |

Fields

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

Instances

HasContext PluginM Source |
HasContext ContentTransformer Source |

data PageLayout Source

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 Source

Constructors

ViewTab |
EditTab |
HistoryTab |
DiscussTab |
DiffTab |

Instances

Eq Tab Source |
Show Tab Source |

data Recaptcha Source

Constructors

Recaptcha |

Fields

recaptchaChallengeField :: String
recaptchaResponseField :: String

Instances

Read Recaptcha Source |
Show Recaptcha Source |

data Params Source

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
pRedirect :: Maybe Bool

Instances

Show Params Source |
FromData Params Source |

data Command Source

Constructors

Command (Maybe String) |

Instances

Show Command Source |
FromData Command Source |

data WikiState Source

State for a single wiki.

Constructors

WikiState |

Fields

wikiConfig :: Config
wikiFileStore :: FileStore

Instances

HasContext ContentTransformer Source |

type GititServerPart = ServerPartT (ReaderT WikiState IO) Source

type Handler = GititServerPart Response Source

fromEntities :: String -> String Source

data GithubConfig Source

oAuth2 :: GithubConfig -> OAuth2 Source

org :: GithubConfig -> Maybe Text Source

githubConfig :: OAuth2 -> Maybe Text -> GithubConfig Source