[Fencommits] fenserve: link directly to log if there aren't multiple lines affecting a note; twiddle appearance
Benja Fallenstein
benja.fallenstein at gmail.com
Tue May 1 23:15:06 EEST 2007
Tue May 1 23:14:25 EEST 2007 Benja Fallenstein <benja.fallenstein at gmail.com>
* link directly to log if there aren't multiple lines affecting a note; twiddle appearance
diff -rN -u old-fenserve-1/notetaker/Main.hs new-fenserve-1/notetaker/Main.hs
--- old-fenserve-1/notetaker/Main.hs 2007-05-01 23:15:05.000000000 +0300
+++ new-fenserve-1/notetaker/Main.hs 2007-05-01 23:15:05.000000000 +0300
@@ -24,7 +24,7 @@
data Note = Note String Bool [Line] [Note] deriving (Eq,Ord,Read,Show)
-style = "<style type='text/css'>li, p.logline { margin-bottom: 0.3em; margin-top: 0.3em }\nspan.loglink { color: #aaa; font-size: small }\nspan.loglink a { color: #aaa }</style>"
+style = "<style type='text/css'>li, p.logline { margin-bottom: 0.3em; margin-top: 0.3em }\n.loglink, .children { color: #aaa; font-size: small }\n.loglink a { color: #aaa }</style>"
form nick = "<p><form id='myform' action='/?nick="++nick++"' method='post'>\
\ Nick: <input name='nick' type='text' size=8 \
@@ -63,15 +63,18 @@
"<ol>" ++ concat [renderNote (p++[i]) (notes !! i)
| i <- [0..length notes - 1]] ++ "</ol>" where
- link p = " <span class='loglink'>(<a href='/log/"++renderPath p++"'>log</a>)</span>"
-
- renderNote p (Note title False _ cs) = "<li>" ++ title ++ link p ++ renderNotes p nick cs
- renderNote p (Note title True _ cs) =
- "<li>" ++ title ++ " (<a href='/item/"
+ link [] _ = ""
+ link [Line t _ _] _ = " <span class='loglink'>(<a href='/log#"++show t++"'>log</a>)</span>"
+ link _ p = " <span class='loglink'>(<a href='/log/"++renderPath p++"'>log</a>)</span>"
+
+ renderNote p (Note title False ls cs) = "<li>" ++ title ++ link ls p ++ renderNotes p nick cs
+ renderNote p (Note title True ls cs) =
+ "<li>" ++ title ++ " <span class='children'>(<a href='/item/"
++ renderPath p ++ "?nick=" ++ nick ++ "'><i>"
++ countable (length cs) "child" "ren" ++ "</i></a>, "
++ countable (gather ((+1) . sum) 1 cs - 1) "descendant" "s" ++ ", "
- ++ countable (gather ((+1) . maximum) 0 cs) "level" "s" ++ ")" ++ link p
+ ++ countable (gather ((+1) . maximum) 0 cs) "level" "s" ++ ")</span>"
+ ++ link ls p
where countable 1 s _ = "1 " ++ s
countable n s pl = printf "%s %s%s" (show n) s pl
gather _ leaf [] = leaf
More information about the Fencommits
mailing list