diff options
author | simonmar <unknown> | 2002-07-25 14:37:29 +0000 |
---|---|---|
committer | simonmar <unknown> | 2002-07-25 14:37:29 +0000 |
commit | d6edc43ef6c96e1c2c0c0564cfe502f17d0a53ed (patch) | |
tree | c0ea7ef6e0512a365c4b1c7bea3a967ced615879 /src/HaddockHtml.hs | |
parent | 4d8d5e948cd6620ed923bf7b11ce408a728e3521 (diff) |
[haddock @ 2002-07-25 14:37:28 by simonmar]
Patch to allow simple hyperlinking to an arbitrary location in another
module's documentation, from Volker Stolz.
Now in a doc comment:
#foo#
creates
<a name="foo"></a>
And you can use the form "M\#foo" to hyperlink to the label 'foo' in
module 'M'. Note that the backslash is necessary for now.
Diffstat (limited to 'src/HaddockHtml.hs')
-rw-r--r-- | src/HaddockHtml.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs index cdca7672..7009ba89 100644 --- a/src/HaddockHtml.hs +++ b/src/HaddockHtml.hs @@ -852,10 +852,11 @@ linkId (Module mdl) str = moduleHtmlFile fp mdl ++ '#': hsNameStr str Nothing -> "" ppHsModule :: String -> Html -ppHsModule mdl = anchor ! [href (moduleHtmlFile fp mdl)] << toHtml mdl - where fp = case lookupFM html_xrefs (Module mdl) of +ppHsModule mdl = anchor ! [href ((moduleHtmlFile fp modname) ++ ref)] << toHtml mdl + where fp = case lookupFM html_xrefs (Module modname) of Just fp0 -> fp0 Nothing -> "" + (modname,ref) = break (== '#') mdl -- ----------------------------------------------------------------------------- -- * Doc Markup @@ -872,7 +873,8 @@ htmlMarkup = Markup { markupUnorderedList = ulist . concatHtml . map (li <<), markupOrderedList = olist . concatHtml . map (li <<), markupCodeBlock = pre, - markupURL = \url -> anchor ! [href url] << toHtml url + markupURL = \url -> anchor ! [href url] << toHtml url, + markupAName = \aname -> anchor ! [name aname] << toHtml "" } -- If the doc is a single paragraph, don't surround it with <P> (this causes |