aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockHtml.hs
diff options
context:
space:
mode:
authorpanne <unknown>2004-07-13 17:59:28 +0000
committerpanne <unknown>2004-07-13 17:59:28 +0000
commit46dec6c5afd0273a03ca7526c4b6af8f1fbaca26 (patch)
tree724dcb6dc63860468957226fcaed51d421c8dfac /src/HaddockHtml.hs
parentd5278f67bec86081c2aec9def27d59309cf02ffe (diff)
[haddock @ 2004-07-13 17:59:28 by panne]
A quote is a valid part of a Haskell identifier, but it would interfere with an ECMA script string delimiter, so escape it there.
Diffstat (limited to 'src/HaddockHtml.hs')
-rw-r--r--src/HaddockHtml.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs
index a52e831b..1909805a 100644
--- a/src/HaddockHtml.hs
+++ b/src/HaddockHtml.hs
@@ -583,7 +583,7 @@ ppHsDataDecl summary instances is_newty
aboves (map ppSideBySideConstr cons)
)
- inst_id = "i:" ++ hsNameStr nm
+ inst_id = collapseId nm
instances_bit
| null instances = Html.emptyTable
@@ -762,7 +762,7 @@ ppHsClassDecl summary instances orig_c
]
)
- inst_id = "i:" ++ hsNameStr nm
+ inst_id = collapseId nm
instances_bit
| null instances = Html.emptyTable
| otherwise
@@ -1126,3 +1126,8 @@ collapsebutton id =
collapsed :: String -> Html -> Html
collapsed id html =
thediv ! [identifier id, thestyle "display:none;"] << html
+
+-- A quote is a valid part of a Haskell identifier, but it would interfere with
+-- the ECMA script string delimiter used in collapsebutton above.
+collapseId :: HsName -> String
+collapseId nm = "i:" ++ escapeString (hsNameStr nm) (/= '\'')