aboutsummaryrefslogtreecommitdiff
path: root/html-test/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'html-test/Main.hs')
-rwxr-xr-xhtml-test/Main.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/html-test/Main.hs b/html-test/Main.hs
new file mode 100755
index 00000000..8d1b40a8
--- /dev/null
+++ b/html-test/Main.hs
@@ -0,0 +1,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"]