tree_html 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38b6feffd5a7b44acca5b51ac501b4de6a714d5eda38700d867b1d7a345b145b
4
- data.tar.gz: 1efb12cbe56fe1c97b658e086f7f639d82ad2190198b6868262b341964ab3fad
3
+ metadata.gz: 20504c724cbd2859c9bfc6c6235f17cabd109932adc86ed84ee60f2549e540e5
4
+ data.tar.gz: 4b2f5d2ca583f0f79d6ba403f1e566966ba3a582ae1d8a507d72c66a74d51aa6
5
5
  SHA512:
6
- metadata.gz: 281f428f38623f6b4ba961348073a1f4e9fe1a9e7f2204a857efe6950974c15a854ac2426de0b471b1d843e55a9d33fadda75302e7c8b9fceecbe399aab34769
7
- data.tar.gz: 2279a74ba2795b54a6347edbd51b95b355a45645777020135a74b84979d7eaff05a1943537554cdcf9f9accdc39e82e9aca81439a0b233de933039d780f12f5e
6
+ metadata.gz: 21139d38408d2be9a12e9f1e0b7396a6371568d7467d780827935248c959ada040613e0c801e8e74e5cb1f4982ad87edc6b00c98027d86b461d51ecc488c95ef
7
+ data.tar.gz: a6d3e49ee00f675c8acd0a5ee89c7555c1fb4ef8805aa82a4c89fd8d7d85814fc5bf12414173e3237b091059b0ac08a434b0cb2cf4692d8120b0563d154a5bdf
data/README.md CHANGED
@@ -20,7 +20,11 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
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.
23
+ In Node class, `include TreeHtml`.
24
+
25
+ Then implement `label_for_tree_html` and `children_for_tree_html` for Branch class, and `label_for_tree_html` for Leaf class.
26
+
27
+ Finally, 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
28
 
25
29
  By Default, any object can be leaf, and renders as `to_s`.
26
30
 
@@ -1,3 +1,3 @@
1
1
  module TreeHtml
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
data/lib/tree_html.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "tree_html/version"
2
+ require "cgi"
2
3
 
3
4
  module TreeHtml
4
5
 
@@ -11,7 +12,11 @@ module TreeHtml
11
12
 
12
13
  class ::Object
13
14
  def li_for_tree_html
14
- "<li>#{NO_CHECKBOX}<a>#{to_s}</a></li>"
15
+ "<li>#{NO_CHECKBOX}<a>#{label_for_tree_html}</a></li>"
16
+ end
17
+
18
+ def label_for_tree_html
19
+ CGI::escapeHTML(to_s)
15
20
  end
16
21
  end
17
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tree_html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-21 00:00:00.000000000 Z
11
+ date: 2022-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
- rubygems_version: 3.1.6
95
+ rubygems_version: 3.0.3
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: generate plain css tree structure