aboutsummaryrefslogtreecommitdiff
path: root/html-test/run.hs
blob: 8d1b40a89cda2223ad4ac91ebc70112c338a083b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{-# LANGUAGE CPP #-}


import System.Environment
import System.FilePath

import Test.Haddock
import Test.Haddock.Xhtml


checkConfig :: CheckConfig Xhtml
checkConfig = CheckConfig
    { ccfgRead = \mdl input -> stripIfRequired mdl <$> parseXhtml input
    , ccfgDump = dumpXhtml
    , ccfgEqual = (==)
    }


dirConfig :: DirConfig
dirConfig = defaultDirConfig $ takeDirectory __FILE__


main :: IO ()
main = runAndCheck =<< parseArgs checkConfig dirConfig =<< getArgs


stripIfRequired :: String -> Xhtml -> Xhtml
stripIfRequired mdl =
    stripLinks' . stripFooter
  where
    stripLinks'
        | mdl `elem` preserveLinksModules = id
        | otherwise = stripLinks


-- | List of modules in which we don't 'stripLinks'
preserveLinksModules :: [String]
preserveLinksModules = ["Bug253"]