aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends/Xhtml/DocMarkup.hs
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2011-11-26 17:01:06 +0100
committerDavid Waern <david.waern@gmail.com>2011-11-26 17:01:06 +0100
commit1345132fd141b8d9b12e858ccc0765272f703e49 (patch)
treeaf13cc6fca295a35cf8d4d3c8391ebab5f87f83c /src/Haddock/Backends/Xhtml/DocMarkup.hs
parent3ebdc745d7bc79307986332dc71f3495099b4579 (diff)
Allow doc comments to link to out-of-scope things (#78).
(A bug that should have been fixed long ago.)
Diffstat (limited to 'src/Haddock/Backends/Xhtml/DocMarkup.hs')
-rw-r--r--src/Haddock/Backends/Xhtml/DocMarkup.hs53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/Haddock/Backends/Xhtml/DocMarkup.hs b/src/Haddock/Backends/Xhtml/DocMarkup.hs
index 05ce7dbb..87d67b76 100644
--- a/src/Haddock/Backends/Xhtml/DocMarkup.hs
+++ b/src/Haddock/Backends/Xhtml/DocMarkup.hs
@@ -30,25 +30,26 @@ import Text.XHtml hiding ( name, title, p, quote )
import GHC
-parHtmlMarkup :: (a -> Html) -> DocMarkup a Html
-parHtmlMarkup ppId = Markup {
- markupEmpty = noHtml,
- markupString = toHtml,
- markupParagraph = paragraph,
- markupAppend = (+++),
- markupIdentifier = thecode . ppId,
- markupModule = \m -> let (mdl,ref) = break (=='#') m
- in ppModuleRef (mkModuleNoPackage mdl) ref,
- markupEmphasis = emphasize,
- markupMonospaced = thecode,
- markupUnorderedList = unordList,
- markupOrderedList = ordList,
- markupDefList = defList,
- markupCodeBlock = pre,
- markupURL = \url -> anchor ! [href url] << url,
- markupAName = \aname -> namedAnchor aname << "",
- markupPic = \path -> image ! [src path],
- markupExample = examplesToHtml
+parHtmlMarkup :: Qualification -> (a -> Html) -> DocMarkup a Html
+parHtmlMarkup qual ppId = Markup {
+ markupEmpty = noHtml,
+ markupString = toHtml,
+ markupParagraph = paragraph,
+ markupAppend = (+++),
+ markupIdentifier = thecode . ppId,
+ markupIdentifierUnchecked = thecode . ppUncheckedLink qual,
+ markupModule = \m -> let (mdl,ref) = break (=='#') m
+ in ppModuleRef (mkModuleNoPackage mdl) ref,
+ markupEmphasis = emphasize,
+ markupMonospaced = thecode,
+ markupUnorderedList = unordList,
+ markupOrderedList = ordList,
+ markupDefList = defList,
+ markupCodeBlock = pre,
+ markupURL = \url -> anchor ! [href url] << url,
+ markupAName = \aname -> namedAnchor aname << "",
+ markupPic = \path -> image ! [src path],
+ markupExample = examplesToHtml
}
where
examplesToHtml l = pre (concatHtml $ map exampleToHtml l) ! [theclass "screen"]
@@ -64,17 +65,17 @@ parHtmlMarkup ppId = Markup {
-- ugly extra whitespace with some browsers). FIXME: Does this still apply?
docToHtml :: Qualification -> Doc DocName -> Html
docToHtml qual = markup fmt . cleanup
- where fmt = parHtmlMarkup (ppDocName qual)
+ where fmt = parHtmlMarkup qual (ppDocName qual)
-origDocToHtml :: Doc Name -> Html
-origDocToHtml = markup fmt . cleanup
- where fmt = parHtmlMarkup ppName
+origDocToHtml :: Qualification -> Doc Name -> Html
+origDocToHtml qual = markup fmt . cleanup
+ where fmt = parHtmlMarkup qual ppName
-rdrDocToHtml :: Doc RdrName -> Html
-rdrDocToHtml = markup fmt . cleanup
- where fmt = parHtmlMarkup ppRdrName
+rdrDocToHtml :: Qualification -> Doc RdrName -> Html
+rdrDocToHtml qual = markup fmt . cleanup
+ where fmt = parHtmlMarkup qual ppRdrName
docElement :: (Html -> Html) -> Html -> Html