tree_html 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e374310feba94ee773d5f9a1be28921511624372
4
- data.tar.gz: 359d21212bb21754e671faae08a1f63af110cb64
3
+ metadata.gz: b52629dbc45f4fe5344a854327d42a38fd5c0148
4
+ data.tar.gz: 9013505a0e5c0f05744b8fa923afe9a1a800fe2c
5
5
  SHA512:
6
- metadata.gz: '097d811662c5a1291a01d670aacc1c86790f02477d00a85a061930e4a6585f239cf604e7f165acd926154f1ae0f2935c2307f11eabaa612917a0b2137f07718d'
7
- data.tar.gz: 72d181750752c1fb6e51b2d6319d4eaac03b6926361c8a9732b5dd85c118282891bc6455ad1312f9b454eae318025206414bc5aeb1b9988a6e5a84597ba06c57
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 `label_for_tree_graph` and `children_for_tree_graph`, 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.
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
 
@@ -53,7 +53,7 @@ ul.tree-html>li:first-child::before {
53
53
 
54
54
  .tree-html li a:hover, .tree-html li a:hover+ul li a,
55
55
  .tree-html li a:focus, .tree-html li a:focus+ul li a {
56
- background: gray;
56
+ background-color: #d3d3d3;
57
57
  }
58
58
 
59
59
  .tree-html label {
@@ -1,3 +1,3 @@
1
1
  module TreeHtml
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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 custom_css=''
9
- "<!DOCTYPE HTML><html><head><meta charset='utf-8'/><style>#{css(custom_css)}</style></head><body>#{tree_html}</body></html>"
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 addition=''
15
- File.read(Css) + addition
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tree_html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken