Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gitit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ main = do

-- start the server
simpleHTTPWithSocket sock serverConf $ msum [ wiki conf
, dir "_reloadTemplates" reloadTemplates
, dir "_reloadTemplates" (reloadTemplates conf)
]

data ExitOpt
Expand Down
6 changes: 3 additions & 3 deletions src/Network/Gitit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ wikiHandlers =
]

-- | Recompiles the gitit templates.
reloadTemplates :: ServerPart Response
reloadTemplates = do
liftIO recompilePageTemplate
reloadTemplates :: Config -> ServerPart Response
reloadTemplates cfg = do
liftIO $ recompilePageTemplate cfg
ok $ toResponse "Page templates have been recompiled."

-- | Converts a gitit Handler into a standard happstack ServerPart.
Expand Down
8 changes: 3 additions & 5 deletions src/Network/Gitit/Initialize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,13 @@ initializeGititState conf = do

updateGititState $ \s -> s { sessions = Sessions M.empty
, users = users'
, templatesPath = templatesDir conf
, renderPage = defaultRenderPage templ
, plugins = plugins' }

-- | Recompile the page template.
recompilePageTemplate :: IO ()
recompilePageTemplate = do
tempsDir <- queryGititState templatesPath
ct <- compilePageTemplate tempsDir
recompilePageTemplate :: Config -> IO ()
recompilePageTemplate cfg = do
ct <- compilePageTemplate (templatesDir cfg)
updateGititState $ \st -> st{renderPage = defaultRenderPage ct}

--- | Compile a master page template named @page.st@ in the directory specified.
Expand Down
1 change: 0 additions & 1 deletion src/Network/Gitit/State.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import Network.Gitit.Types
gititstate :: IORef GititState
gititstate = unsafePerformIO $ newIORef GititState { sessions = undefined
, users = undefined
, templatesPath = undefined
, renderPage = undefined
, plugins = undefined }

Expand Down
1 change: 0 additions & 1 deletion src/Network/Gitit/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ data User = User {
data GititState = GititState {
sessions :: Sessions SessionData,
users :: M.Map String User,
templatesPath :: FilePath,
renderPage :: PageLayout -> Html -> Handler,
plugins :: [Plugin]
}
Expand Down