prawn-table 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prawn/table.rb +5 -1
- data/lib/prawn/table/cells.rb +7 -0
- data/spec/table_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bb26b3cd806b99d95c80bc1b14e54727e53ce60
|
4
|
+
data.tar.gz: 9526ad3d0b13f33fc113000409e43e1674604447
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46f037412934af66b44aebb2b59e46f62161b84426e5d176ebc222211fc9984d8aef573e9c6aff85fb34f8d33757d16192c8de763150ae6735df47746b2e4462
|
7
|
+
data.tar.gz: ad550c5d510339f9464f84c2b8628222701d6163bbb5b05d8e76f08431939c4c41d17e6db93b01c650a6c3743d16176a18f506a1a2b30412ff1552161ad1a176
|
data/lib/prawn/table.rb
CHANGED
@@ -320,7 +320,11 @@ module Prawn
|
|
320
320
|
cells_this_page = []
|
321
321
|
|
322
322
|
@cells.each do |cell|
|
323
|
-
|
323
|
+
# we only need to run this test on the first cell in a row
|
324
|
+
# check if the rows height fits on the page
|
325
|
+
# check if the row is not the first on that page (wouldn't make sense to go to next page in this case)
|
326
|
+
if cell.column == 0 &&
|
327
|
+
row(cell.row).height_with_span > (cell.y + offset) - ref_bounds.absolute_bottom &&
|
324
328
|
cell.row > started_new_page_at_row
|
325
329
|
# Ink all cells on the current page
|
326
330
|
if defined?(@before_rendering_page) && @before_rendering_page
|
data/lib/prawn/table/cells.rb
CHANGED
@@ -182,6 +182,13 @@ module Prawn
|
|
182
182
|
aggregate_cell_values(:row, :height_ignoring_span, :max)
|
183
183
|
end
|
184
184
|
|
185
|
+
# Returns the total height of all rows in the selected set
|
186
|
+
# including spanned cells if the cell is the master cell
|
187
|
+
#
|
188
|
+
def height_with_span
|
189
|
+
aggregate_cell_values(:row, :height, :max)
|
190
|
+
end
|
191
|
+
|
185
192
|
# Supports setting arbitrary properties on a group of cells.
|
186
193
|
#
|
187
194
|
# table.cells.row(3..6).background_color = 'cc0000'
|
data/spec/table_spec.rb
CHANGED
@@ -804,6 +804,24 @@ describe "Prawn::Table" do
|
|
804
804
|
'Line 2', 'Line 3']
|
805
805
|
end
|
806
806
|
|
807
|
+
context 'when the last row of first page of a table has a rowspan > 1' do
|
808
|
+
it 'should move the cells below that rowspan cell to the next page' do
|
809
|
+
pdf = Prawn::Document.new
|
810
|
+
|
811
|
+
pdf.y = 100 # not enough room for the rowspan cell
|
812
|
+
pdf.table [
|
813
|
+
['R0C0', 'R0C1', 'R0C2'],
|
814
|
+
['R1C0', {content: 'R1C1', rowspan: 2}, 'R1C2'],
|
815
|
+
['R2C0', 'R2C2'],
|
816
|
+
]
|
817
|
+
|
818
|
+
output = PDF::Inspector::Page.analyze(pdf.render)
|
819
|
+
# Ensure we output the cells of row 2 on the new page only
|
820
|
+
output.pages[0][:strings].should == ['R0C0', 'R0C1', 'R0C2']
|
821
|
+
output.pages[1][:strings].should == ['R1C0', 'R1C1', 'R1C2', 'R2C0', 'R2C2']
|
822
|
+
end
|
823
|
+
end
|
824
|
+
|
807
825
|
it "should draw background before borders, but only within pages" do
|
808
826
|
seq = sequence("drawing_order")
|
809
827
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2014-07-
|
16
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: prawn
|