caracal 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7539fa972b10d2c7af3de21bb8f9787eecb0e0c3867326afd4cdedd2ec3dd5a
4
- data.tar.gz: 8356897d9cb7e54c9816497f0297cc635afb2267f42cba57fac009b3819791f0
3
+ metadata.gz: 07032410054f6b6e5b8d640aa391c24382eda9461832b7f3fb0fe2bb9203164f
4
+ data.tar.gz: 780ae708802f68185d556d6ec0dc28b5fdb86adefc6043ec18bf32027440278b
5
5
  SHA512:
6
- metadata.gz: b8542dfdc09c07f78f7bf63714d681b1f8a0d93c6718f14f3d1e53ef6b055e6549df94b95fddb93390f89e6d300063566b9d71d7584b104c453caa4dadf0e023
7
- data.tar.gz: '009ca4e19a83ec60c60bc3dc9e009da724a0768f50ebfba2b2e4045bf98e658689386495e3f59fd639eb2da1bb1fcfd059ada4f517353707647799c3d9c12be6'
6
+ metadata.gz: 136540cd7409584e274462d2f43b7b21f4533a4351611ea41f0db03fd6282a366d01c0a5d1f6b4d05d7674d9bdd9f939b536ba569189407abcfe253e8fc524c8
7
+ data.tar.gz: d9c61a1f362f43625aaa3160639f903ebd003df993dc8e78c17e456bb1a1205aef94b5e1dc8cdf9b69136ba71786bb2eeee03f8e26ae35c1862ea329d1fe9162
data/README.md CHANGED
@@ -628,6 +628,10 @@ the simplest solution to both problems.*
628
628
 
629
629
  ### Tables
630
630
 
631
+ ```
632
+ Release v1.4.0 deprecated the behaviour of automatically adding an empty paragraph tag after every table. If you are upgrading from an older version of the library, you will need to control such spacing in your own code.
633
+ ```
634
+
631
635
  Tables can be added using the `table` method. The method accepts several optional paramters to control the layout and style of the table cells.
632
636
 
633
637
  The `table` command accepts data in the form of a two-dimensional arrays. This corresponds to rows and column cells within those rows. Each array item can be a string, a Hash of options, a Proc (which will be passed as a block), or a `TableCellModel`. The command will normalize all array contents into a two-dimensional array of `TableCellModel` instances.
@@ -351,7 +351,8 @@ module Caracal
351
351
  rowspan_hash = {}
352
352
  model.rows.each do |row|
353
353
  xml['w'].tr do
354
- row.each_with_index do |tc, tc_index|
354
+ tc_index = 0
355
+ row.each do |tc|
355
356
  xml['w'].tc do
356
357
  xml['w'].tcPr do
357
358
  xml['w'].shd({ 'w:fill' => tc.cell_background })
@@ -380,30 +381,13 @@ module Caracal
380
381
  send(method, xml, m)
381
382
  end
382
383
  end
383
- end
384
- end
385
384
 
386
- # we need to adjust rowspan indexes as they depend on previous row colspans
387
- adjusted_rowspan_hash = {}
388
- rowspan_hash.each do |rowspan_cell_index, rowspan_value|
389
- adjusted_rowspan_cell_index = rowspan_cell_index
390
- row.each_with_index do |tc, tc_index|
391
- if tc.cell_colspan && tc.cell_colspan >= 1
392
- if tc_index < rowspan_cell_index
393
- adjusted_rowspan_cell_index += tc.cell_colspan - 1
394
- end
395
- end
385
+ # adjust tc_index for next cell taking into account current cell's colspan
386
+ tc_index += (tc.cell_colspan && tc.cell_colspan > 0) ? tc.cell_colspan : 1
396
387
  end
397
- adjusted_rowspan_hash[adjusted_rowspan_cell_index] = rowspan_value
398
388
  end
399
-
400
- rowspan_hash = adjusted_rowspan_hash
401
389
  end
402
390
  end
403
-
404
- # don't know why this is needed, but it prevents a
405
- # rendering error.
406
- # render_paragraph(xml, Caracal::Core::Models::ParagraphModel.new)
407
391
  end
408
392
 
409
393
 
@@ -419,23 +403,6 @@ module Caracal
419
403
  opts['mc:Ignorable'] = v
420
404
  end
421
405
  opts
422
- # {
423
- # 'xmlns:mc' => 'http://schemas.openxmlformats.org/markup-compatibility/2006',
424
- # 'xmlns:o' => 'urn:schemas-microsoft-com:office:office',
425
- # 'xmlns:r' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
426
- # 'xmlns:m' => 'http://schemas.openxmlformats.org/officeDocument/2006/math',
427
- # 'xmlns:v' => 'urn:schemas-microsoft-com:vml',
428
- # 'xmlns:wp' => 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing',
429
- # 'xmlns:w10' => 'urn:schemas-microsoft-com:office:word',
430
- # 'xmlns:w' => 'http://schemas.openxmlformats.org/wordprocessingml/2006/main',
431
- # 'xmlns:wne' => 'http://schemas.microsoft.com/office/word/2006/wordml',
432
- # 'xmlns:sl' => 'http://schemas.openxmlformats.org/schemaLibrary/2006/main',
433
- # 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main',
434
- # 'xmlns:pic' => 'http://schemas.openxmlformats.org/drawingml/2006/picture',
435
- # 'xmlns:c' => 'http://schemas.openxmlformats.org/drawingml/2006/chart',
436
- # 'xmlns:lc' => 'http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas',
437
- # 'xmlns:dgm' => 'http://schemas.openxmlformats.org/drawingml/2006/diagram'
438
- # }
439
406
  end
440
407
 
441
408
  def page_margin_options
@@ -1,3 +1,3 @@
1
1
  module Caracal
2
- VERSION = '1.4.0'
2
+ VERSION = '1.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caracal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trade Infomatics
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-31 00:00:00.000000000 Z
12
+ date: 2019-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri