tree-view 0.1 → 0.2
raw patch · 2 files changed
+6/−5 lines, 2 files
Files
- src/Data/Tree/View.hs +5/−4
- tree-view.cabal +1/−1
src/Data/Tree/View.hs view
@@ -2,6 +2,7 @@ ( showTree , drawTree , NodeInfo (..)+ , showTreeHtml , htmlTree ) where @@ -63,7 +64,7 @@ data NodeInfo = NodeInfo { nodeName :: String -- ^ Node name (to be displayed in the HTML tree view) , nodeInfo :: String -- ^ Additional information (to be displayed when hovering the mouse over- -- the node). This field may contain line breaks+ -- the node). This field may contain line breaks. } htmlNode :: (NodeInfo, Int) -> String@@ -84,12 +85,12 @@ = [htmlNode n ++ "<span id=\"children_node" ++ show (snd n) ++ "\" class=\"children\">"] ++ appLast (concat (indentChildren (map showTreeHtml' ns))) "</span>" -showTreeHtml :: Tree (NodeInfo, Int) -> String-showTreeHtml tree = unlines $ lines template1 ++ showTreeHtml' tree ++ lines template2+showTreeHtml :: Tree NodeInfo -> String+showTreeHtml tree = unlines $ lines template1 ++ showTreeHtml' (enumTree tree) ++ lines template2 -- | Convert a 'Tree' to HTML with foldable nodes htmlTree :: FilePath -> Tree NodeInfo -> IO ()-htmlTree file = writeFile file . showTreeHtml . enumTree+htmlTree file = writeFile file . showTreeHtml template1 = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\
tree-view.cabal view
@@ -1,5 +1,5 @@ name: tree-view-version: 0.1+version: 0.2 synopsis: Render trees as foldable HTML and Unicode art description: Render trees as foldable HTML and Unicode art .