panda 2008.9.19 → 2008.9.19.1
raw patch · 7 files changed
+41/−17 lines, 7 files
Files
- Panda/Config/Global.hs +9/−2
- Panda/Controller/Application.hs +4/−4
- Panda/Helper/Helper.hs +3/−3
- Panda/Model/Comment.hs +2/−2
- Panda/View/Theme/BluePrint/Template/Sidebar.hs +10/−5
- changelog.markdown +12/−0
- panda.cabal +1/−1
Panda/Config/Global.hs view
@@ -3,6 +3,7 @@ import Panda.Helper.Env import Prelude hiding ((.), (/), (^), id, readFile) import Panda.Type.Reader+import Panda.Type.Sidebar db_id = "db" flat_id = "."@@ -10,11 +11,13 @@ config_id = "config" tag_id = "tag" comment_id = "comment"+sidebar_id = "sidebar" db_uri = db_id flat_uri = db_uri / flat_id config_uri = flat_uri / config_id / "site.txt"+sidebar_uri = flat_uri / config_id / sidebar_id blog_uri = flat_uri / blog_id tag_uri = flat_uri / tag_id comment_uri = flat_uri / comment_id@@ -25,17 +28,21 @@ user_config = readFile config_uri .purify .filter_comment .lines .map strip .map (split "\\s*=\\s*") .map tuple2 config_for' s d = user_config.lookup s .fromMaybe d- config_for s = config_for' s s +parse_config s = s.split "," .map strip .reject null+ blog_title = config_for "blog_title" blog_subtitle = config_for "blog_subtitle" host_name = config_for "host_name" author_email = config_for "author_email" per_page = config_for' "per_page" "7" .read :: Int-navigation = config_for' "navigation" "About" .split "," .map strip .reject null .("Home" :)+navigation = config_for' "navigation" "About" .parse_config.("Home" :) panda_url = "http://github.com/nfjinjing/panda" default_reader = Markdown++sidebar = config_for "sidebar" .parse_config .map (sidebar_uri /).select (to_utf8 >>> doesFileExist >>> purify )+ .map (read_sidebar_item default_reader >>> purify)
Panda/Controller/Application.hs view
@@ -3,7 +3,7 @@ -- views are pure functions. -- a note on encoding:--- IO are in utf-8 filter, internally use unicode bytes+-- IO are in utf-8 filter, internally use bytes {-# OPTIONS -fno-monomorphism-restriction #-} @@ -124,9 +124,9 @@ comment_create = do- post_id <- input_with_default "post_id" "blog/nothing"- exists <- (G.flat_uri / post_id) .doesFileExist .liftIO- let valid_path = equalFilePath "blog" (takeDirectory post_id)+ post_id <- input_with_default "post_id" (G.blog_id / "nothing")+ exists <- (G.flat_uri / post_id.to_utf8) .doesFileExist .liftIO+ let valid_path = equalFilePath G.blog_id (takeDirectory post_id) checked <- check_create if [checked, valid_path, exists].and
Panda/Helper/Helper.hs view
@@ -37,15 +37,15 @@ where remove_trailing_slash s = if s.last.is '/' then s.init else s params = do- query_string <- requestURI <.> uriQuery + query_string <- requestURI ^ uriQuery case query_string of '?':s -> s.formDecode .map_snd unescape_unicode_xml.return otherwise -> return [] inputs = getInputs ^ map_snd (strip >>> unescape_unicode_xml) -param_with_default s d = params <.> (lookup s >>> fromMaybe d )-input_with_default s d = inputs <.> (lookup s >>> fromMaybe d )+param_with_default s d = params ^ (lookup s >>> fromMaybe d )+input_with_default s d = inputs ^ (lookup s >>> fromMaybe d ) get_param s = params ^ lookup s get_input s = inputs ^ lookup s
Panda/Model/Comment.hs view
@@ -40,10 +40,10 @@ let author = at "author" let url = at "url" let body = at "comment"- let post_id = at "post_id" .to_utf8+ let post_id = at "post_id" timestamp <- ( getClockTime >>= toCalendarTime ) ^ format_date- let comment_path = G.flat_uri / G.comment_id / (post_id.split "/".last) + let comment_path = G.flat_uri / G.comment_id / (post_id.split "/".last.to_utf8) createDirectoryIfMissing True comment_path let uid = comment_path / timestamp
Panda/View/Theme/BluePrint/Template/Sidebar.hs view
@@ -5,16 +5,21 @@ import qualified Panda.Type.State as State import qualified Data.Set as Set+import qualified Panda.Config.Global as G+import qualified Panda.Type.Sidebar as Sidebar -- model import Panda.Model.Tag as Tag html_sidebar state = - div_class_id "column span-3 last" "sidebar" << unordList- [ feed state- , hr- , tag_list $ state.State.tags- ]+ div_class_id "column span-3 last" "sidebar" << unordList formatted_list+ where+ stock_list = + [ feed state+ , tag_list $ state.State.tags+ ] + custom_list = G.sidebar.map (\x -> h2 << x.Sidebar.name +++ x.Sidebar.markup)+ formatted_list = (stock_list ++ custom_list) .intersperse hr feed state = toHtml [ h2 << "Subscribe"
changelog.markdown view
@@ -1,3 +1,15 @@+2008.9.19.1+------------++### Features++* Customizable sidebar++### Fix++* Leave comment in utf-8 posts++ 2008.9.19 ----------
panda.cabal view
@@ -1,5 +1,5 @@ Name: panda-Version: 2008.9.19+Version: 2008.9.19.1 Build-type: Simple Synopsis: Simple Static Blog Engine Description: Simple Static Blog Engine