[Fencommits] fenserve: allow the use of (x,y,z) instead of (x+++y+++z) -- allows us to save on plus signs and to use $ more
Benja Fallenstein
benja.fallenstein at gmail.com
Thu May 31 00:23:00 EEST 2007
Thu May 31 00:22:13 EEST 2007 Benja Fallenstein <benja.fallenstein at gmail.com>
* allow the use of (x,y,z) instead of (x+++y+++z) -- allows us to save on plus signs and to use $ more
diff -rN -u old-fenserve-1/fendata/HTML.hs new-fenserve-1/fendata/HTML.hs
--- old-fenserve-1/fendata/HTML.hs 2007-05-31 00:23:00.000000000 +0300
+++ new-fenserve-1/fendata/HTML.hs 2007-05-31 00:23:00.000000000 +0300
@@ -34,6 +34,23 @@
instance ToHTML String where
toHTML = HTML . concatMap quoteChar
+instance (ToHTML a, ToHTML b) => ToHTML (a,b) where
+ toHTML (a,b) = a +++ b
+instance (ToHTML a, ToHTML (b,c)) => ToHTML (a,b,c) where
+ toHTML (a,b,c) = a +++ (b,c)
+instance (ToHTML a, ToHTML (b,c,d)) => ToHTML (a,b,c,d) where
+ toHTML (a,b,c,d) = a +++ (b,c,d)
+instance (ToHTML a, ToHTML (b,c,d,e)) => ToHTML (a,b,c,d,e) where
+ toHTML (a,b,c,d,e) = a +++ (b,c,d,e)
+instance (ToHTML a, ToHTML (b,c,d,e,f)) => ToHTML (a,b,c,d,e,f) where
+ toHTML (a,b,c,d,e,f) = a +++ (b,c,d,e,f)
+instance (ToHTML a, ToHTML (b,c,d,e,f,g)) => ToHTML (a,b,c,d,e,f,g) where
+ toHTML (a,b,c,d,e,f,g) = a +++ (b,c,d,e,f,g)
+instance (ToHTML a, ToHTML (b,c,d,e,f,g,h)) => ToHTML (a,b,c,d,e,f,g,h) where
+ toHTML (a,b,c,d,e,f,g,h) = a +++ (b,c,d,e,f,g,h)
+instance (ToHTML a, ToHTML (b,c,d,e,f,g,h,i)) => ToHTML (a,b,c,d,e,f,g,h,i) where
+ toHTML (a,b,c,d,e,f,g,h,i) = a +++ (b,c,d,e,f,g,h,i)
+
quoteBr = HTML . concatMap (\c -> case c of '\n' -> "<br>"; _ -> quoteChar c)
quoteP = HTML . concatMap (\c -> case c of '\n' -> "<p>"; _ -> quoteChar c)
diff -rN -u old-fenserve-1/fendata/UI.hs new-fenserve-1/fendata/UI.hs
--- old-fenserve-1/fendata/UI.hs 2007-05-31 00:23:00.000000000 +0300
+++ new-fenserve-1/fendata/UI.hs 2007-05-31 00:23:00.000000000 +0300
@@ -33,33 +33,34 @@
\form { display: inline } \
\</style><title>Fenlight demo</title></head>"
-makePage state title sidebar body =
- --(tag "title" [] title +++) .
- tag "body" [] $
- tag "div" [("class", "header")]
- (etag "img" [("src", "http://iki.fi/tuukka/tmp/lantern-photo-75.jpeg"),
- ("class", "logo")] +++
- h1 ("Fenlight | " +++ title)) +++
- tag "div" [("class", "main")] (
- tag "div" [("class", "sidebar")] (
- para "Welcome to Fenlight!" +++ sidebar +++ hr +++
- catFor (stateSidebarPages state) (\(fun, args) ->
+makePage state title sidebar body = tag "body" [] $
+ ( tag "div" [("class", "header")]
+ ( etag "img" [("src", "http://iki.fi/tuukka/tmp/lantern-photo-75.jpeg"),
+ ("class", "logo")]
+ , h1 ("Fenlight | ", title) )
+ , tag "div" [("class", "main")]
+ ( tag "div" [("class", "sidebar")]
+ ( para "Welcome to Fenlight!", sidebar, hr
+ , catFor (stateSidebarPages state) $ \(fun, args) ->
let ?state=state; ?link=False; ?name=Nothing
in let exp = Call fun (map (Just . Str) args)
uri = ?root++"potion/"++fun++concat ["/"++a | a <- args]
- in para $ bold $ link uri $ renderExp exp id string) +++
- hr +++
- para (qlink "potion" [P "exp" $ Block []] "New page") +++
- catFor (Map.keys $ stateSchema state) (\cat ->
- para (qlink "table" [P "cat" cat] ("New "++cat++" view"))) +++
- para (link (?root++"addCategory") "Add category")) +++
- tag "div" [("class", "content")] body) +++
- tag "div" [("class", "footer")]
- ("Fenlight (c) 2007 by Benja Fallenstein and Tuukka Hastrup. " +++
- link "http://www.flickr.com/photo_zoom.gne?id=244815014&size=sq" "Logo" +++
- " (c) 2006 by " +++ link "http://www.flickr.com/photos/44458147@N00/"
- "The G-tastic 7" +++ ". All content is licensed under the " +++
- link "http://creativecommons.org/licenses/by-sa/2.0/"
- "Creative Commons Attribution-ShareAlike 2.0 license" +++ ".")
+ in para $ bold $ link uri $ renderExp exp id string
+ , hr
+ , para $ qlink "potion" [P "exp" $ Block []] "New page"
+ , catFor (Map.keys $ stateSchema state) $ \cat ->
+ para $ qlink "table" [P "cat" cat] ("New ", cat, " view")
+ , para $ link (?root++"addCategory") "Add category" )
+ , tag "div" [("class", "content")] body )
+ , tag "div" [("class", "footer")]
+ ( "Fenlight (c) 2007 by Benja Fallenstein and Tuukka Hastrup. "
+ , link "http://www.flickr.com/photo_zoom.gne?id=244815014&size=sq" "Logo"
+ , " (c) 2006 by "
+ , link "http://www.flickr.com/photos/44458147@N00/" "The G-tastic 7"
+ , ". All content is licensed under the "
+ , link "http://creativecommons.org/licenses/by-sa/2.0/"
+ "Creative Commons Attribution-ShareAlike 2.0 license"
+ , "." )
+ )
More information about the Fencommits
mailing list