greentable 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- greentable (0.9.2)
4
+ greentable (0.9.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -94,14 +94,14 @@ will produce
94
94
  <table class="a aa" style="b:c">
95
95
  <thead>
96
96
  <tr class="d">
97
- <th onclick="e();" class="h i ee">col0</th>
97
+ <th onclick="e();" class="ee h i">col0</th>
98
98
  <th onclick="e();" class="ee">col1</th>
99
99
  </tr>
100
100
  </thead>
101
101
  <tbody>
102
102
  <tr class="d">
103
- <td data-target="f" class="h ff">0</td>
104
- <td data-target="f" class="j ff">0</td>
103
+ <td data-target="f" class="ff h">0</td>
104
+ <td data-target="f" class="ff j">0</td>
105
105
  </tr>
106
106
  </tbody>
107
107
  </table>
@@ -247,7 +247,7 @@ will produce
247
247
  </tbody>
248
248
  <tfoot>
249
249
  <tr class='footer_tr_class'>
250
- <td class='a' style: 'border-top: 2px solid black;'>Total</td>
250
+ <td class='a' style='border-top: 2px solid black;'>Total</td>
251
251
  <td class='a' style='border-top: 2px solid black; font-weight: bold;'>$3.14</td>
252
252
  </tr>
253
253
  </tfoot>
@@ -6,8 +6,8 @@ Gem::Specification.new do |spec|
6
6
  spec.name = "greentable"
7
7
  spec.version = Greentable::VERSION
8
8
  spec.authors = ["Wael Chatila"]
9
- spec.description = "Greentable produces HTML tables from an array without you having to deal with any HTML elements."
10
- spec.summary = "Rails declarative html tables with export features"
9
+ spec.description = "Greentable automatically produces HTML tables from an array in a succinct way. It also provides an easy way to export and print a particular table"
10
+ spec.summary = "Rails declarative html tables with export and print features"
11
11
  spec.homepage = "https://github.com/waelchatila/greentable"
12
12
  spec.license = 'LGPLv3+'
13
13
 
@@ -23,12 +23,15 @@ module Greentable
23
23
  doc = Nokogiri(body.to_s)
24
24
  if greentable_export == 'csv'
25
25
  ret= ""
26
- (doc/"##{greentable_id}//tr").each do |tr|
26
+ (doc/"##{greentable_id} / * / tr").each do |tr|
27
27
  row = []
28
28
  col = 0
29
29
  (tr/"./th | ./td").each do |x|
30
- colspan = (x.attributes['colspan'] || 1).to_i
31
- colspan = [colspan,1].max
30
+ colspan = x.attributes['colspan']
31
+ if colspan
32
+ colspan = colspan.value.to_i rescue nil
33
+ end
34
+ colspan ||= 1
32
35
  row[col] = (x.inner_text || '').strip
33
36
  col += colspan
34
37
  end
@@ -1,3 +1,3 @@
1
1
  module Greentable
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
@@ -10,6 +10,24 @@ hello world
10
10
  <% footer.col(style: 'background-color: #ccc;') do %>
11
11
  footer td
12
12
  <% end %>
13
+ <% footer.col(colspan: 2) do %>
14
+ colspan=2
15
+ <% end %>
16
+ <% footer.col(style: 'background-color: #ccc;') do %>
17
+ <table>
18
+ <tr>
19
+ <td>I</td>
20
+ <td>contain</td>
21
+ </tr>
22
+ <tr>
23
+ <td colspan="2">a</td>
24
+ </tr>
25
+ <tr>
26
+ <td>sub</td>
27
+ <td>table</td>
28
+ </tr>
29
+ </table>
30
+ <% end %>
13
31
  <% end %>
14
32
  <% gt.col('x') do %>
15
33
  <%= el %>
@@ -41,6 +41,19 @@ class ExportTest < ActionController::TestCase
41
41
  assert body !~ /table id=.+greentable_id.+/, body
42
42
  assert body !~ /window.print/, body
43
43
  assert content_type =~ /text\/csv/
44
+
45
+ expected =<<-END
46
+ x,x+1,i,first?,last?,odd?,even?
47
+ 100,101,0,true,false,true,false
48
+ 101,102,1,false,false,false,true
49
+ 102,103,2,false,true,true,false
50
+ footer td,colspan=2,,"I
51
+ contain
52
+ a
53
+ sub
54
+ table"
55
+ END
56
+ assert_equal expected, body
44
57
  end
45
58
 
46
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greentable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-31 00:00:00.000000000 Z
12
+ date: 2014-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -155,8 +155,8 @@ dependencies:
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
- description: Greentable produces HTML tables from an array without you having to deal
159
- with any HTML elements.
158
+ description: Greentable automatically produces HTML tables from an array in a succinct
159
+ way. It also provides an easy way to export and print a particular table
160
160
  email:
161
161
  executables: []
162
162
  extensions: []
@@ -247,7 +247,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
247
247
  version: '0'
248
248
  segments:
249
249
  - 0
250
- hash: 2946809728237935580
250
+ hash: -3412082307347015687
251
251
  required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  none: false
253
253
  requirements:
@@ -256,13 +256,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  version: '0'
257
257
  segments:
258
258
  - 0
259
- hash: 2946809728237935580
259
+ hash: -3412082307347015687
260
260
  requirements: []
261
261
  rubyforge_project:
262
262
  rubygems_version: 1.8.25
263
263
  signing_key:
264
264
  specification_version: 3
265
- summary: Rails declarative html tables with export features
265
+ summary: Rails declarative html tables with export and print features
266
266
  test_files:
267
267
  - test/dummy/app/assets/javascripts/application.js
268
268
  - test/dummy/app/assets/stylesheets/application.css