packages feed

moe 2009.8.26 → 2009.8.28

raw patch · 6 files changed

+131/−9 lines, 6 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Text.HTML.Moe.DSL.Kawaii: c :: String -> MoeUnit -> MoeUnit
+ Text.HTML.Moe.DSL.Kawaii: css :: String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: (!) :: String -> String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: (###) :: String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: (##) :: String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: (#) :: String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: (*) :: String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: (***) :: MoeUnit
+ Text.HTML.Moe.DSL.Markdown: (<>) :: String -> String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: (>>) :: String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: block :: String -> MoeUnit
+ Text.HTML.Moe.DSL.Markdown: o :: String -> MoeUnit
+ Text.HTML.Moe.Element: _pre :: String -> MoeUnit
+ Text.HTML.Moe.Element: blockquote :: MoeCombinator
+ Text.HTML.Moe.Element: blockquote' :: MoeCombinator'
+ Text.HTML.Moe.Element: code :: MoeCombinator
+ Text.HTML.Moe.Element: code' :: MoeCombinator'
+ Text.HTML.Moe.Element: em :: MoeCombinator
+ Text.HTML.Moe.Element: em' :: MoeCombinator'
+ Text.HTML.Moe.Element: h4 :: MoeCombinator
+ Text.HTML.Moe.Element: h4' :: MoeCombinator'
+ Text.HTML.Moe.Element: h5 :: MoeCombinator
+ Text.HTML.Moe.Element: h5' :: MoeCombinator'
+ Text.HTML.Moe.Element: h6 :: MoeCombinator
+ Text.HTML.Moe.Element: h6' :: MoeCombinator'
+ Text.HTML.Moe.Element: hr :: MoeCombinator
+ Text.HTML.Moe.Element: hr' :: MoeCombinator'
+ Text.HTML.Moe.Element: ne :: String -> MoeCombinator
+ Text.HTML.Moe.Element: no_indent_element :: String -> MoeCombinator
+ Text.HTML.Moe.Element: strong :: MoeCombinator
+ Text.HTML.Moe.Element: strong' :: MoeCombinator'
+ Text.HTML.Moe.Element: textarea :: MoeCombinator
+ Text.HTML.Moe.Element: textarea' :: MoeCombinator'
+ Text.HTML.Moe.Type: Pre :: String -> Element
+ Text.HTML.Moe.Type: indent :: Element -> Bool
- Text.HTML.Moe.Type: Element :: String -> [Attribute] -> [Element] -> Element
+ Text.HTML.Moe.Type: Element :: String -> [Attribute] -> [Element] -> Bool -> Element

Files

moe.cabal view
@@ -1,5 +1,5 @@ Name:                 moe-Version:              2009.8.26+Version:              2009.8.28 Build-type:           Simple Synopsis:             html with style Description:@@ -24,4 +24,6 @@                       Text.HTML.Moe                          Text.HTML.Moe.Attribute                       Text.HTML.Moe.Element+                      Text.HTML.Moe.DSL.Markdown+                      Text.HTML.Moe.DSL.Kawaii                       Text.HTML.Moe.Type
src/Text/HTML/Moe.hs view
@@ -29,13 +29,15 @@ render_element' :: Int -> Element -> String render_element' _ (Raw x)   = x +render_element' _ (Pre x)   = escape x+ render_element' n (Data x)  = execWriter - do   tell - (n * indent_space).times ' '   tell - escape - x   tell - "\n"    render_element' n x = execWriter - do-  tell - indent+  tell - _indent   tell - "<" ++ x.T.name ++ ""   tell - x.attributes.map render_attribute. join_attribute   tell - ">"@@ -43,13 +45,15 @@      tell - x.elements.map (render_element' (n+1)) .concat   -  tell - indent+  tell - _indent   tell - "</" ++ x.T.name ++ ">"   tell - "\n"      where     join_attribute xs = xs.map (" " ++) .concat-    indent = (n * indent_space).times ' '+    _indent+      | x.indent = (n * indent_space).times ' '+      | otherwise = ""   render_element :: Element -> String
+ src/Text/HTML/Moe/DSL/Kawaii.hs view
@@ -0,0 +1,12 @@+module Text.HTML.Moe.DSL.Kawaii where+++import Text.HTML.Moe+import Text.HTML.Moe.Type (MoeUnit)+import Prelude hiding ((-), (/), div)++c :: String -> MoeUnit -> MoeUnit+c x = div [_class x]++css :: String -> MoeUnit+css x = link [rel "stylesheet", _type "text/css", href x] (/)
+ src/Text/HTML/Moe/DSL/Markdown.hs view
@@ -0,0 +1,52 @@+module Text.HTML.Moe.DSL.Markdown +(+  (#)  +, (##) +, (###)+, (>>) +, (*)  +, (***)+-- , _  +-- , __ +, (!)+, (<>)+, o+, block+) where+++import Text.HTML.Moe+import Text.HTML.Moe.Type (MoeUnit)+import MPS.Light ((-))+import Prelude hiding ((-), (/), (>>), (*))++single_line, r :: (MoeUnit -> MoeUnit) -> String -> MoeUnit+single_line f = f . str+r = single_line++(#)       :: String -> MoeUnit  +(##)      :: String -> MoeUnit  +(###)     :: String -> MoeUnit  +(>>)      :: String -> MoeUnit  +(*)       :: String -> MoeUnit  +-- _         :: String -> MoeUnit  +-- __        :: String -> MoeUnit  +o         :: String -> MoeUnit  +block     :: String -> MoeUnit  +(***)     :: MoeUnit +(!)       :: String -> String -> MoeUnit +(<>)      :: String -> String -> MoeUnit +++(#)       = r h1'+(##)      = r h2'+(###)     = r h3'+(>>)      = r blockquote'+(*)       = r ul'+-- _         = r em'+-- __        = r strong'+o         = r li'+block     = pre' . code' . str+(***)     = hr' (/)+(!) x y   = img [src y, alt x] (/)+(<>) x y  = a [href y] - str x
src/Text/HTML/Moe/Element.hs view
@@ -21,19 +21,40 @@ e :: String -> MoeCombinator e = element' +no_indent_element :: String -> MoeCombinator+no_indent_element x xs u = tell [+  def+    {+      name = x+    , attributes = xs+    , elements =  execWriter u+    , indent = False+    }+  ]++ne :: String -> MoeCombinator+ne = no_indent_element+ a         :: MoeCombinator body      :: MoeCombinator br        :: MoeCombinator+blockquote  :: MoeCombinator+code      :: MoeCombinator colgroup  :: MoeCombinator col       :: MoeCombinator div       :: MoeCombinator form      :: MoeCombinator embed     :: MoeCombinator+em        :: MoeCombinator h1        :: MoeCombinator h2        :: MoeCombinator h3        :: MoeCombinator+h4        :: MoeCombinator+h5        :: MoeCombinator+h6        :: MoeCombinator head      :: MoeCombinator html      :: MoeCombinator+hr        :: MoeCombinator img       :: MoeCombinator input     :: MoeCombinator label     :: MoeCombinator@@ -54,7 +75,9 @@ script    :: MoeCombinator span      :: MoeCombinator style     :: MoeCombinator+strong    :: MoeCombinator table     :: MoeCombinator+textarea  :: MoeCombinator td        :: MoeCombinator th        :: MoeCombinator title     :: MoeCombinator@@ -63,16 +86,23 @@ a'          ::  MoeCombinator' body'       ::  MoeCombinator' br'         ::  MoeCombinator'+blockquote' ::  MoeCombinator'+code'       ::  MoeCombinator' colgroup'   ::  MoeCombinator' col'        ::  MoeCombinator' div'        ::  MoeCombinator' embed'      ::  MoeCombinator'+em'         ::  MoeCombinator' form'       ::  MoeCombinator' h1'         ::  MoeCombinator' h2'         ::  MoeCombinator' h3'         ::  MoeCombinator'+h4'         ::  MoeCombinator'+h5'         ::  MoeCombinator'+h6'         ::  MoeCombinator' head'       ::  MoeCombinator' html'       ::  MoeCombinator'+hr'         ::  MoeCombinator' img'        ::  MoeCombinator' input'      ::  MoeCombinator' label'      ::  MoeCombinator'@@ -93,7 +123,9 @@ script'     ::  MoeCombinator' span'       ::  MoeCombinator' style'      ::  MoeCombinator'+strong'     ::  MoeCombinator' table'      ::  MoeCombinator'+textarea'   ::  MoeCombinator' td'         ::  MoeCombinator' th'         ::  MoeCombinator' title'      ::  MoeCombinator'@@ -103,16 +135,23 @@ a          = e "a" body       = e "body" br         = e "br"+blockquote  = e "blockquote"+code       = e "code" colgroup   = e "colgroup" col        = e "col" div        = e "div" embed      = e "embed"+em         = e "em" form       = e "form" h1         = e "h1" h2         = e "h2" h3         = e "h3"+h4         = e "h4"+h5         = e "h5"+h6         = e "h6" head       = e "head" html       = e "html"+hr         = e "hr" img        = e "img" input      = e "input" label      = e "label"@@ -133,7 +172,9 @@ script     = e "script" span       = e "span" style      = e "style"+strong     = e "strong" table      = e "table"+textarea   = ne "textarea" td         = e "td" th         = e "th" title      = e "title"@@ -146,15 +187,22 @@ a'         = a          [] body'      = body       [] br'        = br         []+blockquote' = blockquote  []+code'      = code       [] colgroup'  = colgroup   [] col'       = col        [] div'       = div        [] embed'     = embed      []+em'        = em         [] form'      = form       [] h1'        = h1         [] h2'        = h2         [] h3'        = h3         []+h4'        = h4         []+h5'        = h5         []+h6'        = h6         [] head'      = head       []+hr'        = hr         [] html'      = html       [] img'       = img        [] input'     = input      []@@ -176,14 +224,16 @@ script'    = script     [] span'      = span       [] style'     = style      []+strong'    = strong     [] table'     = table      []+textarea'  = textarea   [] td'        = td         [] th'        = th         [] title'     = title      [] tr'        = tr         [] -str :: String -> MoeUnit-raw :: String -> MoeUnit+str, raw, _pre :: String -> MoeUnit  str x   = tell [Data x] raw x   = tell [Raw  x]+_pre x  = tell [Pre  x]
src/Text/HTML/Moe/Type.hs view
@@ -9,13 +9,15 @@         name :: String       , attributes :: [Attribute]       , elements :: [Element]+      , indent :: Bool       }-  | Raw String-  | Data String+  | Raw String  -- for preformatted html strings, no escape+  | Pre String  -- for space sensitive tags, textarea/pre+  | Data String -- normal string, auto escaped   deriving (Show)  instance Default Element where-  def = Element def def def+  def = Element def def def True  data Attribute = Attribute   {