thinreports 0.10.2 → 0.12.1
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/.github/CONTRIBUTING.md +2 -2
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/test.yml +50 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +43 -0
- data/Gemfile +2 -1
- data/{MIT-LICENSE → LICENSE.txt} +2 -0
- data/README.md +70 -56
- data/Rakefile +12 -25
- data/gemfiles/prawn-2.2.gemfile +5 -0
- data/gemfiles/prawn-2.3.gemfile +5 -0
- data/gemfiles/prawn-2.4.gemfile +5 -0
- data/lib/thinreports/core/shape/basic/format.rb +5 -0
- data/lib/thinreports/core/shape/image_block.rb +1 -1
- data/lib/thinreports/core/shape/list.rb +1 -1
- data/lib/thinreports/core/shape/page_number.rb +1 -1
- data/lib/thinreports/core/shape/stack_view/format.rb +27 -0
- data/lib/thinreports/core/shape/stack_view/interface.rb +17 -0
- data/lib/thinreports/core/shape/stack_view/internal.rb +22 -0
- data/lib/thinreports/core/shape/stack_view/row_format.rb +39 -0
- data/lib/thinreports/core/shape/stack_view.rb +17 -0
- data/lib/thinreports/core/shape/style/basic.rb +4 -1
- data/lib/thinreports/core/shape/text.rb +1 -1
- data/lib/thinreports/core/shape/text_block/formatter/number.rb +6 -1
- data/lib/thinreports/core/shape/text_block/internal.rb +0 -2
- data/lib/thinreports/core/shape/text_block.rb +1 -1
- data/lib/thinreports/core/shape.rb +2 -0
- data/lib/thinreports/generate.rb +11 -0
- data/lib/thinreports/generator/pdf/document/draw_shape.rb +31 -10
- data/lib/thinreports/generator/pdf/document/draw_template_items.rb +1 -1
- data/lib/thinreports/generator/pdf/document/graphics/image.rb +19 -1
- data/lib/thinreports/generator/pdf/document/graphics/text.rb +10 -5
- data/lib/thinreports/generator/pdf/document/page.rb +12 -0
- data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +7 -7
- data/lib/thinreports/layout/base.rb +1 -1
- data/lib/thinreports/layout/legacy_schema.rb +1 -0
- data/lib/thinreports/layout/version.rb +1 -1
- data/lib/thinreports/report/internal.rb +2 -0
- data/lib/thinreports/report.rb +2 -2
- data/lib/thinreports/section_report/build.rb +32 -0
- data/lib/thinreports/section_report/builder/item_builder.rb +49 -0
- data/lib/thinreports/section_report/builder/report_builder.rb +82 -0
- data/lib/thinreports/section_report/builder/report_data.rb +13 -0
- data/lib/thinreports/section_report/builder/stack_view_builder.rb +53 -0
- data/lib/thinreports/section_report/builder/stack_view_data.rb +11 -0
- data/lib/thinreports/section_report/generate.rb +26 -0
- data/lib/thinreports/section_report/pdf/render.rb +23 -0
- data/lib/thinreports/section_report/pdf/renderer/draw_item.rb +68 -0
- data/lib/thinreports/section_report/pdf/renderer/group_renderer.rb +57 -0
- data/lib/thinreports/section_report/pdf/renderer/section_height.rb +100 -0
- data/lib/thinreports/section_report/pdf/renderer/section_renderer.rb +39 -0
- data/lib/thinreports/section_report/pdf/renderer/stack_view_renderer.rb +55 -0
- data/lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb +38 -0
- data/lib/thinreports/section_report/schema/loader.rb +28 -0
- data/lib/thinreports/section_report/schema/parser.rb +52 -0
- data/lib/thinreports/section_report/schema/report.rb +30 -0
- data/lib/thinreports/section_report/schema/section.rb +47 -0
- data/lib/thinreports/version.rb +1 -1
- data/lib/thinreports.rb +5 -0
- data/thinreports.gemspec +11 -10
- metadata +48 -150
- data/.travis.yml +0 -16
- data/examples/character_spacing/character_spacing.rb +0 -8
- data/examples/character_spacing/character_spacing.tlf +0 -293
- data/examples/dynamic_image/dynamic_image.rb +0 -31
- data/examples/dynamic_image/dynamic_image.tlf +0 -661
- data/examples/dynamic_image/img200x100.png +0 -0
- data/examples/dynamic_image/img50x50.png +0 -0
- data/examples/dynamic_style/dynamic_style.rb +0 -150
- data/examples/dynamic_style/dynamic_style.tlf +0 -1835
- data/examples/dynamic_style/dynamic_style_in_list.tlf +0 -344
- data/examples/dynamic_style/image.png +0 -0
- data/examples/eudc/eudc.rb +0 -20
- data/examples/eudc/eudc.tlf +0 -180
- data/examples/eudc/eudc.ttf +0 -0
- data/examples/helper.rb +0 -50
- data/examples/hidden_shapes/hidden_shapes.rb +0 -9
- data/examples/hidden_shapes/hidden_shapes.tlf +0 -449
- data/examples/list_events/list_events.rb +0 -32
- data/examples/list_events/list_events.tlf +0 -361
- data/examples/list_manual_generation/list_manual_generation.rb +0 -22
- data/examples/list_manual_generation/list_manual_generation.tlf +0 -132
- data/examples/list_page_number/list_page_number.rb +0 -17
- data/examples/list_page_number/list_page_number.tlf +0 -254
- data/examples/page_number/page_number.rb +0 -33
- data/examples/page_number/page_number.tlf +0 -215
- data/examples/palleted_png/palleted_png.png +0 -0
- data/examples/palleted_png/palleted_png.rb +0 -9
- data/examples/palleted_png/palleted_png.tlf +0 -47
- data/examples/password_setting/password_setting.rb +0 -10
- data/examples/password_setting/password_setting.tlf +0 -45
- data/examples/report_callbacks/report_callbacks.rb +0 -14
- data/examples/report_callbacks/report_callbacks.tlf +0 -147
- data/examples/single_line_tblock/single_line_tblock.rb +0 -13
- data/examples/single_line_tblock/single_line_tblock.tlf +0 -170
- data/examples/tblock_overflow/tblock_overflow.rb +0 -20
- data/examples/tblock_overflow/tblock_overflow.tlf +0 -538
- data/examples/tblock_styles/font_size.tlf +0 -383
- data/examples/tblock_styles/tblock_styles.rb +0 -43
- data/examples/tblock_styles/tblock_styles.tlf +0 -889
- data/examples/text_align/text_align.rb +0 -8
- data/examples/text_align/text_align.tlf +0 -241
- data/examples/typeB_page_size/B4_ISO.tlf +0 -45
- data/examples/typeB_page_size/B4_JIS.tlf +0 -45
- data/examples/typeB_page_size/typeB_page_size.rb +0 -17
- data/examples/word_wrap/word_wrap.rb +0 -26
- data/examples/word_wrap/word_wrap.tlf +0 -297
- data/test/data/font.ttf +0 -0
- data/test/data/image_normal.jpg +0 -0
- data/test/data/image_normal.png +0 -0
- data/test/data/image_normal_jpg_noext +0 -0
- data/test/data/image_normal_png_noext +0 -0
- data/test/data/image_pallete_based.png +0 -0
- data/test/data/legacy_layout/all-items.tlf +0 -1
- data/test/schema_helper.rb +0 -122
- data/test/test_helper.rb +0 -48
- data/test/tmp/.gitkeep +0 -0
- data/test/unit/core/format/test_base.rb +0 -152
- data/test/unit/core/shape/base/test_internal.rb +0 -87
- data/test/unit/core/shape/basic/test_block_format.rb +0 -23
- data/test/unit/core/shape/basic/test_block_interface.rb +0 -29
- data/test/unit/core/shape/basic/test_block_internal.rb +0 -55
- data/test/unit/core/shape/basic/test_format.rb +0 -37
- data/test/unit/core/shape/basic/test_interface.rb +0 -108
- data/test/unit/core/shape/basic/test_internal.rb +0 -55
- data/test/unit/core/shape/image_block/test_interface.rb +0 -24
- data/test/unit/core/shape/image_block/test_internal.rb +0 -31
- data/test/unit/core/shape/list/test_format.rb +0 -111
- data/test/unit/core/shape/list/test_manager.rb +0 -67
- data/test/unit/core/shape/list/test_page.rb +0 -156
- data/test/unit/core/shape/list/test_page_state.rb +0 -31
- data/test/unit/core/shape/list/test_section_format.rb +0 -36
- data/test/unit/core/shape/list/test_section_interface.rb +0 -75
- data/test/unit/core/shape/list/test_section_internal.rb +0 -50
- data/test/unit/core/shape/manager/test_format.rb +0 -38
- data/test/unit/core/shape/manager/test_internal.rb +0 -132
- data/test/unit/core/shape/manager/test_target.rb +0 -140
- data/test/unit/core/shape/page_number/test_format.rb +0 -55
- data/test/unit/core/shape/page_number/test_interface.rb +0 -33
- data/test/unit/core/shape/page_number/test_internal.rb +0 -81
- data/test/unit/core/shape/styles/test_base.rb +0 -191
- data/test/unit/core/shape/styles/test_basic.rb +0 -24
- data/test/unit/core/shape/styles/test_graphic.rb +0 -50
- data/test/unit/core/shape/styles/test_text.rb +0 -97
- data/test/unit/core/shape/text/test_format.rb +0 -44
- data/test/unit/core/shape/text/test_internal.rb +0 -20
- data/test/unit/core/shape/text_block/formatter/test_basic.rb +0 -24
- data/test/unit/core/shape/text_block/formatter/test_datetime.rb +0 -49
- data/test/unit/core/shape/text_block/formatter/test_number.rb +0 -76
- data/test/unit/core/shape/text_block/formatter/test_padding.rb +0 -77
- data/test/unit/core/shape/text_block/test_format.rb +0 -169
- data/test/unit/core/shape/text_block/test_formatter.rb +0 -28
- data/test/unit/core/shape/text_block/test_interface.rb +0 -63
- data/test/unit/core/shape/text_block/test_internal.rb +0 -128
- data/test/unit/core/test_shape.rb +0 -52
- data/test/unit/core/test_utils.rb +0 -68
- data/test/unit/generator/pdf/document/graphics/test_attributes.rb +0 -135
- data/test/unit/generator/pdf/document/graphics/test_basic.rb +0 -46
- data/test/unit/generator/pdf/document/graphics/test_image.rb +0 -46
- data/test/unit/generator/pdf/document/graphics/test_text.rb +0 -171
- data/test/unit/generator/pdf/document/test_font.rb +0 -110
- data/test/unit/generator/pdf/document/test_graphics.rb +0 -42
- data/test/unit/generator/pdf/document/test_page.rb +0 -122
- data/test/unit/generator/pdf/document/test_parse_color.rb +0 -30
- data/test/unit/generator/pdf/prawn_ext/test_calc_image_dimensions.rb +0 -41
- data/test/unit/generator/pdf/prawn_ext/test_width_of.rb +0 -22
- data/test/unit/generator/pdf/test_document.rb +0 -22
- data/test/unit/generator/test_pdf.rb +0 -26
- data/test/unit/layout/test_base.rb +0 -41
- data/test/unit/layout/test_format.rb +0 -100
- data/test/unit/layout/test_legacy_schema.rb +0 -574
- data/test/unit/layout/test_version.rb +0 -26
- data/test/unit/report/test_base.rb +0 -248
- data/test/unit/report/test_internal.rb +0 -206
- data/test/unit/test_config.rb +0 -36
- data/test/unit/test_layout.rb +0 -12
- data/test/unit/test_report.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3abf53b7bac12b336d4ef9b4af7dd4400081eeb632f8ece362e60f6cca47c2b4
|
|
4
|
+
data.tar.gz: 4461aca74ccae200d234715a06bbc60e753a7694053116c58ef2d031b8f01047
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ebae61bcd5ce2524bc8c09eff3f2fa047de632a250dfce9390a4db78b806d945ed32ea563c1063836d938e139b433b53c595592ec741a3a0c719bb74d7ffb1b
|
|
7
|
+
data.tar.gz: ef7d77b8edaf345b546cc42bb4f2ac98d23e2e74fe62921a181976ff38f11c6f4a6ef875ede3bcb40dfd0fa02ddc42cfe532df7c7bad633efe4f8cfd056a32ca
|
data/.github/CONTRIBUTING.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
If you have a support question about how to use thinreports, please [ask on
|
|
1
|
+
We only accept bug reports and pull requests in GitHub.
|
|
2
|
+
If you have a support question about how to use thinreports, please [ask on GitHub Discussions](https://github.com/thinreports/thinreports/discussions).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "bundler"
|
|
9
|
+
directory: "/"
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "daily"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
name: Test against ruby ${{ matrix.ruby }} and prawn ${{ matrix.prawn }}
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
# Run this build only on either pull request or push.
|
|
10
|
+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
|
11
|
+
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
ruby:
|
|
15
|
+
- 2.5
|
|
16
|
+
- 2.6
|
|
17
|
+
- 2.7
|
|
18
|
+
- 3.0
|
|
19
|
+
- jruby
|
|
20
|
+
prawn:
|
|
21
|
+
- 2.2
|
|
22
|
+
- 2.3
|
|
23
|
+
- 2.4
|
|
24
|
+
exclude:
|
|
25
|
+
- ruby: 3.0
|
|
26
|
+
prawn: 2.2
|
|
27
|
+
- ruby: 3.0
|
|
28
|
+
prawn: 2.3
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v2
|
|
32
|
+
|
|
33
|
+
- uses: hidakatsuya/setup-diff-pdf@v1
|
|
34
|
+
with:
|
|
35
|
+
diff-pdf-version: 0.5
|
|
36
|
+
|
|
37
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
|
38
|
+
uses: ruby/setup-ruby@v1
|
|
39
|
+
with:
|
|
40
|
+
ruby-version: ${{ matrix.ruby }}
|
|
41
|
+
|
|
42
|
+
- name: Install dependencies
|
|
43
|
+
run: |
|
|
44
|
+
gem install bundler
|
|
45
|
+
bundle install --gemfile gemfiles/prawn-${{ matrix.prawn }}.gemfile --jobs 4 --retry 3
|
|
46
|
+
|
|
47
|
+
- name: Run tests
|
|
48
|
+
run: |
|
|
49
|
+
bundle exec rake test:units
|
|
50
|
+
bundle exec rake test:features
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
## master (Unreleased)
|
|
2
|
+
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
Bug Fixes:
|
|
6
|
+
|
|
7
|
+
* Fix argument of Thinreports::Report.generate in Ruby 3.0 #116 [@sada]
|
|
8
|
+
|
|
9
|
+
## 0.12.0
|
|
10
|
+
|
|
11
|
+
Breaking Changes:
|
|
12
|
+
|
|
13
|
+
* Drop Ruby 2.4 support #108, #109
|
|
14
|
+
|
|
15
|
+
Enhancements:
|
|
16
|
+
|
|
17
|
+
* Ruby 3.0 support #108, #109
|
|
18
|
+
* Prawn 2.4 support #108, #109
|
|
19
|
+
|
|
20
|
+
## 0.11.0
|
|
21
|
+
|
|
22
|
+
Breaking Changes:
|
|
23
|
+
|
|
24
|
+
* Dropped Ruby 2.1 support
|
|
25
|
+
* Dropped Ruby 2.2 support
|
|
26
|
+
* Dropped Ruby 2.3 support
|
|
27
|
+
* Formatter of a text-block works even with multiple-line (#95)
|
|
28
|
+
|
|
29
|
+
Enhancements:
|
|
30
|
+
|
|
31
|
+
* Ruby 2.7.0 support
|
|
32
|
+
* Support Pathname layout option on `Thinreports::Report` #99 [@meganemura]
|
|
33
|
+
|
|
34
|
+
Bug Fixes:
|
|
35
|
+
|
|
36
|
+
* Fixed: thousands separation is applied to decimal part #95
|
|
37
|
+
|
|
38
|
+
## 0.10.3
|
|
39
|
+
|
|
40
|
+
Bug Fixes:
|
|
41
|
+
|
|
42
|
+
* Fixed: corner-radius of Rect is not applied correctly #93
|
|
43
|
+
|
|
1
44
|
## 0.10.2
|
|
2
45
|
|
|
3
46
|
Bug Fixes:
|
data/Gemfile
CHANGED
data/{MIT-LICENSE → LICENSE.txt}
RENAMED
data/README.md
CHANGED
|
@@ -1,34 +1,46 @@
|
|
|
1
1
|
# Thinreports Generator
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/thinreports)
|
|
4
|
-
[](https://codeclimate.com/github/thinreports/thinreports-generator/maintainability)
|
|
6
|
-
[](https://gemnasium.com/thinreports/thinreports-generator)
|
|
4
|
+
[](https://github.com/thinreports/thinreports-generator/actions)
|
|
7
5
|
|
|
8
|
-
[Thinreports](
|
|
6
|
+
A Ruby library for [Thinreports](https://github.com/thinreports/thinreports).
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
* Thinreports Generator (Report Generator for Ruby)
|
|
8
|
+
## Prerequisites
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
### Supported Versions
|
|
11
|
+
|
|
12
|
+
- Ruby 2.5, 2.6, 2.7, 3.0
|
|
13
|
+
- JRuby 9.2
|
|
14
|
+
- Prawn 2.2, 2.3, 2.4
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Add this line to your application's Gemfile:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
gem 'thinreports'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
And then execute:
|
|
25
|
+
|
|
26
|
+
$ bundle install
|
|
14
27
|
|
|
15
|
-
|
|
16
|
-
* [Quick Start Guide](http://www.thinreports.org/documentation/getting-started/quickstart.html)
|
|
17
|
-
* [Examples](https://github.com/thinreports/thinreports-examples)
|
|
18
|
-
* [Rails5 Example](https://github.com/thinreports/thinreports-rails5-example)
|
|
19
|
-
* [Changelog](https://github.com/thinreports/thinreports-generator/blob/master/CHANGELOG.md)
|
|
20
|
-
* [Discussion Group](https://groups.google.com/forum/#!forum/thinreports)
|
|
28
|
+
Or install it yourself as:
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
$ gem install thinreports
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Getting Started
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
* JRuby 9.1.15.0
|
|
35
|
+
First of all, check out [the README](https://github.com/thinreports/thinreports#getting-started) for an overview of Thinreports, its features, the two template formats available, and a complete example with template files and Ruby code.
|
|
26
36
|
|
|
27
|
-
##
|
|
37
|
+
## Usage
|
|
28
38
|
|
|
29
|
-
|
|
39
|
+
See [the README](https://github.com/thinreports/thinreports) for usage of the Section Format.
|
|
30
40
|
|
|
31
|
-
### Basic
|
|
41
|
+
### Basic Format
|
|
42
|
+
|
|
43
|
+
The template file (`.tlf`) must be created in [the Basic Editor of the Thinreports Editor](https://github.com/thinreports/thinreports-editor/tree/master/basic-editor).
|
|
32
44
|
|
|
33
45
|
```ruby
|
|
34
46
|
require 'thinreports'
|
|
@@ -103,7 +115,7 @@ Thinreports::Report.generate(filename: 'report.pdf', layout: 'report.tlf') do |r
|
|
|
103
115
|
end
|
|
104
116
|
```
|
|
105
117
|
|
|
106
|
-
|
|
118
|
+
#### Report and Page
|
|
107
119
|
|
|
108
120
|
```ruby
|
|
109
121
|
report = Thinreports::Report.new layout: 'foo.tlf'
|
|
@@ -121,7 +133,7 @@ report.add_blank_page
|
|
|
121
133
|
report.pages.last # => Report::BlankPage
|
|
122
134
|
```
|
|
123
135
|
|
|
124
|
-
|
|
136
|
+
#### Using multiple layouts
|
|
125
137
|
|
|
126
138
|
```ruby
|
|
127
139
|
report = Thinreports::Report.new
|
|
@@ -142,7 +154,7 @@ report.start_new_page layout: '/path/to/other2.tlf' do |page|
|
|
|
142
154
|
end
|
|
143
155
|
```
|
|
144
156
|
|
|
145
|
-
|
|
157
|
+
#### Callbacks
|
|
146
158
|
|
|
147
159
|
```ruby
|
|
148
160
|
report = Thinreports::Report.new layout: 'foo.tlf'
|
|
@@ -153,9 +165,9 @@ report.on_page_create do |page|
|
|
|
153
165
|
end
|
|
154
166
|
```
|
|
155
167
|
|
|
156
|
-
See also [
|
|
168
|
+
See also [features/report_callbacks](https://github.com/thinreports/thinreports-generator/tree/master/test/features/report_callbacks).
|
|
157
169
|
|
|
158
|
-
|
|
170
|
+
#### List
|
|
159
171
|
|
|
160
172
|
```ruby
|
|
161
173
|
report = Thinreports::Report.new layout: 'list.tlf'
|
|
@@ -202,9 +214,9 @@ report.list do |list|
|
|
|
202
214
|
end
|
|
203
215
|
```
|
|
204
216
|
|
|
205
|
-
See also [
|
|
217
|
+
See also [features/list_events](https://github.com/thinreports/thinreports-generator/tree/master/test/features/list_events).
|
|
206
218
|
|
|
207
|
-
|
|
219
|
+
#### Page Number
|
|
208
220
|
|
|
209
221
|
```ruby
|
|
210
222
|
# Setting starting number of page
|
|
@@ -223,9 +235,9 @@ report.start_new_page do |page|
|
|
|
223
235
|
end
|
|
224
236
|
```
|
|
225
237
|
|
|
226
|
-
See also [
|
|
238
|
+
See also [features/page_number](https://github.com/thinreports/thinreports-generator/blob/master/test/features/page_number) and [features/page_number_with_list](https://github.com/thinreports/thinreports-generator/blob/master/test/features/page_number_with_list).
|
|
227
239
|
|
|
228
|
-
|
|
240
|
+
#### Configuring fallback fonts
|
|
229
241
|
|
|
230
242
|
```ruby
|
|
231
243
|
Thinreports.configure do |config|
|
|
@@ -235,51 +247,53 @@ end
|
|
|
235
247
|
Thinreports.config.fallback_fonts = ['/path/to/font_a.ttf', '/path/to/font_b.ttf']
|
|
236
248
|
```
|
|
237
249
|
|
|
238
|
-
See also [
|
|
239
|
-
|
|
240
|
-
## Features
|
|
241
|
-
|
|
242
|
-
Features of Editor is [here](http://www.thinreports.org/features/editor/).
|
|
250
|
+
See also [features/eudc](https://github.com/thinreports/thinreports-generator/blob/master/test/features/eudc).
|
|
243
251
|
|
|
244
|
-
|
|
252
|
+
## Contributing
|
|
245
253
|
|
|
246
|
-
|
|
254
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/thinreports/thinreports-generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/thinreports/thinreports/blob/master/CODE_OF_CONDUCT.md).
|
|
247
255
|
|
|
248
|
-
|
|
256
|
+
## Development
|
|
249
257
|
|
|
250
|
-
|
|
258
|
+
### How to run feature tests
|
|
251
259
|
|
|
252
|
-
|
|
260
|
+
```
|
|
261
|
+
$ bundle exec rake test:features
|
|
262
|
+
```
|
|
253
263
|
|
|
254
|
-
|
|
264
|
+
In order to run `test:features`, you need to install [diff-pdf](https://github.com/vslavik/diff-pdf) in your environment, or you can run test in the docker container as below.
|
|
255
265
|
|
|
256
|
-
|
|
257
|
-
* change style (border, fill, visibility, position, color, font) of Shape
|
|
266
|
+
### How to develop in Docker container
|
|
258
267
|
|
|
259
|
-
|
|
268
|
+
You can use the Docker container for development. This container contains the libraries required for testing, such as diff-pdf.
|
|
260
269
|
|
|
261
|
-
|
|
270
|
+
```
|
|
271
|
+
$ docker pull ghcr.io/hidakatsuya/ruby-with-diff-pdf:latest
|
|
272
|
+
$ docker run -v $PWD:/src:cached -it ghcr.io/hidakatsuya/ruby-with-diff-pdf bash
|
|
262
273
|
|
|
263
|
-
|
|
274
|
+
> /src#
|
|
275
|
+
```
|
|
264
276
|
|
|
265
|
-
|
|
277
|
+
You can run test:
|
|
266
278
|
|
|
267
|
-
|
|
279
|
+
```
|
|
280
|
+
> /src# bundle install
|
|
281
|
+
> /src# bundle exec rake test:features
|
|
282
|
+
```
|
|
268
283
|
|
|
269
|
-
|
|
284
|
+
## Releasing Generator
|
|
270
285
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
7. Create new Pull Request
|
|
286
|
+
1. Update the version number in `version.rb`
|
|
287
|
+
2. Update `CHANGELOG.md` and `README.md` (if needed)
|
|
288
|
+
3. Create the Release PR like #105
|
|
289
|
+
4. Merge the PR
|
|
290
|
+
5. Is the master CI green? If not, make it green
|
|
291
|
+
6. Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to rubygems.org
|
|
278
292
|
|
|
279
293
|
## License
|
|
280
294
|
|
|
281
|
-
|
|
295
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
282
296
|
|
|
283
297
|
## Copyright
|
|
284
298
|
|
|
285
|
-
|
|
299
|
+
(c) 2021 [Matsukei Co.,Ltd](http://www.matsukei.co.jp).
|
data/Rakefile
CHANGED
|
@@ -1,35 +1,22 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
1
2
|
require 'rake/testtask'
|
|
2
|
-
require 'yard'
|
|
3
3
|
|
|
4
4
|
task default: :test
|
|
5
5
|
|
|
6
6
|
Rake::TestTask.new do |t|
|
|
7
|
+
t.name = 'test:units'
|
|
8
|
+
t.description = 'Run unit tests'
|
|
7
9
|
t.libs << 'test'
|
|
8
|
-
t.test_files = Dir['test/
|
|
10
|
+
t.test_files = Dir['test/units/**/test_*.rb']
|
|
9
11
|
end
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Dir['examples/*/*.rb'].each do |f|
|
|
19
|
-
casename = File.basename(File.dirname(f))
|
|
20
|
-
|
|
21
|
-
desc "Run example: #{casename}"
|
|
22
|
-
task casename.to_sym => :_init do
|
|
23
|
-
require_relative 'examples/helper'
|
|
24
|
-
require_relative "examples/#{casename}/#{casename}"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
13
|
+
Rake::TestTask.new do |t|
|
|
14
|
+
t.name = 'test:features'
|
|
15
|
+
t.description = 'Run feature tests'
|
|
16
|
+
t.libs << 'test/features'
|
|
17
|
+
t.test_files = Dir['test/features/*/test_*.rb']
|
|
18
|
+
t.warning = false
|
|
27
19
|
end
|
|
28
20
|
|
|
29
|
-
desc 'Run
|
|
30
|
-
task
|
|
31
|
-
|
|
32
|
-
YARD::Rake::YardocTask.new :doc do |yard|
|
|
33
|
-
yard.files = Dir['lib/**/*.rb']
|
|
34
|
-
yard.options = ['--readme', 'README.md']
|
|
35
|
-
end
|
|
21
|
+
desc 'Run unit and feature tests'
|
|
22
|
+
task test: %i( test:units test:features )
|
|
@@ -10,6 +10,11 @@ module Thinreports
|
|
|
10
10
|
config_reader :type, :id
|
|
11
11
|
config_reader :style
|
|
12
12
|
config_checker true, :display
|
|
13
|
+
config_reader follow_stretch: %w[follow-stretch]
|
|
14
|
+
|
|
15
|
+
def affect_bottom_margin?
|
|
16
|
+
attributes.fetch('affect-bottom-margin', true)
|
|
17
|
+
end
|
|
13
18
|
end
|
|
14
19
|
end
|
|
15
20
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Thinreports
|
|
4
|
+
module Core
|
|
5
|
+
module Shape
|
|
6
|
+
module StackView
|
|
7
|
+
class Format < Basic::Format
|
|
8
|
+
attr_reader :rows
|
|
9
|
+
|
|
10
|
+
def initialize(*)
|
|
11
|
+
super
|
|
12
|
+
initialize_rows
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def initialize_rows
|
|
18
|
+
@rows = []
|
|
19
|
+
attributes['rows'].each do |row|
|
|
20
|
+
@rows << StackView::RowFormat.new(row)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Thinreports
|
|
4
|
+
module Core
|
|
5
|
+
module Shape
|
|
6
|
+
module StackView
|
|
7
|
+
class Interface < Basic::Interface
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def init_internal(parent, format)
|
|
11
|
+
StackView::Internal.new(parent, format)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Thinreports
|
|
4
|
+
module Core
|
|
5
|
+
module Shape
|
|
6
|
+
module StackView
|
|
7
|
+
class Internal < Basic::Internal
|
|
8
|
+
def initialize(parent, format)
|
|
9
|
+
super
|
|
10
|
+
@rows = []
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
attr_accessor :rows
|
|
14
|
+
|
|
15
|
+
def type_of?(type_name)
|
|
16
|
+
type_name == StackView::TYPE_NAME
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Thinreports
|
|
4
|
+
module Core
|
|
5
|
+
module Shape
|
|
6
|
+
module StackView
|
|
7
|
+
class RowFormat < Core::Format::Base
|
|
8
|
+
config_reader :id
|
|
9
|
+
config_reader :height
|
|
10
|
+
config_checker true, :display
|
|
11
|
+
config_checker true, auto_stretch: 'auto-stretch'
|
|
12
|
+
|
|
13
|
+
attr_reader :items
|
|
14
|
+
|
|
15
|
+
def initialize(*)
|
|
16
|
+
super
|
|
17
|
+
@items = []
|
|
18
|
+
@item_with_ids = {}
|
|
19
|
+
initialize_items(attributes['items'])
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def find_item(id)
|
|
23
|
+
@item_with_ids[id.to_sym]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def initialize_items(item_schemas)
|
|
29
|
+
item_schemas.each do |item_schema|
|
|
30
|
+
item = Core::Shape::Format(item_schema['type']).new(item_schema)
|
|
31
|
+
@items << item
|
|
32
|
+
@item_with_ids[item.id.to_sym] = item unless item.id.empty?
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Thinreports
|
|
4
|
+
module Core
|
|
5
|
+
module Shape
|
|
6
|
+
module StackView
|
|
7
|
+
TYPE_NAME = 'stack-view'.freeze
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
require_relative 'stack_view/format'
|
|
14
|
+
require_relative 'stack_view/interface'
|
|
15
|
+
require_relative 'stack_view/internal'
|
|
16
|
+
|
|
17
|
+
require_relative 'stack_view/row_format'
|
|
@@ -5,9 +5,12 @@ module Thinreports
|
|
|
5
5
|
module Shape
|
|
6
6
|
module Style
|
|
7
7
|
class Basic < Style::Base
|
|
8
|
-
style_accessible :visible
|
|
8
|
+
style_accessible :visible, :offset_x, :offset_y
|
|
9
9
|
attr_accessor :visible
|
|
10
10
|
|
|
11
|
+
style_accessor :offset_x, 'offset-x'
|
|
12
|
+
style_accessor :offset_y, 'offset-y'
|
|
13
|
+
|
|
11
14
|
def initialize(*args)
|
|
12
15
|
super
|
|
13
16
|
@visible = @format.display?
|
|
@@ -35,7 +35,12 @@ module Thinreports
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def number_with_delimiter(value, delimiter = ',')
|
|
38
|
-
value.to_s.
|
|
38
|
+
value_int, value_float = value.to_s.split('.')
|
|
39
|
+
|
|
40
|
+
[
|
|
41
|
+
value_int.gsub(/(\d)(?=(\d{3})+(?!\d))/) { "#{$1}#{delimiter}" },
|
|
42
|
+
value_float
|
|
43
|
+
].compact.join('.')
|
|
39
44
|
end
|
|
40
45
|
|
|
41
46
|
def number_with_precision(value, precision = 3)
|