tree_html 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/tree_html/tree_html.css +1 -1
- data/lib/tree_html/version.rb +1 -1
- data/lib/tree_html.rb +8 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b52629dbc45f4fe5344a854327d42a38fd5c0148
|
4
|
+
data.tar.gz: 9013505a0e5c0f05744b8fa923afe9a1a800fe2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f946b29c44a98cbabf6a4cf1d85dab687d755da252b07294e3717efeea5a55342241ac8020438c42ec37bf92f96539bb3d79aa78c955988c5c1cadf94696b4d5
|
7
|
+
data.tar.gz: 4180e244146f5cd107da42c5a6c5920af6c33d5a6d7961dbad7acc1a1dc38b05806b4ae61d63aa34032ccbeb061519d6d045fdec76381e3ddfb847ede43304cc
|
data/README.md
CHANGED
@@ -20,7 +20,9 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
In Node class, `include TreeHtml`, then implement `
|
23
|
+
In Node class, `include TreeHtml`, then implement `label_for_tree_html` and `children_for_tree_html`, then call`tree_html` on node object to get ul/li fragment, or `tree_html_full` to get a html file with pre-defined style.
|
24
|
+
|
25
|
+
You may overwrite `css_for_tree_html` to specify your own style.
|
24
26
|
|
25
27
|
Or checkout [test/tree_html_test.rb](https://github.com/turnon/tree_html/blob/master/test/tree_html_test.rb) to see how to use.
|
26
28
|
|
data/lib/tree_html/tree_html.css
CHANGED
data/lib/tree_html/version.rb
CHANGED
data/lib/tree_html.rb
CHANGED
@@ -5,14 +5,14 @@ module TreeHtml
|
|
5
5
|
"<ul class='tree-html'>#{li}</ul>"
|
6
6
|
end
|
7
7
|
|
8
|
-
def tree_html_full
|
9
|
-
"<!DOCTYPE HTML><html><head><meta charset='utf-8'/><style>#{css
|
8
|
+
def tree_html_full
|
9
|
+
"<!DOCTYPE HTML><html><head><meta charset='utf-8'/><style>#{css + css_for_tree_html}</style></head><body>#{tree_html}</body></html>"
|
10
10
|
end
|
11
11
|
|
12
12
|
Css = File.expand_path('../tree_html/tree_html.css', __FILE__)
|
13
13
|
|
14
|
-
def css
|
15
|
-
File.read(Css)
|
14
|
+
def css
|
15
|
+
File.read(Css)
|
16
16
|
end
|
17
17
|
|
18
18
|
protected
|
@@ -28,4 +28,8 @@ module TreeHtml
|
|
28
28
|
def sub_ul
|
29
29
|
children_for_tree_html.empty? ? '' : "<ul>#{children_for_tree_html.map{|c| c.li}.join}</ul>"
|
30
30
|
end
|
31
|
+
|
32
|
+
def css_for_tree_html
|
33
|
+
''
|
34
|
+
end
|
31
35
|
end
|