aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockHtml.hs
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-08-02 09:25:23 +0000
committersimonmar <unknown>2002-08-02 09:25:23 +0000
commit8106b086a5ce09914fdc9f331a7bc91a5b2e0c1a (patch)
treec8a9dcbd17b4f9cf23114debb65b2fbbbafdb779 /src/HaddockHtml.hs
parentb34d18fa77592244882566046f0f5946aa148409 (diff)
[haddock @ 2002-08-02 09:25:20 by simonmar]
Remove <P>..</P> from around list items, to reduce excess whitespace between the items of bulleted and ordered lists. (Suggestion from Daan Leijen).
Diffstat (limited to 'src/HaddockHtml.hs')
-rw-r--r--src/HaddockHtml.hs20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs
index 7009ba89..db4016bf 100644
--- a/src/HaddockHtml.hs
+++ b/src/HaddockHtml.hs
@@ -860,6 +860,7 @@ ppHsModule mdl = anchor ! [href ((moduleHtmlFile fp modname) ++ ref)] << toHtml
-- -----------------------------------------------------------------------------
-- * Doc Markup
+
htmlMarkup :: DocMarkup [HsQName] Html
htmlMarkup = Markup {
markupParagraph = paragraph,
@@ -880,9 +881,22 @@ htmlMarkup = Markup {
-- If the doc is a single paragraph, don't surround it with <P> (this causes
-- ugly extra whitespace with some browsers).
docToHtml :: Doc -> Html
-docToHtml (DocParagraph d) = docToHtml d
-docToHtml (DocCodeBlock d) = docToHtml (DocMonospaced d)
-docToHtml doc = markup htmlMarkup doc
+docToHtml doc = markup htmlMarkup (unParagraph (markup htmlCleanup doc))
+
+-- If there is a single paragraph, then surrounding it with <P>..</P>
+-- can add too much whitespace in some browsers (eg. IE). However if
+-- we have multiple paragraphs, then we want the extra whitespace to
+-- separate them. So we catch the single paragraph case and transform it
+-- here.
+unParagraph (DocParagraph d) = d
+unParagraph (DocCodeBlock d) = (DocMonospaced d)
+unParagraph doc = doc
+
+htmlCleanup :: DocMarkup [HsQName] Doc
+htmlCleanup = idMarkup {
+ markupUnorderedList = DocUnorderedList . map unParagraph,
+ markupOrderedList = DocOrderedList . map unParagraph
+ }
-- -----------------------------------------------------------------------------
-- * Misc