about summary refs log tree commit diff
path: root/src/Blog.hs
diff options
context:
space:
mode:
authorVincent Ambo <v.ambo@me.com>2012-03-15T19·16+0100
committerVincent Ambo <v.ambo@me.com>2012-03-15T19·16+0100
commit579c11cd2a62ea81047b0649dc7aa473a39456b7 (patch)
treebd7d5b9c8e03d32a9cc37e3da0a40f25032345b2 /src/Blog.hs
parentdf9a17b695c82d46eeaddb1cb1feb9fed4c81d3a (diff)
* version 3.0
* fixed read-more links
Diffstat (limited to 'src/Blog.hs')
-rw-r--r--src/Blog.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Blog.hs b/src/Blog.hs
index f7e5f5f3b727..534803baa426 100644
--- a/src/Blog.hs
+++ b/src/Blog.hs
@@ -2,6 +2,7 @@
 
 module Blog where
 
+import           Control.Monad (when, unless)
 import           Data.Data (Data, Typeable)
 import           Data.List (intersperse)
 import           Data.Monoid (mempty)
@@ -71,10 +72,15 @@ renderEntries showAll entries topText footerLinks =
     where
         showEntry :: Entry -> Html
         showEntry e = H.li $ do 
-            entryLink e
-            preEscapedText $ T.concat [" ", btext e, "<br>&nbsp;</br>"]
-        entryLink e = H.a ! A.href (toValue $ concat $ intersperse' "/" $ linkElems e) $
-                        toHtml ("[" ++ show(length $ comments e) ++ "]")
+            entryLink e $ T.pack $ show(length $ comments e)
+            preEscapedText $ T.append " " $ btext e
+            when ( mtext e /= T.empty ) $
+                H.p $ entryLink e $ readMore $ lang e
+            unless ( mtext e /= T.empty ) $
+                preEscapedText "<br>&nbsp;</br>"
+        entryLink :: Entry -> Text -> Html
+        entryLink e s = H.a ! A.href (toValue $ concat $ intersperse' "/" $ linkElems e) $
+                        toHtml (T.concat ["[", s, "]"])
         linkElems e = [show(lang e), show $ entryId e]
         getFooterLinks (Just h) = h
         getFooterLinks Nothing = mempty