removed QQ hacks from yesod-newsfeed
This commit is contained in:
parent
f4e743e50d
commit
6155e135b0
@ -1,5 +1,4 @@
|
|||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
{-# LANGUAGE CPP #-}
|
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
--
|
--
|
||||||
-- Module : Yesod.AtomFeed
|
-- Module : Yesod.AtomFeed
|
||||||
@ -36,12 +35,7 @@ atomFeed :: Feed (Route master) -> GHandler sub master RepAtom
|
|||||||
atomFeed = liftM RepAtom . hamletToContent . template
|
atomFeed = liftM RepAtom . hamletToContent . template
|
||||||
|
|
||||||
template :: Feed url -> HtmlUrl url
|
template :: Feed url -> HtmlUrl url
|
||||||
template arg =
|
template arg = [xhamlet|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
|
||||||
[xhamlet|
|
|
||||||
#else
|
|
||||||
[$xhamlet|
|
|
||||||
#endif
|
|
||||||
\<?xml version="1.0" encoding="utf-8"?>
|
\<?xml version="1.0" encoding="utf-8"?>
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
<title>#{feedTitle arg}
|
<title>#{feedTitle arg}
|
||||||
@ -54,12 +48,7 @@ template arg =
|
|||||||
|]
|
|]
|
||||||
|
|
||||||
entryTemplate :: FeedEntry url -> HtmlUrl url
|
entryTemplate :: FeedEntry url -> HtmlUrl url
|
||||||
entryTemplate arg =
|
entryTemplate arg = [xhamlet|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
|
||||||
[xhamlet|
|
|
||||||
#else
|
|
||||||
[$xhamlet|
|
|
||||||
#endif
|
|
||||||
<entry
|
<entry
|
||||||
<id>@{feedEntryLink arg}
|
<id>@{feedEntryLink arg}
|
||||||
<link href=@{feedEntryLink arg}
|
<link href=@{feedEntryLink arg}
|
||||||
@ -75,11 +64,6 @@ entryTemplate arg =
|
|||||||
atomLink :: Route m
|
atomLink :: Route m
|
||||||
-> String -- ^ title
|
-> String -- ^ title
|
||||||
-> GWidget s m ()
|
-> GWidget s m ()
|
||||||
atomLink r title = addHamletHead
|
atomLink r title = addHamletHead [hamlet|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
|
||||||
[hamlet|
|
|
||||||
#else
|
|
||||||
[$hamlet|
|
|
||||||
#endif
|
|
||||||
<link href=@{r} type=#{S8.unpack typeAtom} rel="alternate" title=#{title}
|
<link href=@{r} type=#{S8.unpack typeAtom} rel="alternate" title=#{title}
|
||||||
|]
|
|]
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
{-# LANGUAGE CPP #-}
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
--
|
--
|
||||||
-- Module : Yesod.RssFeed
|
-- Module : Yesod.RssFeed
|
||||||
@ -33,12 +32,7 @@ rssFeed :: Feed (Route master) -> GHandler sub master RepRss
|
|||||||
rssFeed = liftM RepRss . hamletToContent . template
|
rssFeed = liftM RepRss . hamletToContent . template
|
||||||
|
|
||||||
template :: Feed url -> HtmlUrl url
|
template :: Feed url -> HtmlUrl url
|
||||||
template arg =
|
template arg = [xhamlet|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
|
||||||
[xhamlet|
|
|
||||||
#else
|
|
||||||
[$xhamlet|
|
|
||||||
#endif
|
|
||||||
\<?xml version="1.0" encoding="utf-8"?>
|
\<?xml version="1.0" encoding="utf-8"?>
|
||||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"
|
||||||
<channel
|
<channel
|
||||||
@ -54,12 +48,7 @@ template arg =
|
|||||||
|]
|
|]
|
||||||
|
|
||||||
entryTemplate :: FeedEntry url -> HtmlUrl url
|
entryTemplate :: FeedEntry url -> HtmlUrl url
|
||||||
entryTemplate arg =
|
entryTemplate arg = [xhamlet|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
|
||||||
[xhamlet|
|
|
||||||
#else
|
|
||||||
[$xhamlet|
|
|
||||||
#endif
|
|
||||||
<item
|
<item
|
||||||
<title> #{feedEntryTitle arg}
|
<title> #{feedEntryTitle arg}
|
||||||
<link> @{feedEntryLink arg}
|
<link> @{feedEntryLink arg}
|
||||||
@ -72,11 +61,6 @@ entryTemplate arg =
|
|||||||
rssLink :: Route m
|
rssLink :: Route m
|
||||||
-> String -- ^ title
|
-> String -- ^ title
|
||||||
-> GWidget s m ()
|
-> GWidget s m ()
|
||||||
rssLink r title = addHamletHead
|
rssLink r title = addHamletHead [hamlet|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
|
||||||
[hamlet|
|
|
||||||
#else
|
|
||||||
[$hamlet|
|
|
||||||
#endif
|
|
||||||
<link href=@{r} type=#{S8.unpack typeRss} rel="alternate" title=#{title}
|
<link href=@{r} type=#{S8.unpack typeRss} rel="alternate" title=#{title}
|
||||||
|]
|
|]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user