[Fencommits] fenserve: twid formatting

Benja Fallenstein benja.fallenstein at gmail.com
Sat Apr 28 00:33:06 EEST 2007


Sat Apr 28 00:24:17 EEST 2007  Benja Fallenstein <benja.fallenstein at gmail.com>
  * twid formatting
diff -rN -u old-fenserve/notetaker/Main.hs new-fenserve/notetaker/Main.hs
--- old-fenserve/notetaker/Main.hs	2007-04-28 00:33:06.000000000 +0300
+++ new-fenserve/notetaker/Main.hs	2007-04-28 00:33:06.000000000 +0300
@@ -28,7 +28,8 @@
             \</form>\
             \<script type='text/javascript'>\
             \    document.forms[0].elements[1].focus();\
-            \</script>"
+            \</script>\
+            \<style type='text/css'>li, p.logline { margin-bottom: 0.3em; margin-top: 0.3em }</style>"
 
 views n nick = "Views: "++concat (intersperse " | " [view i|i<-[0..2]])++"<p>"
     where links = [("main", "/"), ("log", "/log"), ("lastlog", "/lastlog")]
@@ -82,16 +83,17 @@
                  else get >>= return . reverse . take 15 . reverse
     respond $ form nick ++ views (if lastlog then 2 else 1) nick ++
               flip concatMap lines (\(Line time nick body) -> 
-                  renderTime time ++ " " ++ renderBody nick body ++ "<br>")
+                     "<p class='logline'>" ++ renderTime time ++ " " 
+                  ++ renderBody nick body)
                   
 renderBody :: String -> Body -> String
 renderBody nick (Body s) = printf "&lt;<b>%s</b>&gt; %s" nick s
-renderBody nick body     = printf "<b>%s</b> %s" nick (msg body) where
+renderBody nick body     = printf "<i><b>%s</b> %s" nick (msg body) where
     msg :: Body -> String
-    msg (Add [] l) = printf "<i>adds:</i> %s" l
-    msg (Add p l)  = printf "<i>adds to '%s':</i> %s" (renderPath p) l
-    msg (Edit p l) = printf "<i>edits '%s':</i> %s" (renderPath p) l
-    msg (Delete p) = printf "<i>deletes '%s'.</i>" (renderPath p)
+    msg (Add [] l) = printf "adds:</i> %s" l
+    msg (Add p l)  = printf "adds to '%s':</i> %s" (renderPath p) l
+    msg (Edit p l) = printf "edits '%s':</i> %s" (renderPath p) l
+    msg (Delete p) = printf "deletes '%s.'</i>" (renderPath p)
     
     renderPath = concat . intersperse "." . map (show . (+1))
                




More information about the Fencommits mailing list