aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends/Xhtml
diff options
context:
space:
mode:
authorMark Lentczner <markl@glyphic.com>2010-07-13 05:26:21 +0000
committerMark Lentczner <markl@glyphic.com>2010-07-13 05:26:21 +0000
commit16c666804946a08870926f25205117104625b72e (patch)
tree17e979d1ab136b28168b6ea457879c804c48adf5 /src/Haddock/Backends/Xhtml
parent92eb93b4d7ede4a28aff90a1697951c6aef093cf (diff)
change to new page structure
Diffstat (limited to 'src/Haddock/Backends/Xhtml')
-rw-r--r--src/Haddock/Backends/Xhtml/Layout.hs36
-rw-r--r--src/Haddock/Backends/Xhtml/Util.hs7
2 files changed, 41 insertions, 2 deletions
diff --git a/src/Haddock/Backends/Xhtml/Layout.hs b/src/Haddock/Backends/Xhtml/Layout.hs
index ac6f5021..86c722b7 100644
--- a/src/Haddock/Backends/Xhtml/Layout.hs
+++ b/src/Haddock/Backends/Xhtml/Layout.hs
@@ -11,6 +11,14 @@
-- Portability : portable
-----------------------------------------------------------------------------
module Haddock.Backends.Xhtml.Layout (
+ divPackageHeader, divModuleHeader, divFooter,
+ divTableOfContents, divDescription, divSynposis, divInterface,
+
+ sectionName,
+
+ shortDeclList,
+ divTopDecl,
+
topDeclElem, declElem,
instHdr, atHdr, methHdr, constrHdr,
@@ -29,10 +37,36 @@ import Text.XHtml hiding ( name, title, p, quote )
import FastString ( unpackFS )
import GHC
+-- Sections of the document
+
+divPackageHeader, divModuleHeader, divFooter :: Html -> Html
+divPackageHeader = thediv ! [identifier "package-header"]
+divModuleHeader = thediv ! [identifier "module-header"]
+divFooter = thediv ! [identifier "footer"]
+
+divTableOfContents, divDescription, divSynposis, divInterface :: Html -> Html
+divTableOfContents = thediv ! [identifier "table-of-contents"]
+divDescription = thediv ! [identifier "description"]
+divSynposis = thediv ! [identifier "synopsis"]
+divInterface = thediv ! [identifier "interface"]
+
+-- | The name of a section, used directly after opening a section
+sectionName :: Html -> Html
+sectionName = paragraph ! [theclass "caption"]
+
+
+-- | Declaration containers
+
+shortDeclList :: [Html] -> Html
+shortDeclList items = ulist << map (li ! [theclass "src short"] <<) items
+
+divTopDecl :: Html -> Html
+divTopDecl = thediv ! [theclass "top"]
+
-- a box for displaying code
declElem :: Html -> Html
-declElem = paragraph ! [theclass "decl"]
+declElem = paragraph ! [theclass "src"]
-- a box for top level documented names
-- it adds a source and wiki link at the right hand side of the box
diff --git a/src/Haddock/Backends/Xhtml/Util.hs b/src/Haddock/Backends/Xhtml/Util.hs
index 9e13acd6..826b69f1 100644
--- a/src/Haddock/Backends/Xhtml/Util.hs
+++ b/src/Haddock/Backends/Xhtml/Util.hs
@@ -16,7 +16,7 @@ module Haddock.Backends.Xhtml.Util (
namedAnchor, linkedAnchor,
spliceURL,
- (<+>), char, empty,
+ (<+>), char, empty, nonEmpty,
keyword, punctuate,
braces, brackets, pabrackets, parens, parenList, ubxParenList,
@@ -110,6 +110,11 @@ char c = toHtml [c]
empty :: Html
empty = noHtml
+-- | ensure content contains at least something (a non-breaking space)
+nonEmpty :: (HTML a) => a -> Html
+nonEmpty a = if isNoHtml h then spaceHtml else h
+ where h = toHtml a
+
quote :: Html -> Html
quote h = char '`' +++ h +++ '`'