packages feed

html-minimalist (empty) → 0.1

raw patch · 7 files changed

+326/−0 lines, 7 filesdep +basedep +xmlsetup-changed

Dependencies added: base, xml

Files

+ README view
@@ -0,0 +1,12 @@+html-minimalist - minimalist haskell html library++Text.HTML.Light is a very simple Haskell module +for writing [x]html documents.  It provides +constructors for html elements and attributes+in terms of Text.XML.Light.++  http://slavepianos.org/rd/+  http://haskell.org/++(c) rohan drape, 2006-2009+    gpl, http://gnu.org/copyleft/
+ Setup.lhs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+> import Distribution.Simple+> main = defaultMain
+ Text/HTML/Light.hs view
@@ -0,0 +1,24 @@+-- | Provides xhtml constructors for 'Text.XML.Light'.+module Text.HTML.Light ( module Text.HTML.Light+                       , module Text.HTML.Light.Attribute+                       , module Text.HTML.Light.Constant+                       , module Text.HTML.Light.Element ) where++import Text.XML.Light+import Text.HTML.Light.Attribute+import Text.HTML.Light.Constant+import Text.HTML.Light.Element++-- | Ordinary character data, subject to escaping.+cdata :: String -> Content+cdata s = Text (CData CDataText s Nothing)++-- | Raw character data, not subject to escaping.+cdata_raw :: String -> Content+cdata_raw s = Text (CData CDataRaw s Nothing)++-- | Render an xhtml element with the given document type.+renderXHTML :: DocType -> Element -> String+renderXHTML t e = concat [ xml_1_0+                         , t+                         , showElement e ]
+ Text/HTML/Light/Attribute.hs view
@@ -0,0 +1,107 @@+-- | XHTML attribute constructors.  Where an attribute name conflicts+--   with a haskell keyword the attribute name is written with a prime+--   suffix, ie. class'.  Where an attribute name conflicts with an+--   element name the attribute name is written likewise.+module Text.HTML.Light.Attribute where++import Text.XML.Light++align :: String -> Attr+align = Attr (unqual "align")++alt :: String -> Attr+alt = Attr (unqual "alt")++bgcolor :: String -> Attr+bgcolor = Attr (unqual "bgcolor")++border :: String -> Attr+border = Attr (unqual "border")++-- | 'class' is a reserved word.+class' :: String -> Attr+class' = Attr (unqual "class")++classid :: String -> Attr+classid = Attr (unqual "classid")++colspan :: String -> Attr+colspan = Attr (unqual "colspan")++content :: String -> Attr+content = Attr (unqual "content")++-- | 'data' is a reserved word.+data' :: String -> Attr+data' = Attr (unqual "data")++height :: String -> Attr+height = Attr (unqual "height")++href :: String -> Attr+href = Attr (unqual "href")++id :: String -> Attr+id = Attr (unqual "id")++http_equiv :: String -> Attr+http_equiv = Attr (unqual "http-equiv")++lang :: String -> Attr+lang = Attr (unqual "lang")++language :: String -> Attr+language = Attr (unqual "language")++media :: String -> Attr+media = Attr (unqual "media")++name :: String -> Attr+name = Attr (unqual "name")++quality :: String -> Attr+quality = Attr (unqual "quality")++rel :: String -> Attr+rel = Attr (unqual "rel")++rowspan :: String -> Attr+rowspan = Attr (unqual "rowspan")++-- | 'span' is the name of both an attribute and element.+span' :: String -> Attr+span' = Attr (unqual "span")++src :: String -> Attr+src = Attr (unqual "src")++-- | 'style' is the name of both an attribute and element.+style' :: String -> Attr+style' = Attr (unqual "style")++target :: String -> Attr+target = Attr (unqual "target")++-- | 'title' is the name of both an attribute and element.+title' :: String -> Attr+title' = Attr (unqual "title")++-- | 'type' is a reserved word.+type' :: String -> Attr+type' = Attr (unqual "type")++valign :: String -> Attr+valign = Attr (unqual "valign")++value :: String -> Attr+value = Attr (unqual "value")++width :: String -> Attr+width = Attr (unqual "width")++xml_lang :: String -> Attr+xml_lang = Attr (unqual "xml:lang")++xmlns :: String -> Attr+xmlns = Attr (unqual "xmlns")+
+ Text/HTML/Light/Constant.hs view
@@ -0,0 +1,45 @@+-- | xhtml related constants.+module Text.HTML.Light.Constant where++import Text.XML.Light++-- * Named non-ascii characters++-- | The copyright character.+copy :: Content+copy = Text (CData CDataRaw "&copy;" Nothing)++-- | The left arrow character.+larr :: Content+larr = Text (CData CDataRaw "&larr;" Nothing)++-- | The non-breaking space character.+nbsp :: Content+nbsp = Text (CData CDataRaw "&nbsp;" Nothing)++-- | The right arrow character.+rarr :: Content+rarr = Text (CData CDataRaw "&rarr;" Nothing)++-- * Version and document type strings++-- | The xml version 1.0 string with UTF-8 encoding set.+xml_1_0 :: String+xml_1_0 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"++-- | A type synonym for document type strings.+type DocType = String++-- | The xhtml 1.0 strict document type string.+xhtml_1_0_strict :: DocType+xhtml_1_0_strict = +    let dtd = "PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""+        url = "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\""+    in concat ["<!DOCTYPE html ", dtd, " ", url, ">"]++-- | The xhtml 1.0 transitional document type string.+xhtml_1_0_transitional :: DocType+xhtml_1_0_transitional =+    let dtd = "PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""+        url = "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\""+    in concat ["<!DOCTYPE html ", dtd, " ", url, ">"]
+ Text/HTML/Light/Element.hs view
@@ -0,0 +1,107 @@+-- | Element constructors.  The resulting elements are lifted to the+--   Content data type, with the exception of the 'html' element.+module Text.HTML.Light.Element where++import Text.XML.Light++a :: [Attr] -> [Content] -> Content+a z e = Elem (Element (unqual "a") z e Nothing)++body :: [Attr] -> [Content] -> Content+body z e = Elem (Element (unqual "body") z e Nothing)++br :: [Attr] -> Content+br z = Elem (Element (unqual "br") z [] Nothing)++colgroup :: [Attr] -> [Content] -> Content+colgroup z e = Elem (Element (unqual "colgroup") z e Nothing)++col :: [Attr] -> Content+col z = Elem (Element (unqual "col") z [] Nothing)++div :: [Attr] -> [Content] -> Content+div z e = Elem (Element (unqual "div") z e Nothing)++embed :: [Attr] -> Content+embed z = Elem (Element (unqual "embed") z [] Nothing)++h1 :: [Attr] -> [Content] -> Content+h1 z c = Elem (Element (unqual "h1") z c Nothing)++h2 :: [Attr] -> [Content] -> Content+h2 z e = Elem (Element (unqual "h2") z e Nothing)++h3 :: [Attr] -> [Content] -> Content+h3 z e = Elem (Element (unqual "h3") z e Nothing)++h4 :: [Attr] -> [Content] -> Content+h4 z e = Elem (Element (unqual "h4") z e Nothing)++head :: [Attr] -> [Content] -> Content+head z e = Elem (Element (unqual "head") z e Nothing)++html :: [Attr] -> [Content] -> Element+html z e = Element (unqual "html") z e Nothing++img :: [Attr] -> Content+img z = Elem (Element (unqual "img") z [] Nothing)++li :: [Attr] -> [Content] -> Content+li z e = Elem (Element (unqual "li") z e Nothing)++link :: [Attr] -> Content+link z = Elem (Element (unqual "link") z [] Nothing)++meta :: [Attr] -> Content+meta z = Elem (Element (unqual "meta") z [] Nothing)++object :: [Attr] -> [Content] -> Content+object z e = Elem (Element (unqual "object") z e Nothing)++ol :: [Attr] -> [Content] -> Content+ol z e = Elem (Element (unqual "ol") z e Nothing)++param :: [Attr] -> Content+param z = Elem (Element (unqual "param") z [] Nothing)++ul :: [Attr] -> [Content] -> Content+ul z e = Elem (Element (unqual "ul") z e Nothing)++dl :: [Attr] -> [Content] -> Content+dl z e = Elem (Element (unqual "dl") z e Nothing)++dt :: [Attr] -> [Content] -> Content+dt z e = Elem (Element (unqual "dt") z e Nothing)++dd :: [Attr] -> [Content] -> Content+dd z e = Elem (Element (unqual "dd") z e Nothing)++p :: [Attr] -> [Content] -> Content+p z e = Elem (Element (unqual "p") z e Nothing)++pre :: [Attr] -> [Content] -> Content+pre z e = Elem (Element (unqual "pre") z e Nothing)++script :: [Attr] -> [Content] -> Content+script z e = Elem (Element (unqual "script") z e Nothing)++span :: [Attr] -> [Content] -> Content+span z e = Elem (Element (unqual "span") z e Nothing)++style :: [Attr] -> [Content] -> Content+style z e = Elem (Element (unqual "style") z e Nothing)++table :: [Attr] -> [Content] -> Content+table z e = Elem (Element (unqual "table") z e Nothing)++td :: [Attr] -> [Content] -> Content+td z e = Elem (Element (unqual "td") z e Nothing)++th :: [Attr] -> [Content] -> Content+th z e = Elem (Element (unqual "th") z e Nothing)++title :: [Attr] -> [Content] -> Content+title z e = Elem (Element (unqual "title") z e Nothing)++tr :: [Attr] -> [Content] -> Content+tr z e = Elem (Element (unqual "tr") z e Nothing)
+ html-minimalist.cabal view
@@ -0,0 +1,28 @@+Name:              html-minimalist+Version:           0.1+Synopsis:          Minimalist haskell html library+Description:       Text.HTML.Light is a very simple Haskell module +                   for writing [x]html documents.  It provides +                   constructors for html elements and attributes+                   in terms of Text.XML.Light.+License:           GPL+Category:          Text+Copyright:         (c) Rohan Drape, 2006-2009+Author:            Rohan Drape+Maintainer:        rd@slavepianos.org+Stability:         Experimental+Homepage:          http://slavepianos.org/rd/f/592566/+Tested-With:       GHC == 6.8.2+Build-Type:        Simple+Cabal-Version:     >= 1.6++Data-files:        README++Library+  Build-Depends:   base == 3.*,+                   xml+  GHC-Options:     -Wall -fwarn-tabs+  Exposed-modules: Text.HTML.Light+                   Text.HTML.Light.Attribute+                   Text.HTML.Light.Constant+                   Text.HTML.Light.Element