tdoc 0.4.2 → 0.4.3
raw patch · 3 files changed
+13/−4 lines, 3 files
Files
- Text/TDoc/Attributes.hs +6/−1
- Text/TDoc/XHtml.hs +6/−2
- tdoc.cabal +1/−1
Text/TDoc/Attributes.hs view
@@ -40,9 +40,10 @@ newtype Style = Style { fromStyle :: String } -- put something more typeful newtype Identifier = Identifier { fromIdentifier :: String } newtype Href = Href { fromHref :: String }+newtype TitleAttr = TitleAttr { fromTitleAttr :: String } $(attributes [''Width, ''Height, ''Src, ''Size, ''Alt, ''ClassAttr, ''Name- ,''Rows, ''Cols, ''Style, ''Identifier, ''Href])+ ,''Rows, ''Cols, ''Style, ''Identifier, ''Href, ''TitleAttr]) -- Common attributes instance IsNode a => IsAttributeOf ClassAttr a@@ -85,6 +86,9 @@ href :: (HrefTag t, Href `IsAttributeOf` a) => String -> AttributeOf t a href = TAttr hrefTag . Href +titleAttr :: (TitleAttrTag t, TitleAttr `IsAttributeOf` a) => String -> AttributeOf t a+titleAttr = TAttr titleAttrTag . TitleAttr+ class (WidthTag t ,HeightTag t ,SrcTag t@@ -97,4 +101,5 @@ ,ColsTag t ,IdentifierTag t ,HrefTag t+ ,TitleAttrTag t ) => AttributeTags t
Text/TDoc/XHtml.hs view
@@ -74,6 +74,7 @@ SizeTag :: HtmlTag Size RowsTag :: HtmlTag Rows ColsTag :: HtmlTag Cols+ TitleAttrTag :: HtmlTag TitleAttr instance LeafTags HtmlTag where charTag = RawHtmlTag . toHtml@@ -94,7 +95,7 @@ ,''UList, ''Item, ''Paragraph ,''Title, ''Image, ''Br, ''Hr, ''Table ,''Row, ''Col, ''HCol, ''Section, ''Subsection- ,''Div, ''HLink, ''Identifier, ''Href+ ,''Div, ''HLink, ''Identifier, ''Href, ''TitleAttr ]) instance FormAttributeTags HtmlTag@@ -161,6 +162,7 @@ f SizeTag = error "impossible" f RowsTag = error "impossible" f ColsTag = error "impossible"+ f TitleAttrTag = error "impossible" heading :: (a `IsChildOf` Span) => (Html -> Html) -> HtmlDoc a -> Html heading hN child = hN {-X.! map (commonAttr attrs-} X.<< child X.+++ children@@ -187,7 +189,9 @@ commonAttrs = map . commonAttr hlinkAttr :: HtmlAttributeOf HLink -> HtmlAttr- hlinkAttr = undefined+ hlinkAttr (TAttr NameTag (Name n)) = X.name n+ hlinkAttr (TAttr TitleAttrTag (TitleAttr t)) = X.title t+ hlinkAttr attr = commonAttr "hlink" attr inputAttr :: HtmlAttributeOf Input -> HtmlAttr inputAttr (TAttr InputTypeTag it) = X.thetype . show $ it
tdoc.cabal view
@@ -1,6 +1,6 @@ name: tdoc cabal-Version: >=1.2-version: 0.4.2+version: 0.4.3 license: BSD3 license-file: LICENSE copyright: (c) Nicolas Pouillard