CapitalizeEmphasis.hs 573 B

123456789101112131415161718192021
  1. module CapitalizeEmphasis (plugin) where
  2. -- This plugin converts emphasized text to ALL CAPS.
  3. -- Not a very useful feature, but useful as an example
  4. -- of how to write a plugin.
  5. import Network.Gitit.Interface
  6. import Data.Char (toUpper)
  7. plugin :: Plugin
  8. plugin = mkPageTransform capsTransform
  9. capsTransform :: [Inline] -> [Inline]
  10. capsTransform (Emph x : xs) = processWith capStr x ++ capsTransform xs
  11. capsTransform (x:xs) = x : capsTransform xs
  12. capsTransform [] = []
  13. capStr :: Inline -> Inline
  14. capStr (Str x) = Str (map toUpper x)
  15. capStr x = x