diff options
Diffstat (limited to 'utils/hpc')
-rw-r--r-- | utils/hpc/HpcMarkup.hs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/utils/hpc/HpcMarkup.hs b/utils/hpc/HpcMarkup.hs index dff6012cb0..bd297828e5 100644 --- a/utils/hpc/HpcMarkup.hs +++ b/utils/hpc/HpcMarkup.hs @@ -13,6 +13,7 @@ import HpcFlags import HpcUtils import System.Directory +import System.IO (localeEncoding) import Data.List import Data.Maybe(fromJust) import Data.Array @@ -79,6 +80,8 @@ markup_main flags (prog:modNames) = do writeFileUsing (dest_dir ++ "/" ++ filename ++ ".html") $ "<html>" ++ + "<head>" ++ + charEncodingTag ++ "<style type=\"text/css\">" ++ "table.bar { background-color: #f25913; }\n" ++ "td.bar { background-color: #60de51; }\n" ++ @@ -87,6 +90,8 @@ markup_main flags (prog:modNames) = do ".dashboard td { border: solid 1px black }\n" ++ ".dashboard th { border: solid 1px black }\n" ++ "</style>\n" ++ + "</head>" ++ + "<body>" ++ "<table class=\"dashboard\" width=\"100%\" border=1>\n" ++ "<tr>" ++ "<th rowspan=2><a href=\"" ++ index_name ++ ".html\">module</a></th>" ++ @@ -110,7 +115,7 @@ markup_main flags (prog:modNames) = do [ modSummary | (_,_,modSummary) <- mods' ]) - ++ "</table></html>\n" + ++ "</table></body></html>\n" writeSummary index_name $ \ (n1,_,_) (n2,_,_) -> compare n1 n2 @@ -130,6 +135,11 @@ markup_main flags (prog:modNames) = do markup_main _ [] = hpcError markup_plugin $ "no .tix file or executable name specified" +charEncodingTag :: String +charEncodingTag = + "<meta http-equiv=\"Content-Type\" " ++ + "content=\"text/html; " ++ "charset=" ++ show localeEncoding ++ "\">" + genHtmlFromMod :: String -> Flags @@ -206,7 +216,10 @@ genHtmlFromMod dest_dir flags tix theFunTotals invertOutput = do let fileName = modName0 ++ ".hs.html" putStrLn $ "Writing: " ++ fileName writeFileUsing (dest_dir ++ "/" ++ fileName) $ - unlines [ "<html><style type=\"text/css\">", + unlines ["<html>", + "<head>", + charEncodingTag, + "<style type=\"text/css\">", "span.lineno { color: white; background: #aaaaaa; border-right: solid white 12px }", if invertOutput then "span.nottickedoff { color: #404040; background: white; font-style: oblique }" @@ -222,7 +235,10 @@ genHtmlFromMod dest_dir flags tix theFunTotals invertOutput = do else "span.decl { font-weight: bold }", "span.spaces { background: white }", "</style>", - "<pre>"] ++ addLines content' ++ "\n</pre>\n</html>\n"; + "</head>", + "<body>", + "<pre>"] ++ addLines content' ++ "\n</pre>\n</body>\n</html>\n"; + modSummary `seq` return (modName0,fileName,modSummary) |