Deprofanizer.hs 465 B

12345678910111213141516171819
  1. module Deprofanizer (plugin) where
  2. -- This plugin replaces profane words with "XXXXX".
  3. import Network.Gitit.Interface
  4. import Data.Char (toLower)
  5. plugin :: Plugin
  6. plugin = mkPageTransform deprofanize
  7. deprofanize :: Inline -> Inline
  8. deprofanize (Str x) | isBadWord x = Str "XXXXX"
  9. deprofanize x = x
  10. isBadWord :: String -> Bool
  11. isBadWord x = map toLower x `elem` ["darn", "blasted", "stinker"]
  12. -- there are more, but this is a family program