Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 20 lines (15 sloc) 0.573 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
module CapitalizeEmphasis (plugin) where

-- This plugin converts emphasized text to ALL CAPS.
-- Not a very useful feature, but useful as an example
-- of how to write a plugin.

import Network.Gitit.Interface
import Data.Char (toUpper)

plugin :: Plugin
plugin = mkPageTransform capsTransform

capsTransform :: [Inline] -> [Inline]
capsTransform (Emph x : xs) = processWith capStr x ++ capsTransform xs
capsTransform (x:xs) = x : capsTransform xs
capsTransform [] = []

capStr :: Inline -> Inline
capStr (Str x) = Str (map toUpper x)
capStr x = x
Something went wrong with that request. Please try again.