File: Deprofanizer.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 (18 lines) | stat: -rw-r--r-- 465 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Deprofanizer (plugin) where

-- This plugin replaces profane words with "XXXXX".

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

plugin :: Plugin
plugin = mkPageTransform deprofanize

deprofanize :: Inline -> Inline
deprofanize (Str x) | isBadWord x = Str "XXXXX"
deprofanize x                     = x

isBadWord :: String -> Bool
isBadWord x = map toLower x `elem` ["darn", "blasted", "stinker"]
-- there are more, but this is a family program