1module RelationHTML where
5import qualified Data.HashSet as HS
6import qualified Data.List as L
7import RelationAttribute
9attributesAsHTML :: Attributes -> String
10attributesAsHTML attrs = "<tr>" ++ (foldr folder "" attrNameList) ++ "</tr>"
12 folder attrName acc = acc ++ "<th>" ++ attrName ++ "</th>"
13 attrNameList = sortedAttributeNameList (attributeNameSet attrs)
15relationAsHTML :: Relation -> String
16relationAsHTML rel@(Relation attrNameSet tupleSet) = "<table border=\"1\">" ++ (attributesAsHTML attrNameSet) ++ (tupleSetAsHTML tupleSet) ++ "<tfoot>" ++ tablefooter ++ "</tfoot></table>"
18 tablefooter = "<tr><td colspan=\"100%\">" ++ show (cardinality rel) ++ " tuples</td></tr>"
20writeHTML :: String -> IO ()
21writeHTML = writeFile "/home/agentm/rel.html"
23writeRel :: Relation -> IO ()
24writeRel = writeHTML . relationAsHTML
26atomAsHTML :: Atom -> String
27atomAsHTML (StringAtom s) = s
28atomAsHTML (IntAtom i) = show i
29atomAsHTML (RelationAtom rel) = relationAsHTML rel
31tupleAsHTML :: RelationTuple -> String
32tupleAsHTML tuple = "<tr>" ++ L.foldr folder "" (tupleSortedAssocs tuple) ++ "</tr>"
34 folder tup acc = acc ++ "<td>" ++ (atomAsHTML (snd tup)) ++ "</td>"
36tupleSetAsHTML :: RelationTupleSet -> String
37tupleSetAsHTML tupSet = HS.foldr folder "" tupSet
39 folder tuple acc = acc ++ tupleAsHTML tuple
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list