caracal_the_curve 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be5e510b64445fef7d21d07decb6cbcce17afb2d45b001471f86c86087fc1386
|
4
|
+
data.tar.gz: a3f91062398df71f4f7a3b73e083a653819c5fcbab81b1aac09e05d20609e5b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 733cd04f8b4c531dce1c8684c70dd95edd111d9bf4cd0eedc0a46fb918dc05abbe89df84bb2f5dd319a283b8388ba00d14a9b9cc4d162b0381bef4dbdee8770b
|
7
|
+
data.tar.gz: d9f69d624e35438e004cd3e783c5af62aa9b6ad8d5bbd06f4f888c4ea171a89e8530e201d9a95739c12e4d1c006296de0f5499da276efad3d44477238e7e614c
|
@@ -13,6 +13,11 @@ module Caracal
|
|
13
13
|
# Configuration
|
14
14
|
#-------------------------------------------------------------
|
15
15
|
|
16
|
+
# accessors
|
17
|
+
attr_reader :page_width
|
18
|
+
attr_reader :page_margin_left
|
19
|
+
attr_reader :page_margin_right
|
20
|
+
|
16
21
|
# initialization
|
17
22
|
def initialize(options={}, &block)
|
18
23
|
super options, &block
|
@@ -21,6 +26,15 @@ module Caracal
|
|
21
26
|
#-------------------------------------------------------------
|
22
27
|
# Public Methods
|
23
28
|
#-------------------------------------------------------------
|
29
|
+
|
30
|
+
#========== SETTERS ===============================
|
31
|
+
|
32
|
+
# integers
|
33
|
+
[:width, :margin_left, :margin_right].each do |m|
|
34
|
+
define_method "#{ m }" do |value|
|
35
|
+
instance_variable_set("@page_#{ m }", value.to_i)
|
36
|
+
end
|
37
|
+
end
|
24
38
|
|
25
39
|
#=============== DATA ACCESSORS =======================
|
26
40
|
|
@@ -35,6 +49,15 @@ module Caracal
|
|
35
49
|
def valid?
|
36
50
|
contents.size > 0
|
37
51
|
end
|
52
|
+
|
53
|
+
#--------------------------------------------------
|
54
|
+
# Private Instance Methods
|
55
|
+
#--------------------------------------------------
|
56
|
+
private
|
57
|
+
|
58
|
+
def option_keys
|
59
|
+
[:width, :margin_left, :margin_right]
|
60
|
+
end
|
38
61
|
end
|
39
62
|
end
|
40
63
|
end
|
@@ -19,6 +19,15 @@ module Caracal
|
|
19
19
|
def page_flip(*args, &block)
|
20
20
|
options = Caracal::Utilities.extract_options!(args)
|
21
21
|
|
22
|
+
# Pass through the page dimensions from the parent document,
|
23
|
+
# using the page height as the page width, due to it using
|
24
|
+
# the inverse dimensions.
|
25
|
+
options.merge!({
|
26
|
+
width: page_height,
|
27
|
+
margin_left: page_margin_left,
|
28
|
+
margin_right: page_margin_right
|
29
|
+
})
|
30
|
+
|
22
31
|
model = Caracal::Core::Models::PageFlipModel.new(options, &block)
|
23
32
|
|
24
33
|
if model.valid?
|
@@ -367,17 +367,7 @@ module Caracal
|
|
367
367
|
end
|
368
368
|
|
369
369
|
def render_pagebreak(xml, model)
|
370
|
-
|
371
|
-
xml['w'].p paragraph_options do
|
372
|
-
xml['w'].r run_options do
|
373
|
-
xml['w'].br({ 'w:type' => 'page' })
|
374
|
-
end
|
375
|
-
end
|
376
|
-
else
|
377
|
-
xml['w'].r run_options do
|
378
|
-
xml['w'].br({ 'w:type' => 'page' })
|
379
|
-
end
|
380
|
-
end
|
370
|
+
@pagebreak_on_next_paragraph = true
|
381
371
|
end
|
382
372
|
|
383
373
|
def render_paragraph(xml, model)
|
@@ -389,6 +379,10 @@ module Caracal
|
|
389
379
|
xml['w'].contextualSpacing({ 'w:val' => '0' })
|
390
380
|
xml['w'].jc({ 'w:val' => model.paragraph_align }) unless model.paragraph_align.nil?
|
391
381
|
render_run_attributes(xml, model, true)
|
382
|
+
if @pagebreak_on_next_paragraph
|
383
|
+
xml['w'].pageBreakBefore
|
384
|
+
@pagebreak_on_next_paragraph = false
|
385
|
+
end
|
392
386
|
end
|
393
387
|
model.runs.each do |run|
|
394
388
|
method = render_method_for_model(run)
|
data/lib/caracal/version.rb
CHANGED
@@ -18,8 +18,21 @@ describe Caracal::Core::Tables do
|
|
18
18
|
|
19
19
|
it { expect(subject.contents.size).to eq size + 1 }
|
20
20
|
it { expect(subject.contents.last).to be_a(Caracal::Core::Models::TableModel) }
|
21
|
+
it { expect(subject.contents.last.table_width).to be(9360) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.table within a page-flip' do
|
25
|
+
let!(:size) { subject.contents.size }
|
26
|
+
|
27
|
+
before do
|
28
|
+
subject.page_flip do |x|
|
29
|
+
x.table [['Sample Text']]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it { expect(subject.contents.size).to eq size + 1 }
|
34
|
+
it { expect(subject.contents.last.contents.first).to be_a(Caracal::Core::Models::TableModel) }
|
35
|
+
it { expect(subject.contents.last.contents.first.table_width).to be(12960) }
|
21
36
|
end
|
22
|
-
|
23
37
|
end
|
24
|
-
|
25
|
-
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caracal_the_curve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trade Infomatics
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-
|
14
|
+
date: 2024-04-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: nokogiri
|