geek 1.0.0.6 → 1.0.0.7
raw patch · 4 files changed
+16/−32 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Nemesis +3/−1
- geek.cabal +1/−1
- src/Web/Geek/Application.hs +6/−20
- src/Web/Geek/RSS.hs +6/−10
Nemesis view
@@ -13,7 +13,7 @@ desc "prepare cabal dist"- task "dist" $ do+ task "dist" - do sh "cabal clean" sh "cabal configure" sh "cabal sdist"@@ -22,3 +22,5 @@ task "t:Main/titan" - return ()+ +
geek.cabal view
@@ -1,5 +1,5 @@ Name: geek-Version: 1.0.0.6+Version: 1.0.0.7 Build-type: Simple Synopsis: Geek blog engine Description: A dynamic blog engine, customizable with standard web technology, i.e. HTML, CSS and Javascript (JSON)
src/Web/Geek/Application.hs view
@@ -26,8 +26,8 @@ import Hack2.Contrib.Middleware.File (serve) import Hack2.Contrib.Middleware.Static import Hack2.Contrib.Request (params)-import Hack2.Contrib.Response (set_content_type)-import Hack2.Contrib.Utils (use, unescape_uri)+import Hack2.Contrib.Response (set_content_type, redirect)+import Hack2.Contrib.Utils (use, unescape_uri, script_name, escape_uri) import Network.Miku hiding (json) import Network.Miku.Type (AppMonadT) import Safe (readMay)@@ -173,9 +173,6 @@ _maybe_tag <- text_params ^ lookup_non_empty_and_stripped "tag" _query_text <- query_text- - -- io - printf "query_text: %s" (T.unpack _query_text)- _posts_filtered_by_query <- io - read_posts_by_query _query_text let _posts_filtered_by_tag_and_query = filter_posts_by_tag _posts_filtered_by_query _maybe_tag@@ -183,9 +180,6 @@ (_drop, _take) <- pager let paginated_posts = _posts_filtered_by_tag_and_query.drop _drop.take _take- - -- io - puts - paginated_posts.map (title > T.unpack).join "\n"- clean_raw_body _post = _post .set __raw_body "" json- paginated_posts.map clean_raw_body@@ -229,20 +223,9 @@ tag_data_list = sorted_tags.map (splat TagCount) - -- io - print tag_data_list json tag_data_list - get "/" - do- -- modify - redirect "/index.html" Nothing-- _response <- io - serve Nothing (_config.index_file_path.encodeUtf8)-- State.put _response- - -- Feeds- - let rss_tag_controller :: AppMonadT () rss_tag_controller = do@@ -265,6 +248,9 @@ get "/tag/:tag/rss.xml" - do rss_tag_controller + + -- for angular html5 mode get "*" - do- text "Unknown route"+ _response <- io - serve Nothing (_config.index_file_path.encodeUtf8)+ State.put _response
src/Web/Geek/RSS.hs view
@@ -55,22 +55,18 @@ text = T.unpack > str rss :: Geek.Config -> [Geek.Post] -> Maybe Text -> ByteString-rss _config _posts _mabye_tag = l2s - render_bytestring - do+rss _config _posts _maybe_tag = l2s - render_bytestring - do let drop_tail_slash xs = xs.reverse.dropWhile (is '/').reverse - site_link = + site_link = _config.Geek.rss_site_link.T.unpack.drop_tail_slash+ site_link_with_prefix = ( [- _config.Geek.rss_site_link.T.unpack.drop_tail_slash+ site_link , _config.Geek.rss_site_root_prefix.T.unpack.drop_tail_slash.reverse.drop_tail_slash ] ).join "/" - site_tag_link = - case _mabye_tag of- Nothing -> site_link- Just _tag -> site_link + "/" + _tag.T.unpack- xml_header element "rss" ! [attr "version" "2.0", attr "xmlns:atom" "http://www.w3.org/2005/Atom"] - do@@ -86,7 +82,7 @@ str - site_link - element "atom:link" ! [href (site_tag_link + "/rss.xml"), attr "rel" "self", _type "application/rss+xml"] -+ element "atom:link" ! [href (site_link + "/rss.xml"), attr "rel" "self", _type "application/rss+xml"] - return () forM_ _posts - \_post ->@@ -101,7 +97,7 @@ let pub_date_format_string = "%a, %d %b %Y %H:%M:%S %z" str - _post.Geek.date.fromMaybe def.formatTime defaultTimeLocale pub_date_format_string - let post_link = site_link + "/" + _post.Geek.link.Geek.unURIEscapedText.T.unpack+ let post_link = site_link_with_prefix + "/" + _post.Geek.link.Geek.unURIEscapedText.T.unpack element "link" - do str - post_link element "guid" ! [attr "isPermaLink" "true"] - do