Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (15 sloc) 0.576 kb
module ShowUser (plugin) where
-- This plugin replaces $USER$ with the name of the currently logged in
-- user, or the empty string if no one is logged in.
import Network.Gitit.Interface
import Data.Maybe (fromMaybe)
plugin :: Plugin
plugin = mkPageTransformM showuser
showuser :: Inline -> PluginM Inline
showuser (Math InlineMath x) | x == "USER" = do
doNotCache -- tell gitit not to cache this page, as it has dynamic content
mbUser <- askUser
case mbUser of
Nothing -> return $ Str ""
Just u -> return $ Str $ uUsername u
showuser x = return x
Jump to Line
Something went wrong with that request. Please try again.