bamboo-theme-mini-html5 2009.11.3 → 2009.11.7
raw patch · 11 files changed
+34/−156 lines, 11 filesdep +yuuko
Dependencies added: yuuko
Files
- bamboo-theme-mini-html5.cabal +2/−1
- changelog.md +3/−16
- readme.md +1/−1
- src/Bamboo/Theme/MiniHTML5.hs +3/−2
- src/Bamboo/Theme/MiniHTML5/Atom/Post.hs +1/−1
- src/Bamboo/Theme/MiniHTML5/Control/Static.hs +1/−1
- src/Bamboo/Theme/MiniHTML5/Env.hs +0/−1
- src/Bamboo/Theme/MiniHTML5/Helper.hs +12/−129
- src/Bamboo/Theme/MiniHTML5/Widget/Helper.hs +1/−1
- src/Bamboo/Theme/MiniHTML5/Widget/Sidebar.hs +1/−1
- src/Bamboo/Theme/MiniHTML5/Widget/Template.hs +9/−2
bamboo-theme-mini-html5.cabal view
@@ -1,5 +1,5 @@ Name: bamboo-theme-mini-html5-Version: 2009.11.3+Version: 2009.11.7 Build-type: Simple Synopsis: bamboo mini html5 theme Description: bamboo mini html5 theme@@ -45,6 +45,7 @@ , hack-contrib >= 2009.11.1 , bamboo >= 2009.11.1 , moe >= 2009.11.3+ , yuuko >= 2009.10.23.2 hs-source-dirs: src/ exposed-modules: Bamboo.Theme.MiniHTML5
changelog.md view
@@ -1,20 +1,7 @@-2009.6.25+2009.11.7 --------- -### Fix--* compatible with mps 6.25--2009.6.9---------- ### Feature -* respect script_name--2009.6.8-----------### Feature--* Init+* add html5 js for IE+* add google canvas meta header
readme.md view
@@ -1,1 +1,1 @@-bamboo blueprint theme+bamboo html5 theme
src/Bamboo/Theme/MiniHTML5.hs view
@@ -14,12 +14,13 @@ theme :: Theme theme x' y = theme' x' y .return where- theme' Index x = PostV.list x- theme' IndexFeed x = RSSV.rss x "" "" .render_rss .rss_response+ theme' Index x = PostV.list x theme' Search x = SearchV.view x theme' Static x = StaticV.view x theme' Post x = PostV.view x theme' Tag x = TagV.view x++ theme' IndexFeed x = RSSV.rss x "" "" .render_rss .rss_response theme' TagFeed x = RSSV.rss x (x.config.tag_id) (x.S.tag_name) .render_rss .rss_response
src/Bamboo/Theme/MiniHTML5/Atom/Post.hs view
@@ -30,7 +30,7 @@ a [href - x.uri / "#comments"] - str - x.comment_size.show ++ " Comments" -} - raw - show_content style .show_html+ show_content style .show_html where show_content Summary = x.markup_summary
src/Bamboo/Theme/MiniHTML5/Control/Static.hs view
@@ -8,4 +8,4 @@ view :: R view s = page s -- article' - raw - s.static.markup.show_html+ article' - s.static.markup.show_html
src/Bamboo/Theme/MiniHTML5/Env.hs view
@@ -11,7 +11,6 @@ , module Control.Monad ) where --- import Bamboo.Env hiding (navigation, sidebar, footer, toHtml, Html, id) import MPS.Env hiding (id, span, div, head) import Bamboo.Type.State (config, nav_location, State, env) import Bamboo.Type hiding (footer)
src/Bamboo/Theme/MiniHTML5/Helper.hs view
@@ -13,9 +13,11 @@ import MPS (u2b) import Data.ByteString.Lazy.Char8 (ByteString) import Data.ByteString.Lazy.UTF8 (fromString)-import Text.XHtml.Strict (showHtmlFragment, HTML)+import Text.XHtml.Strict (renderHtmlFragment, showHtmlFragment, HTML) import qualified Text.HTML.Moe as M-import Text.HTML.Moe.Type (Attribute)+import Text.HTML.Moe.Type (Attribute, MoeUnit)+import Text.HTML.Yuuko+import Text.HTML.Moe (prim, raw) slashed_script_name :: Env -> String slashed_script_name = script_name > ("/" /)@@ -27,7 +29,7 @@ xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" home_nav :: String-home_nav = "Home"+home_nav = "Home" href :: String -> Attribute href = u2b > escape_uri > M.href@@ -47,129 +49,10 @@ html_response > set_content_type "application/rss+xml" -show_html :: (HTML a) => a -> String-show_html = showHtmlFragment > unescape_xml----{--import Bamboo.Env-import qualified Data.ByteString.Char8 as B-import Data.ByteString.UTF8 (fromString)-import Data.ByteString.Lazy (fromChunks)-import Data.Default-import Hack.Contrib.Constants-import Hack.Contrib.Response-import Text.XHtml.Strict hiding (p, meta, body)-import qualified Prelude as P-import qualified Text.XHtml.Strict as Html-import MPS.Heavy (unescape_xml)---id :: String -> HtmlAttr-id = identifier--css_link :: String -> Html-js_link :: String -> Html-js_src :: String -> Html-rss_link :: String -> Html-favicon_link :: String -> Html--css_link l = itag "link" ! [rel "stylesheet", thetype "text/css", href l]-js_link l = itag "script" ! [thetype "text/javascript", src l]-js_src s = tag "script" ! [thetype "text/javascript"] << s-favicon_link l = itag "link" ! [rel "icon", thetype "image/png", href l]--rss_link l = itag "link" ! - [rel "alternate", thetype "application/rss+xml", href l, title "RSS 2.0"]--div_id :: String -> Html -> Html -div_id s = thediv ! [id s]--div_class :: String -> Html -> Html-div_class s = thediv ! [theclass s]--div_class_id :: String -> String -> Html -> Html-div_class_id x y = thediv ! [theclass x, id y]--meta_tag :: Html-meta_tag = Html.meta ! - [httpequiv "Content-Type", content "text/html; charset=utf-8"]--ie_tag :: (Show a) => a -> Html-ie6_tag :: (Show a) => a -> Html-ie7_tag :: (Show a) => a -> Html--ie_tag x = ("<!--[if IE]>" ++ x.show ++ "<![endif]-->").primHtml-ie6_tag x = ("<!--[if lt IE 7]>" ++ x.show ++ "<![endif]-->").primHtml-ie7_tag x = ("<!--[if IE 7]>" ++ x.show ++ "<![endif]-->").primHtml---xml_header :: String-xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"--doc_type :: String-doc_type = "<!doctype html>"--render_html :: Html -> B.ByteString-render_html = renderHtml > unescape_xml > fromString--output_html :: Html -> IO Response-output_html = render_html > output_plain_html--render_rss :: String -> B.ByteString-render_rss = (xml_header ++) > fromString--output_plain_html :: B.ByteString -> IO Response-output_plain_html x = - def - .set_status 200- .set_body utf8- .set_content_type _TextHtmlUTF8- .return- where- utf8 = [x].fromChunks--output_plain_rss :: B.ByteString -> IO Response-output_plain_rss = output_plain_html- > (^ set_content_type "application/rss+xml")- --html_if :: Bool -> Html -> Html-html_if b x = if b then x else empty_html---- html alias--img :: Html-space_html :: Html--img = image-space_html = primHtml " "---span :: Html -> Html-div :: Html -> Html-d :: Html -> Html-ul :: Html -> Html--span = thespan-div = thediv-d = div-ul = ulist---klass :: String -> HtmlAttr-klass = theclass--c, i:: String -> Html -> Html-c x = d ! [klass x]-i x = d ! [id x]--ic, ci:: String -> String -> Html -> Html-ic x y = d ! [id x, klass y]-ci x y = ic y x--link :: String -> Html -> HotLink-link = hotlink---}+show_html :: (HTML a) => a -> MoeUnit +show_html x = + let r = x.showHtmlFragment+ in+ if r.yuuko "//pre".null+ then x.renderHtmlFragment.unescape_xml.prim+ else r.unescape_xml.raw
src/Bamboo/Theme/MiniHTML5/Widget/Helper.hs view
@@ -19,7 +19,7 @@ uid = State.uid s tagged = uid.match "^tag/.+" .isJust url r = s.env.slashed_script_name / r / "rss.xml"- link r x = (url r, a [href r, _class "feed"] - div [_class "feedlink"] - str x)+ link r x = (url r, a [href - url r, _class "feed"] - div [_class "feedlink"] - str x) tag_link :: State -> String -> MoeUnit tag_link s x = a [href - s.env.slashed_script_name / s.config.tag_id / x ] - str x
src/Bamboo/Theme/MiniHTML5/Widget/Sidebar.hs view
@@ -33,7 +33,7 @@ section' - do header' - str - x.Sidebar.name- raw - x.markup.show_html+ x.markup.show_html tag_link' x = li' - do a [href - s.env.slashed_script_name / x.Tag.uid] - str - x.Tag.name
src/Bamboo/Theme/MiniHTML5/Widget/Template.hs view
@@ -10,6 +10,7 @@ import Data.ByteString.Lazy.Char8 (fromChunks) import Bamboo.Theme.MiniHTML5.Widget.Navigation import Bamboo.Theme.MiniHTML5.Widget.Sidebar+import Bamboo.Theme.MiniHTML5.Widget.Helper import qualified Bamboo.Type.Config as C import qualified Bamboo.Type.State as S import qualified Bamboo.Type.Theme as T@@ -33,13 +34,19 @@ page_title = s.config.blog_title ++ s.S.resource_title.apply_if (null > not) (" / " ++) meta [charset "utf-8"]+ + -- google chrome frame for ie+ meta [http_equiv "X-UA-Compatible", content "chrome=1"] title' - str - page_title link [rel "icon", _type "image/png", href - root - s.config.favicon]- -- link [rel "alternate", _type "application/rss+xml", href - rss_url_link_pair s .fst, title' "RSS 2.0"]+ link [rel "alternate", _type "application/rss+xml", href - rss_url_link_pair s .fst, attr "title" "RSS 2.0"] s.config.theme_config.T.css.mapM_ (root > css) s.config.theme_config.T.js.mapM_(root > js)+ + -- html5 enabler for ie+ prim "<!--[if IE]><script src=\"http://html5shiv.googlecode.com/svn/trunk/html5.js\"></script><![endif]-->" body' - do header [role "banner"] - do@@ -61,7 +68,7 @@ footer' - do case s.config.C.footer of - Just y -> raw - y.markup.show_html+ Just y -> y.markup.show_html Nothing -> do str - "©2009 " ++ s.config.blog_title br'