panda 0.0.0.4.1 → 0.0.0.4.2
raw patch · 5 files changed
+37/−29 lines, 5 filesdep −HaXmldep ~rss
Dependencies removed: HaXml
Dependency ranges changed: rss
Files
- Panda/Config/Global.hs +9/−9
- Panda/Helper/Escape.hs +19/−16
- Panda/Model/Post.hs +1/−1
- changelog.markdown +6/−1
- panda.cabal +2/−2
Panda/Config/Global.hs view
@@ -23,17 +23,17 @@ -- unsafe, must restart server after changing config file, sorry about that ... -- but these configs are read only, and keep the view pure, so no monad headaches involved. -user_config = UIO.readFile config_uri .purify .filter_comment .lines .map strip .map (split "\\s*=\\s*") .map tuple2+user_config = UIO.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+config_for s = config_for' s s -blog_title = config_for "blog_title"-blog_subtitle = config_for "blog_subtitle"-host_name = config_for "host_name"-author_email = config_for "author_email" +blog_title = config_for "blog_title"+blog_subtitle = config_for "blog_subtitle"+host_name = config_for "host_name"+author_email = config_for "author_email" -panda_url = "http://github.com/nfjinjing/panda"+per_page = config_for' "per_page" "7" .read :: Int+navigation = config_for' "navigation" "About" .split "," .map strip .reject null .("Home" :) -per_page = config_for' "per_page" "7" .read :: Int-navigation = config_for' "navigation" "About" .split "," .map strip .reject null .("Home" :)+panda_url = "http://github.com/nfjinjing/panda"
Panda/Helper/Escape.hs view
@@ -1,22 +1,25 @@ module Panda.Helper.Escape where +import Text.ParserCombinators.Parsec+import MPS hiding (parse)+import Char+import Prelude hiding ((.), (/), id) -import Text.XML.HaXml hiding ((!))-import Text.XML.HaXml.Parse (xmlParseWith, document)-import Text.XML.HaXml.Lex (xmlLex)+unicode :: Parser Char+unicode = do+ char '&'+ char '#'+ word <- many1 digit+ char ';'+ return $ chr (read word) +unescape_parser :: Parser String+unescape_parser = do+ s <- many (unicode <|> anyChar)+ return $ s +parse' p s = case (parse p "" s) of+ Left err -> err.show.error+ Right x -> x -unescape :: String -> String-unescape = concatMap ctext . xmlUnEscapeContent stdXmlEscaper .- unwrapTag .- either error id . fst . xmlParseWith document .- xmlLex "oops, lexer failed" . wrapWithTag "t"- where- ctext (CString _ txt _) = txt- ctext (CRef (RefEntity name) _) = '&' : name ++ ";" -- skipped by escaper- ctext (CRef (RefChar num) _) = '&' : '#' : show num ++ ";" -- ditto- ctext _ = error "oops, can't unescape non-cdata"- wrapWithTag t s = concat ["<", t, ">", s, "</", t, ">"]- unwrapTag (Document _ _ (Elem _ _ c) _) = c- unwrapTag _ = error "oops, not wrapped"+unescape s = parse' unescape_parser s
Panda/Model/Post.hs view
@@ -26,6 +26,6 @@ Nothing -> parse_date "2000-1-1".fromJust Just x -> x -match s x = [title, body] .map (send_to x >>> lower >>> isInfixOf (s.lower)) .or+match s x = [title, body >>> from_utf8] .map (send_to x >>> lower >>> isInfixOf (s.lower)) .or search "" = return [] search s = list <.> filter (match s)
changelog.markdown view
@@ -1,4 +1,9 @@-0.0.0.4-1+0.0.0.4.2+----------++downgrade to `HaXml 0.13` and `RSS 3000.0.1` for `arch`++0.0.0.4.1 ---------- require `mps-0.0.0.1`
panda.cabal view
@@ -1,5 +1,5 @@ Name: panda-Version: 0.0.0.4.1+Version: 0.0.0.4.2 Build-type: Simple Synopsis: Simple Static Blog Engine Description: Simple Static Blog Engine@@ -14,7 +14,7 @@ data-files: readme.markdown, changelog.markdown library- build-depends: base, cgi, network, haskell98, old-locale, old-time, directory, filepath, containers >= 0.1.0.0, mps >= 0.0.0.1, parsedate >= 3000.0.0, rss >= 3000.1.0, xhtml >= 3000.2.0.0, kibro >= 0.0, HaXml >= 1.19, utf8-string >= 0.3.1+ build-depends: base, cgi, network, haskell98, old-locale, old-time, directory, filepath, containers >= 0.1.0.0, mps >= 0.0.0.1, parsedate >= 3000.0.0, rss >= 3000.0.1, xhtml >= 3000.2.0.0, kibro >= 0.0, utf8-string >= 0.3.1 exposed-modules: Panda Panda.Controller.Application Panda.Config.Global