tablesmith 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tablesmith/html_formatter.rb +2 -5
- data/lib/tablesmith/version.rb +1 -1
- data/spec/table_spec.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e676306e2580d63feec58ebd3c104c7b278f5fae
|
4
|
+
data.tar.gz: 7f2ab47bbdaf6f57bbfec225a82ef9bf9b8263f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e597fb0ce8ff13bb8861ad85f5e7e649e5c4c9eece9a815c3f1772db569bf656183b5db31b4aa7e74e507833c076865f341638172ea03cdf80d0882e1931471
|
7
|
+
data.tar.gz: 7948c55b4079002e3c48752cf4fa1ddb0ce3dfb8a925430808738925061898b2e74866eb5f0e35a5c4c5549902e61cb80faa4564fbcff9f417b2abbbb570e94b
|
@@ -21,34 +21,31 @@ class HtmlFormatter
|
|
21
21
|
|
22
22
|
def append_table_head
|
23
23
|
@lines << "#{indent}<thead>"
|
24
|
-
@lines << "#{indent}<tr>"
|
25
24
|
unless @table.empty?
|
26
25
|
rows = @table.text_table.rows[0..0]
|
27
26
|
append_rows(rows, 'th')
|
28
27
|
end
|
29
|
-
@lines << "#{indent}</tr>"
|
30
28
|
@lines << "#{indent}</thead>"
|
31
29
|
end
|
32
30
|
|
33
31
|
def append_table_body
|
34
32
|
@lines << "#{indent}<tbody>"
|
35
|
-
@lines << "#{indent}<tr>"
|
36
|
-
|
37
33
|
unless @table.empty?
|
38
34
|
rows = @table.text_table.rows[2..-1]
|
39
35
|
append_rows(rows, 'td')
|
40
36
|
end
|
41
|
-
@lines << "#{indent}</tr>"
|
42
37
|
@lines << "#{indent}</tbody>"
|
43
38
|
end
|
44
39
|
|
45
40
|
def append_rows(rows, tag)
|
46
41
|
rows.each do |row|
|
47
42
|
next if row == :separator
|
43
|
+
@lines << "#{indent}<tr>"
|
48
44
|
row.map do |cell|
|
49
45
|
value = cell_value(cell)
|
50
46
|
@lines << "#{indent}#{indent}<#{tag}>#{value}</#{tag}>"
|
51
47
|
end
|
48
|
+
@lines << "#{indent}</tr>"
|
52
49
|
end
|
53
50
|
end
|
54
51
|
|
data/lib/tablesmith/version.rb
CHANGED
data/spec/table_spec.rb
CHANGED
@@ -54,7 +54,7 @@ describe Table do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'should output html' do
|
57
|
-
actual = [%w[a b c], %w[d e f]]
|
57
|
+
actual = [%w[a b c], %w[d e f], %w[g h i]]
|
58
58
|
expected = <<~TABLE
|
59
59
|
<table>
|
60
60
|
<thead>
|
@@ -70,6 +70,11 @@ describe Table do
|
|
70
70
|
<td>e</td>
|
71
71
|
<td>f</td>
|
72
72
|
</tr>
|
73
|
+
<tr>
|
74
|
+
<td>g</td>
|
75
|
+
<td>h</td>
|
76
|
+
<td>i</td>
|
77
|
+
</tr>
|
73
78
|
</tbody>
|
74
79
|
</table>
|
75
80
|
TABLE
|