Fix Show instances on newtypes.
[doclang.git] / Text / Blaze / DTC.hs
index 327efec5882113932c81016dbc942373c435435a..71f02b0a4a11058948f72f785e4995918fa9ea90 100644 (file)
@@ -17,25 +17,25 @@ xmlModel :: Text -> DTC
 xmlModel rnc =
        Leaf "xml-model" "<?xml-model" "?>\n" ()
         ! attribute "type" " type=\"" "application/relax-ng-compact-syntax"
-        ! attribute "href" " href=\"" (attrValue rnc)
+        ! attribute "href" " href=\"" (attrify rnc)
 
 xmlStylesheet :: Text -> DTC
 xmlStylesheet xsl =
        Leaf "xml-stylesheet" "<?xml-stylesheet" "?>\n" ()
         ! attribute "type" " type=\"" "text/xsl"
-        ! attribute "href" " href=\"" (attrValue xsl)
+        ! attribute "href" " href=\"" (attrify xsl)
 
 html5Stylesheet :: Text -> DTC
 html5Stylesheet xsl =
        Leaf "html5-stylesheet" "<?html5-stylesheet" "?>\n" ()
         ! attribute "type" " type=\"" "text/xsl"
-        ! attribute "href" " href=\"" (attrValue xsl)
+        ! attribute "href" " href=\"" (attrify xsl)
 
 atomStylesheet :: Text -> DTC
 atomStylesheet xsl =
        Leaf "atom-stylesheet" "<?atom-stylesheet" "?>\n" ()
         ! attribute "type" " type=\"" "text/xsl"
-        ! attribute "href" " href=\"" (attrValue xsl)
+        ! attribute "href" " href=\"" (attrify xsl)
 
 about :: DTC -> DTC
 about = Parent "about" "<about" "</about>"
@@ -49,6 +49,8 @@ b :: DTC -> DTC
 b = Parent "b" "<b" "</b>"
 br :: DTC
 br = Leaf "br" "<br" " />" ()
+break :: DTC
+break = Leaf "break" "<break" " />" ()
 call :: DTC -> DTC
 call = Parent "call" "<call" "</call>"
 code :: DTC -> DTC
@@ -85,8 +87,6 @@ index = Parent "index" "<index" "</index>"
 iref :: DTC -> DTC
 iref (Empty a) = Leaf "iref" "<iref" "/>" a
 iref x = Parent "iref" "<iref" "</iref>" x
-keyword :: DTC -> DTC
-keyword = Parent "keyword" "<keyword" "</keyword>"
 li :: DTC -> DTC
 li = Parent "li" "<li" "</li>"
 link :: DTC -> DTC
@@ -99,6 +99,8 @@ ol :: DTC -> DTC
 ol = Parent "ol" "<ol" "</ol>"
 organization :: DTC -> DTC
 organization = Parent "organization" "<organization" "</organization>"
+p :: DTC -> DTC
+p = Parent "p" "<p" "</p>"
 para :: DTC -> DTC
 para = Parent "para" "<para" "</para>"
 q :: DTC -> DTC
@@ -123,6 +125,8 @@ sub :: DTC -> DTC
 sub = Parent "sub" "<sub" "</sub>"
 sup :: DTC -> DTC
 sup = Parent "sup" "<sup" "</sup>"
+tag :: DTC -> DTC
+tag = Parent "tag" "<tag" "</tag>"
 title :: DTC -> DTC
 title = Parent "title" "<title" "</title>"
 toc :: DTC
@@ -136,27 +140,17 @@ ul = Parent "ul" "<ul" "</ul>"
 version :: DTC -> DTC
 version = Parent "version" "<version" "</version>"
 
-indentTag :: Text -> IndentTag
-indentTag t =
-       case t of
-        "about"      -> IndentTagChildren
-        "address"    -> IndentTagChildren
-        "author"     -> IndentTagChildren
-        "document"   -> IndentTagChildren
-        "editor"     -> IndentTagChildren
-        "figure"     -> IndentTagChildren
-        "ol"         -> IndentTagChildren
-        "postal"     -> IndentTagChildren
-        "reference"  -> IndentTagChildren
-        "rl"         -> IndentTagChildren
-        "section"    -> IndentTagChildren
-        "ul"         -> IndentTagChildren
-        "a"          -> IndentTagText
-        "b"          -> IndentTagText
-        "i"          -> IndentTagText
-        "li"         -> IndentTagText
-        "para"       -> IndentTagText
-        "q"          -> IndentTagText
-        "quote"      -> IndentTagText
-        "note"       -> IndentTagText
-        _            -> IndentTagPreserve
+isInlinedElement :: Text -> Bool
+isInlinedElement = \case
+ "a"    -> True
+ "b"    -> True
+ "br"   -> True
+ "code" -> True
+ "em"   -> True
+ "i"    -> True
+ "note" -> True
+ "q"    -> True
+ "u"    -> True
+ "sup"  -> True
+ "sub"  -> True
+ _      -> False