rgviz 0.24 → 0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rgviz/html_renderer.rb +13 -13
- data/lib/rgviz.rb +1 -0
- metadata +3 -3
data/lib/rgviz/html_renderer.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
module Rgviz
|
2
2
|
module HtmlRenderer
|
3
3
|
def self.render(table)
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
string = "<html>\n"
|
5
|
+
string << "<body>\n"
|
6
|
+
string << "<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\">\n"
|
7
7
|
|
8
|
-
|
8
|
+
string << "<tr style=\"font-weight: bold; background-color: #aaa;\">\n"
|
9
9
|
table.cols.each do |row|
|
10
|
-
|
10
|
+
string << "<td>#{row.label}</td>\n"
|
11
11
|
end
|
12
|
-
|
12
|
+
string << "<tr>\n"
|
13
13
|
|
14
14
|
table.rows.each_with_index do |row, i|
|
15
15
|
color = i % 2 == 0 ? '#f0f0f0' : '#ffffff'
|
16
|
-
|
16
|
+
string << "<tr style=\"background-color: #{color}\">\n"
|
17
17
|
row.c.each do |col|
|
18
|
-
|
18
|
+
string << "<td>#{col.f || col.v}</td>\n"
|
19
19
|
end
|
20
|
-
|
20
|
+
string << "<tr>\n"
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
string << "</table>\n"
|
24
|
+
string << "</body>\n"
|
25
|
+
string << "</html>\n"
|
26
|
+
string
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/rgviz.rb
CHANGED
@@ -4,6 +4,7 @@ require File.dirname(__FILE__) + '/rgviz/parser'
|
|
4
4
|
require File.dirname(__FILE__) + '/rgviz/nodes'
|
5
5
|
require File.dirname(__FILE__) + '/rgviz/visitor'
|
6
6
|
require File.dirname(__FILE__) + '/rgviz/table'
|
7
|
+
require File.dirname(__FILE__) + '/rgviz/csv_renderer'
|
7
8
|
require File.dirname(__FILE__) + '/rgviz/html_renderer'
|
8
9
|
|
9
10
|
class ParseException < Exception
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 25
|
9
|
+
version: "0.25"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ary Borenszweig
|