moe 2013.6.22 → 2014.4.14
raw patch · 3 files changed
+26/−18 lines, 3 filesdep +textdep −utf8-string
Dependencies added: text
Dependencies removed: utf8-string
Files
moe.cabal view
@@ -1,5 +1,5 @@ Name: moe-Version: 2013.6.22+Version: 2014.4.14 Build-type: Simple Synopsis: html with style Description:@@ -27,13 +27,13 @@ , air >= 2013.6.22 , data-default , bytestring- , utf8-string , dlist- + , text+ hs-source-dirs: src/- - exposed-modules: - Text.HTML.Moe2 ++ exposed-modules:+ Text.HTML.Moe2 Text.HTML.Moe2.Attribute Text.HTML.Moe2.Element Text.HTML.Moe2.DSL.Markdown@@ -44,8 +44,8 @@ Text.HTML.Moe2.Type Text.HTML.Moe2.Utils- + Text.HTML.Moe2.Backend.ByteString - - ++
src/Text/HTML/Moe2/Backend/ByteString.hs view
@@ -1,15 +1,18 @@ module Text.HTML.Moe2.Backend.ByteString where import qualified Data.ByteString.Char8 as B-import Data.ByteString.UTF8 (fromString, toString)+import Data.Text.Encoding (decodeUtf8, encodeUtf8)+import qualified Data.Text as T+import Air.Env+import Prelude () type Internal = B.ByteString pack :: String -> Internal-pack = fromString+pack = T.pack > encodeUtf8 unpack :: Internal -> String-unpack = toString+unpack = decodeUtf8 > T.unpack none :: Internal none = B.empty
src/Text/HTML/Moe2/Element.hs view
@@ -10,7 +10,7 @@ import Data.Maybe (fromMaybe) element :: String -> MoeCombinator-element x u = tell - singleton - +element x u = tell - singleton - def { name = pack - escape x@@ -23,10 +23,10 @@ infixl 1 ! add_attributes :: (MoeUnit -> MoeUnit) -> [Attribute] -> (MoeUnit -> MoeUnit)-add_attributes f xs = \u -> +add_attributes f xs = \u -> let r = f u in- + tell - singleton - Attributes xs - fromMaybe def - first - toList - execWriter - r @@ -48,7 +48,7 @@ ne = no_indent_element self_close_element :: String -> LightCombinator-self_close_element x _ = tell - singleton - +self_close_element x _ = tell - singleton - def { name = pack - escape x@@ -59,12 +59,17 @@ sc = self_close_element -str, raw, _pre, prim :: String -> MoeUnit-no_escape_no_indent_str, escape_no_indent_str, no_escape_indent_str :: String -> MoeUnit++no_escape_no_indent_str :: String -> MoeUnit no_escape_no_indent_str = raw++escape_no_indent_str :: String -> MoeUnit escape_no_indent_str = _pre++no_escape_indent_str :: String -> MoeUnit no_escape_indent_str = prim +str, raw, _pre, prim :: String -> MoeUnit str x = tell - singleton - Data (pack - escape x) raw x = tell - singleton - Raw (pack x) _pre x = tell - singleton - Pre (pack - escape x)