File: CapitalizeEmphasis.hs

package info (click to toggle)
gitit 0.12.1.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,008 kB
  • ctags: 78
  • sloc: haskell: 4,963; xml: 245; sh: 65; makefile: 16
file content (20 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (8)
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