caracal_the_curve 1.4.8 → 1.4.9
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 +4 -4
- data/lib/caracal/core/models/link_model.rb +1 -0
- data/lib/caracal/core/models/text_model.rb +5 -3
- data/lib/caracal/renderers/document_renderer.rb +10 -9
- data/lib/caracal/version.rb +1 -1
- data/spec/lib/caracal/core/models/link_model_spec.rb +9 -2
- data/spec/lib/caracal/core/models/text_model_spec.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5aafcb5cfbb5329a9a880561d1228acdba16fc075e74733b1877a3e0fc06481c
|
|
4
|
+
data.tar.gz: 5024f48ec32f458c72fa2df5a62befe96277fd6eebcefd2707d61890784623a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6015710b54e023278f2633965a389d775dfd2e89b7137a827f53b4fe39f2f445532af5069b0a0dec6c68f70f66d3417e37079b5e2ead50aab9b28fbaeebe205
|
|
7
|
+
data.tar.gz: cec5b30f033cb32fa3f271aea84d3852b9c27b7c8e144b03af2ecfb94ddc8af8b6a624eaefe3fcf1cc9129846a0103f675a23beb13f8949448cdf7a2b5d8f13a
|
|
@@ -32,6 +32,7 @@ module Caracal
|
|
|
32
32
|
alias_method :link_bgcolor, :text_bgcolor
|
|
33
33
|
alias_method :link_highlight_color, :text_highlight_color
|
|
34
34
|
alias_method :link_vertical_align, :text_vertical_align
|
|
35
|
+
alias_method :link_rotate, :text_rotate
|
|
35
36
|
|
|
36
37
|
# initialization
|
|
37
38
|
def initialize(options={}, &block)
|
|
@@ -26,6 +26,7 @@ module Caracal
|
|
|
26
26
|
attr_reader :text_bgcolor
|
|
27
27
|
attr_reader :text_highlight_color
|
|
28
28
|
attr_reader :text_vertical_align
|
|
29
|
+
attr_reader :text_rotate
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
|
|
@@ -47,7 +48,8 @@ module Caracal
|
|
|
47
48
|
underline: text_underline,
|
|
48
49
|
bgcolor: text_bgcolor,
|
|
49
50
|
highlight_color: text_highlight_color,
|
|
50
|
-
vertical_align: text_vertical_align
|
|
51
|
+
vertical_align: text_vertical_align,
|
|
52
|
+
rotate: text_rotate
|
|
51
53
|
}
|
|
52
54
|
end
|
|
53
55
|
|
|
@@ -55,7 +57,7 @@ module Caracal
|
|
|
55
57
|
#========== SETTERS ===============================
|
|
56
58
|
|
|
57
59
|
# booleans
|
|
58
|
-
[:bold, :italic, :underline].each do |m|
|
|
60
|
+
[:bold, :italic, :underline, :rotate].each do |m|
|
|
59
61
|
define_method "#{ m }" do |value|
|
|
60
62
|
instance_variable_set("@text_#{ m }", !!value)
|
|
61
63
|
end
|
|
@@ -97,7 +99,7 @@ module Caracal
|
|
|
97
99
|
private
|
|
98
100
|
|
|
99
101
|
def option_keys
|
|
100
|
-
[:content, :style, :font, :color, :size, :bold, :italic, :underline, :bgcolor, :highlight_color, :vertical_align]
|
|
102
|
+
[:content, :style, :font, :color, :size, :bold, :italic, :underline, :bgcolor, :highlight_color, :vertical_align, :rotate]
|
|
101
103
|
end
|
|
102
104
|
|
|
103
105
|
def method_missing(method, *args, &block)
|
|
@@ -76,15 +76,16 @@ module Caracal
|
|
|
76
76
|
else
|
|
77
77
|
xml['w'].rPr do
|
|
78
78
|
unless attrs.empty?
|
|
79
|
-
xml['w'].rStyle(
|
|
80
|
-
xml['w'].color(
|
|
81
|
-
xml['w'].sz(
|
|
82
|
-
xml['w'].b(
|
|
83
|
-
xml['w'].i(
|
|
84
|
-
xml['w'].u(
|
|
85
|
-
xml['w'].shd(
|
|
86
|
-
xml['w'].highlight(
|
|
87
|
-
xml['w'].vertAlign(
|
|
79
|
+
xml['w'].rStyle( { 'w:val' => attrs[:style] }) unless attrs[:style].nil?
|
|
80
|
+
xml['w'].color( { 'w:val' => attrs[:color] }) unless attrs[:color].nil?
|
|
81
|
+
xml['w'].sz( { 'w:val' => attrs[:size] }) unless attrs[:size].nil?
|
|
82
|
+
xml['w'].b( { 'w:val' => (attrs[:bold] ? '1' : '0') }) unless attrs[:bold].nil?
|
|
83
|
+
xml['w'].i( { 'w:val' => (attrs[:italic] ? '1' : '0') }) unless attrs[:italic].nil?
|
|
84
|
+
xml['w'].u( { 'w:val' => (attrs[:underline] ? 'single' : 'none') }) unless attrs[:underline].nil?
|
|
85
|
+
xml['w'].shd( { 'w:fill' => attrs[:bgcolor], 'w:val' => 'clear' }) unless attrs[:bgcolor].nil?
|
|
86
|
+
xml['w'].highlight( { 'w:val' => attrs[:highlight_color] }) unless attrs[:highlight_color].nil?
|
|
87
|
+
xml['w'].vertAlign( { 'w:val' => attrs[:vertical_align] }) unless attrs[:vertical_align].nil?
|
|
88
|
+
xml['w'].eastAsianLayout( { 'w:vert' => attrs[:rotate] }) unless attrs[:rotate].nil?
|
|
88
89
|
unless attrs[:font].nil?
|
|
89
90
|
f = attrs[:font]
|
|
90
91
|
xml['w'].rFonts( { 'w:ascii' => f, 'w:hAnsi' => f, 'w:eastAsia' => f, 'w:cs' => f })
|
data/lib/caracal/version.rb
CHANGED
|
@@ -15,6 +15,7 @@ describe Caracal::Core::Models::LinkModel do
|
|
|
15
15
|
bgcolor 'cccccc'
|
|
16
16
|
highlight_color 'yellow'
|
|
17
17
|
vertical_align :top
|
|
18
|
+
rotate true
|
|
18
19
|
end
|
|
19
20
|
end
|
|
20
21
|
|
|
@@ -44,6 +45,7 @@ describe Caracal::Core::Models::LinkModel do
|
|
|
44
45
|
it { expect(subject.link_bgcolor).to eq 'cccccc' }
|
|
45
46
|
it { expect(subject.link_highlight_color).to eq 'yellow' }
|
|
46
47
|
it { expect(subject.link_vertical_align).to eq :top }
|
|
48
|
+
it { expect(subject.link_rotate).to eq true }
|
|
47
49
|
end
|
|
48
50
|
|
|
49
51
|
end
|
|
@@ -59,7 +61,7 @@ describe Caracal::Core::Models::LinkModel do
|
|
|
59
61
|
|
|
60
62
|
# .run_attributes
|
|
61
63
|
describe '.run_attributes' do
|
|
62
|
-
let(:expected) { { style: nil, font: 'Courier New', color: '666666', size: 20, bold: false, italic: false, underline: true, bgcolor: 'cccccc', highlight_color: 'yellow', vertical_align: :top } }
|
|
64
|
+
let(:expected) { { style: nil, font: 'Courier New', color: '666666', size: 20, bold: false, italic: false, underline: true, bgcolor: 'cccccc', highlight_color: 'yellow', vertical_align: :top, rotate: true } }
|
|
63
65
|
|
|
64
66
|
it { expect(subject.run_attributes).to eq expected }
|
|
65
67
|
end
|
|
@@ -88,6 +90,11 @@ describe Caracal::Core::Models::LinkModel do
|
|
|
88
90
|
|
|
89
91
|
it { expect(subject.link_underline).to eq true }
|
|
90
92
|
end
|
|
93
|
+
describe '.rotate' do
|
|
94
|
+
before { subject.underline(true) }
|
|
95
|
+
|
|
96
|
+
it { expect(subject.link_rotate).to eq true }
|
|
97
|
+
end
|
|
91
98
|
|
|
92
99
|
# integers
|
|
93
100
|
describe '.size' do
|
|
@@ -169,7 +176,7 @@ describe Caracal::Core::Models::LinkModel do
|
|
|
169
176
|
# .option_keys
|
|
170
177
|
describe '.option_keys' do
|
|
171
178
|
let(:actual) { subject.send(:option_keys).sort }
|
|
172
|
-
let(:expected) { [:content, :href, :internal, :style, :font, :color, :size, :bold, :highlight_color, :italic, :underline, :bgcolor, :vertical_align].sort }
|
|
179
|
+
let(:expected) { [:content, :href, :internal, :style, :font, :color, :size, :bold, :highlight_color, :italic, :underline, :bgcolor, :vertical_align, :rotate].sort }
|
|
173
180
|
|
|
174
181
|
it { expect(actual).to eq expected }
|
|
175
182
|
end
|
|
@@ -13,6 +13,7 @@ describe Caracal::Core::Models::TextModel do
|
|
|
13
13
|
bgcolor 'cccccc'
|
|
14
14
|
vertical_align :subscript
|
|
15
15
|
highlight_color 'yellow'
|
|
16
|
+
rotate true
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
|
|
@@ -34,6 +35,7 @@ describe Caracal::Core::Models::TextModel do
|
|
|
34
35
|
it { expect(subject.text_bgcolor).to eq 'cccccc' }
|
|
35
36
|
it { expect(subject.text_highlight_color).to eq 'yellow' }
|
|
36
37
|
it { expect(subject.text_vertical_align).to eq :subscript }
|
|
38
|
+
it { expect(subject.text_rotate).to eq true }
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
end
|
|
@@ -49,7 +51,7 @@ describe Caracal::Core::Models::TextModel do
|
|
|
49
51
|
|
|
50
52
|
# .run_attributes
|
|
51
53
|
describe '.run_attributes' do
|
|
52
|
-
let(:expected) { { style: nil, font: 'Courier New', color: '666666', size: 20, bold: false, italic: false, underline: true, bgcolor: 'cccccc', highlight_color: 'yellow', vertical_align: :subscript } }
|
|
54
|
+
let(:expected) { { style: nil, font: 'Courier New', color: '666666', size: 20, bold: false, italic: false, underline: true, bgcolor: 'cccccc', highlight_color: 'yellow', vertical_align: :subscript, rotate: true } }
|
|
53
55
|
|
|
54
56
|
it { expect(subject.run_attributes).to eq expected }
|
|
55
57
|
end
|
|
@@ -73,6 +75,11 @@ describe Caracal::Core::Models::TextModel do
|
|
|
73
75
|
|
|
74
76
|
it { expect(subject.text_underline).to eq true }
|
|
75
77
|
end
|
|
78
|
+
describe '.rotate' do
|
|
79
|
+
before { subject.rotate(true) }
|
|
80
|
+
|
|
81
|
+
it { expect(subject.text_rotate).to eq true }
|
|
82
|
+
end
|
|
76
83
|
|
|
77
84
|
# integers
|
|
78
85
|
describe '.size' do
|
|
@@ -144,7 +151,7 @@ describe Caracal::Core::Models::TextModel do
|
|
|
144
151
|
# .option_keys
|
|
145
152
|
describe '.option_keys' do
|
|
146
153
|
let(:actual) { subject.send(:option_keys).sort }
|
|
147
|
-
let(:expected) { [:bgcolor, :bold, :color, :content, :font, :highlight_color, :italic, :size, :style, :underline, :vertical_align].sort }
|
|
154
|
+
let(:expected) { [:bgcolor, :bold, :color, :content, :font, :highlight_color, :italic, :size, :style, :underline, :vertical_align, :rotate].sort }
|
|
148
155
|
|
|
149
156
|
it { expect(actual).to eq expected }
|
|
150
157
|
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.9
|
|
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: 2025-
|
|
14
|
+
date: 2025-09-23 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: nokogiri
|