diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/HaddockHtml.hs | 8 | ||||
-rw-r--r-- | src/Html.hs | 24 |
2 files changed, 8 insertions, 24 deletions
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs index 8c17547f..af690fbe 100644 --- a/src/HaddockHtml.hs +++ b/src/HaddockHtml.hs @@ -229,7 +229,7 @@ ppHtmlContents odir doctitle maybe_package maybe_html_help_format maybe_index_ur s15 </> footer ) - writeFile (odir ++ pathSeparator:contentsHtmlFile) (renderHtml html False) + writeFile (odir ++ pathSeparator:contentsHtmlFile) (renderHtml html) -- Generate contents page for Html Help if requested case maybe_html_help_format of @@ -315,7 +315,7 @@ ppHtmlIndex odir doctitle maybe_package maybe_html_help_format maybe_contents_ur when split_indices $ mapM_ (do_sub_index index) initialChars - writeFile (odir ++ pathSeparator:indexHtmlFile) (renderHtml html False) + writeFile (odir ++ pathSeparator:indexHtmlFile) (renderHtml html) -- Generate index and contents page for Html Help if requested case maybe_html_help_format of @@ -346,7 +346,7 @@ ppHtmlIndex odir doctitle maybe_package maybe_html_help_format maybe_contents_ur do_sub_index this_ix c = unless (null index_part) $ writeFile (odir ++ pathSeparator:subIndexHtmlFile c) - (renderHtml html False) + (renderHtml html) where html = header (thetitle (toHtml (doctitle ++ " (Index)")) +++ thelink ! [href cssFile, @@ -435,7 +435,7 @@ ppHtmlModule odir doctitle source_url ifaceToHtml mdl iface </> s15 </> footer ) - writeFile (odir ++ pathSeparator:moduleHtmlFile mdl) (renderHtml html False) + writeFile (odir ++ pathSeparator:moduleHtmlFile mdl) (renderHtml html) ifaceToHtml :: String -> Interface -> HtmlTable ifaceToHtml _ iface diff --git a/src/Html.hs b/src/Html.hs index 59331cb2..a360814e 100644 --- a/src/Html.hs +++ b/src/Html.hs @@ -9,7 +9,7 @@ -- Stability : experimental -- Portability : portable -- --- $Id: Html.hs,v 1.5 2004/03/25 16:00:37 simonmar Exp $ +-- $Id: Html.hs,v 1.6 2004/08/02 20:32:29 panne Exp $ -- -- An Html combinator library -- @@ -962,10 +962,10 @@ gui act = form ! [action act,method "POST"] -- The output is quite messy, because space matters in -- HTML, so we must not generate needless spaces. -renderHtml :: (HTML html) => html -> Bool -> String -renderHtml theHtml pretty = +renderHtml :: (HTML html) => html -> String +renderHtml theHtml = renderMessage ++ - foldr (.) id (map (if pretty then renderHtml' 0 else unprettyHtml) + foldr (.) id (map unprettyHtml (getHtmlElements (tag "HTML" << theHtml))) "\n" renderMessage :: String @@ -973,22 +973,6 @@ renderMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" ++ "<!--Rendered using the Haskell Html Library v0.2-->\n" --- Warning: spaces matters in HTML. You are better using renderHtml. --- This is intentually very inefficent to "encorage" this, --- but the neater version in easier when debugging. - -renderHtml' :: Int -> HtmlElement -> ShowS -renderHtml' _ (HtmlString str) = (++) str -renderHtml' n (HtmlTag - { markupTag = name0, - markupContent = html, - markupAttrs = markupAttrs0 }) - = if isNoHtml html && elem name0 validHtmlITags - then renderTag True name0 markupAttrs0 n - else (renderTag True name0 markupAttrs0 n - . foldr (.) id (map (renderHtml' (n+2)) (getHtmlElements html)) - . renderTag False name0 [] n) - unprettyHtml :: HtmlElement -> ShowS unprettyHtml (HtmlString str) = (++) str unprettyHtml (HtmlTag |