rgviz 0.22 → 0.23
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rgviz/html_renderer.rb +26 -0
- data/lib/rgviz.rb +1 -0
- metadata +4 -3
@@ -0,0 +1,26 @@
|
|
1
|
+
module Rgviz
|
2
|
+
module HtmlRenderer
|
3
|
+
def self.render(table)
|
4
|
+
@string = ''
|
5
|
+
@string += "<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\">\n"
|
6
|
+
|
7
|
+
@string += "<tr style=\"font-weight: bold; background-color: #aaa;\">\n"
|
8
|
+
table.cols.each do |row|
|
9
|
+
@string += "<td>#{row.label}</td>\n"
|
10
|
+
end
|
11
|
+
@string += "<tr>\n"
|
12
|
+
|
13
|
+
table.rows.each_with_index do |row, i|
|
14
|
+
color = i % 2 == 0 ? '#f0f0f0' : '#ffffff'
|
15
|
+
@string += "<tr style=\"background-color: #{color}\">\n"
|
16
|
+
row.c.each do |col|
|
17
|
+
@string += "<td>#{col.f || col.v}</td>\n"
|
18
|
+
end
|
19
|
+
@string += "<tr>\n"
|
20
|
+
end
|
21
|
+
|
22
|
+
@string += "</table>\n"
|
23
|
+
@string
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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/html_renderer'
|
7
8
|
|
8
9
|
class ParseException < Exception
|
9
10
|
end
|
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: 37
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 23
|
9
|
+
version: "0.23"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ary Borenszweig
|
@@ -28,6 +28,7 @@ extra_rdoc_files: []
|
|
28
28
|
|
29
29
|
files:
|
30
30
|
- lib/rgviz.rb
|
31
|
+
- lib/rgviz/html_renderer.rb
|
31
32
|
- lib/rgviz/lexer.rb
|
32
33
|
- lib/rgviz/nodes.rb
|
33
34
|
- lib/rgviz/parser.rb
|