thinreports 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -0
- data/CHANGELOG.md +12 -1
- data/README.md +1 -1
- data/lib/thinreports/basic_report/generator/pdf/document/graphics/attributes.rb +23 -1
- data/lib/thinreports/basic_report/generator/pdf/document/graphics/text.rb +9 -3
- data/lib/thinreports/basic_report/generator/pdf.rb +3 -0
- data/lib/thinreports/version.rb +1 -1
- data/thinreports.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0233a79937eb8039a999b9711cef50a013311af86dd0ccde5ce94559af172235
|
4
|
+
data.tar.gz: 818dab5e4f71506ed895b2480dddfab7df13d042500322b14d68258af1cfaba8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b1a8a8d67828b3fc901d831cc6087b3dccfbc7b120578a8118ae210d782e6064d80406665e5c0911222cf81ee059692235350cde6f3bcad27bd55d27a2f921f
|
7
|
+
data.tar.gz: 8600a21f94a6851e4281c09ff4f3a0eab2db5977f5fa6100770ba6d35e6e29ad46364b0f523298d144d5e4f5006d4349c1af5b1bdaa0d88aef8bfd1926ec52d6
|
data/.github/workflows/test.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,24 @@
|
|
1
1
|
## main (Unreleased)
|
2
2
|
|
3
|
+
## 0.14.1
|
4
|
+
|
5
|
+
Enhancements:
|
6
|
+
|
7
|
+
* Add overflow-wrap option #129
|
8
|
+
|
3
9
|
## 0.14.0
|
4
10
|
|
11
|
+
Breaking Changes:
|
12
|
+
|
5
13
|
* Drop Ruby 2.7 support
|
14
|
+
|
15
|
+
Bug Fixes:
|
16
|
+
|
6
17
|
* Fix LoadError: cannot load such file -- matrix #131
|
7
18
|
|
8
19
|
## 0.13.1
|
9
20
|
|
10
|
-
Bug
|
21
|
+
Bug Fixes:
|
11
22
|
|
12
23
|
* allow title argument to be specified in Report.generate method #127
|
13
24
|
|
data/README.md
CHANGED
@@ -25,6 +25,8 @@ module Thinreports
|
|
25
25
|
# @yieldparam [Hash] attrs
|
26
26
|
# @return [Hash]
|
27
27
|
def build_text_attributes(style, &block)
|
28
|
+
word_wrap = word_wrap(style['word-wrap'])
|
29
|
+
|
28
30
|
text_attributes = {
|
29
31
|
font: font_family(style['font-family']),
|
30
32
|
size: style['font-size'],
|
@@ -35,12 +37,32 @@ module Thinreports
|
|
35
37
|
letter_spacing: letter_spacing(style['letter-spacing']),
|
36
38
|
line_height: line_height(style['line-height']),
|
37
39
|
overflow: text_overflow(style['overflow']),
|
38
|
-
word_wrap: word_wrap
|
40
|
+
word_wrap: word_wrap,
|
41
|
+
# Deprecated: Use overflow_wrap instead of word_wrap
|
42
|
+
overflow_wrap: overflow_wrap(style['overflow-wrap'], word_wrap)
|
39
43
|
}
|
40
44
|
block.call(text_attributes) if block_given?
|
41
45
|
text_attributes
|
42
46
|
end
|
43
47
|
|
48
|
+
def overflow_wrap(style, computed_word_wrap)
|
49
|
+
case style || migrate_overflow_wrap_from_word_wrap(computed_word_wrap)
|
50
|
+
when 'normal', nil then :normal
|
51
|
+
when 'anywhere' then :anywhere
|
52
|
+
# Deprecated: This is a temporary value for migrating from word_wrap.
|
53
|
+
when 'disable-break-word-by-space' then :disable_break_word_by_space
|
54
|
+
else :normal
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def migrate_overflow_wrap_from_word_wrap(computed_word_wrap)
|
59
|
+
case computed_word_wrap
|
60
|
+
when :none then 'disable-break-word-by-space'
|
61
|
+
when :break_word then 'normal'
|
62
|
+
else raise ArgumentError, 'Invalid computed word_wrap value'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
44
66
|
# @param [Array<String>] font_names
|
45
67
|
# @return [String]
|
46
68
|
def font_family(font_names)
|
@@ -23,6 +23,7 @@ module Thinreports
|
|
23
23
|
# @option attrs [Boolean] :single (false)
|
24
24
|
# @option attrs [:trancate, :shrink_to_fit, :expand] :overflow (:trancate)
|
25
25
|
# @option attrs [:none, :break_word] :word_wrap (:none)
|
26
|
+
# @option attrs [:normal, :anywhere, :disable_break_word_by_space] :overflow_wrap (:normal)
|
26
27
|
def text_box(content, x, y, w, h, attrs = {}, &block)
|
27
28
|
w, h = s2f(w, h)
|
28
29
|
|
@@ -32,8 +33,7 @@ module Thinreports
|
|
32
33
|
overflow: attrs[:overflow]
|
33
34
|
)
|
34
35
|
|
35
|
-
|
36
|
-
content = text_without_line_wrap(content) if attrs[:word_wrap] == :none
|
36
|
+
content = replace_space_to_nbsp(content) if attrs[:overflow_wrap] == :disable_break_word_by_space
|
37
37
|
|
38
38
|
with_text_styles(attrs) do |built_attrs, font_styles|
|
39
39
|
if block
|
@@ -112,6 +112,12 @@ module Thinreports
|
|
112
112
|
spacing = attrs.delete(:letter_spacing)
|
113
113
|
attrs[:character_spacing] = s2f(spacing) if spacing
|
114
114
|
|
115
|
+
# Disable line breaking on chars such as spaces and hyphens
|
116
|
+
attrs[:disable_word_break] = true if attrs.delete(:overflow_wrap) == :anywhere
|
117
|
+
|
118
|
+
# Delete unnecessary attributes
|
119
|
+
attrs.delete(:word_wrap)
|
120
|
+
|
115
121
|
# Or... with_font_styles(attrs, fontinfo, &block)
|
116
122
|
with_font_styles(attrs, fontinfo) do |modified_attrs, styles|
|
117
123
|
block.call(modified_attrs, styles)
|
@@ -131,7 +137,7 @@ module Thinreports
|
|
131
137
|
|
132
138
|
# @param [String] content
|
133
139
|
# @return [String]
|
134
|
-
def
|
140
|
+
def replace_space_to_nbsp(content)
|
135
141
|
content.gsub(/ /, Prawn::Text::NBSP)
|
136
142
|
end
|
137
143
|
|
data/lib/thinreports/version.rb
CHANGED
data/thinreports.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thinreports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matsukei Co.,Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: prawn-disable_word_break
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.3.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.3.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rexml
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|