thinreports 0.7.7 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -6
- data/.travis.yml +4 -10
- data/CHANGELOG.md +220 -0
- data/Gemfile +3 -3
- data/MIT-LICENSE +1 -1
- data/README.md +286 -0
- data/Rakefile +38 -8
- data/examples/character_spacing/character_spacing.rb +8 -0
- data/examples/character_spacing/character_spacing.tlf +1 -0
- data/examples/dynamic_image/dynamic_image.rb +31 -0
- data/examples/dynamic_image/dynamic_image.tlf +1 -0
- data/{test/case → examples}/dynamic_image/img200x100.png +0 -0
- data/{test/case → examples}/dynamic_image/img50x50.png +0 -0
- data/examples/dynamic_style/dynamic_style.rb +150 -0
- data/examples/dynamic_style/dynamic_style.tlf +1 -0
- data/examples/dynamic_style/dynamic_style_in_list.tlf +1 -0
- data/{test/case → examples}/dynamic_style/image.png +0 -0
- data/examples/eudc/eudc.rb +20 -0
- data/examples/eudc/eudc.tlf +1 -0
- data/{test/case → examples}/eudc/eudc.ttf +0 -0
- data/{test/case → examples}/helper.rb +14 -12
- data/examples/hidden_shapes/hidden_shapes.rb +9 -0
- data/examples/hidden_shapes/hidden_shapes.tlf +1 -0
- data/examples/list_events/list_events.rb +59 -0
- data/examples/list_events/list_events_0_7_7.tlf +1 -0
- data/examples/list_events/list_events_0_8.tlf +1 -0
- data/{test/case → examples}/list_manual_generation/list_manual_generation.rb +4 -4
- data/examples/list_manual_generation/list_manual_generation.tlf +1 -0
- data/{test/case → examples}/list_page_number/list_page_number.rb +3 -3
- data/examples/list_page_number/list_page_number.tlf +1 -0
- data/examples/page_number/page_number.rb +33 -0
- data/examples/page_number/page_number.tlf +1 -0
- data/examples/password_setting/password_setting.rb +10 -0
- data/examples/password_setting/password_setting.tlf +1 -0
- data/examples/report_callbacks/report_callbacks.rb +31 -0
- data/examples/report_callbacks/report_callbacks.tlf +1 -0
- data/{test/case → examples}/single_line_tblock/single_line_tblock.rb +2 -2
- data/examples/single_line_tblock/single_line_tblock.tlf +1 -0
- data/examples/tblock_overflow/tblock_overflow.rb +20 -0
- data/examples/tblock_overflow/tblock_overflow.tlf +1 -0
- data/examples/tblock_styles/font_size.tlf +1 -0
- data/examples/tblock_styles/tblock_styles.rb +43 -0
- data/examples/tblock_styles/tblock_styles.tlf +1 -0
- data/examples/text_align/text_align.rb +8 -0
- data/examples/text_align/text_align.tlf +1 -0
- data/examples/typeB_page_size/B4_ISO.tlf +1 -0
- data/examples/typeB_page_size/B4_JIS.tlf +1 -0
- data/{test/case → examples}/typeB_page_size/typeB_page_size.rb +3 -3
- data/examples/word_wrap/word_wrap.rb +26 -0
- data/examples/word_wrap/word_wrap.tlf +1 -0
- data/{resources/fonts → fonts}/IPA_Font_License_Agreement_v1.0.txt +0 -0
- data/{resources/fonts → fonts}/ipag.ttf +0 -0
- data/{resources/fonts → fonts}/ipagp.ttf +0 -0
- data/{resources/fonts → fonts}/ipam.ttf +0 -0
- data/{resources/fonts → fonts}/ipamp.ttf +0 -0
- data/lib/thinreports.rb +14 -2
- data/lib/thinreports/config.rb +30 -10
- data/lib/thinreports/core/errors.rb +23 -20
- data/lib/thinreports/core/events.rb +18 -19
- data/lib/thinreports/core/format/base.rb +20 -20
- data/lib/thinreports/core/format/builder.rb +14 -22
- data/lib/thinreports/core/shape.rb +9 -13
- data/lib/thinreports/core/shape/base.rb +4 -5
- data/lib/thinreports/core/shape/base/interface.rb +15 -15
- data/lib/thinreports/core/shape/base/internal.rb +15 -20
- data/lib/thinreports/core/shape/basic.rb +1 -1
- data/lib/thinreports/core/shape/basic/block_format.rb +3 -4
- data/lib/thinreports/core/shape/basic/block_interface.rb +9 -4
- data/lib/thinreports/core/shape/basic/block_internal.rb +9 -10
- data/lib/thinreports/core/shape/basic/format.rb +11 -10
- data/lib/thinreports/core/shape/basic/interface.rb +3 -3
- data/lib/thinreports/core/shape/basic/internal.rb +4 -5
- data/lib/thinreports/core/shape/image_block.rb +1 -1
- data/lib/thinreports/core/shape/image_block/format.rb +5 -6
- data/lib/thinreports/core/shape/image_block/interface.rb +9 -7
- data/lib/thinreports/core/shape/image_block/internal.rb +5 -6
- data/lib/thinreports/core/shape/list.rb +1 -1
- data/lib/thinreports/core/shape/list/configuration.rb +30 -15
- data/lib/thinreports/core/shape/list/events.rb +11 -11
- data/lib/thinreports/core/shape/list/format.rb +27 -28
- data/lib/thinreports/core/shape/list/manager.rb +128 -95
- data/lib/thinreports/core/shape/list/page.rb +54 -50
- data/lib/thinreports/core/shape/list/page_state.rb +15 -16
- data/lib/thinreports/core/shape/list/section_format.rb +14 -15
- data/lib/thinreports/core/shape/list/section_interface.rb +15 -16
- data/lib/thinreports/core/shape/list/section_internal.rb +7 -8
- data/lib/thinreports/core/shape/list/store.rb +10 -11
- data/lib/thinreports/core/shape/manager.rb +1 -1
- data/lib/thinreports/core/shape/manager/format.rb +10 -11
- data/lib/thinreports/core/shape/manager/internal.rb +21 -20
- data/lib/thinreports/core/shape/manager/target.rb +63 -34
- data/lib/thinreports/core/shape/page_number.rb +1 -1
- data/lib/thinreports/core/shape/page_number/format.rb +3 -3
- data/lib/thinreports/core/shape/page_number/interface.rb +2 -2
- data/lib/thinreports/core/shape/page_number/internal.rb +3 -3
- data/lib/thinreports/core/shape/style.rb +1 -1
- data/lib/thinreports/core/shape/style/base.rb +29 -29
- data/lib/thinreports/core/shape/style/basic.rb +1 -1
- data/lib/thinreports/core/shape/style/graphic.rb +10 -25
- data/lib/thinreports/core/shape/style/text.rb +36 -30
- data/lib/thinreports/core/shape/text.rb +1 -1
- data/lib/thinreports/core/shape/text/format.rb +8 -9
- data/lib/thinreports/core/shape/text/interface.rb +2 -2
- data/lib/thinreports/core/shape/text/internal.rb +6 -7
- data/lib/thinreports/core/shape/text_block.rb +1 -1
- data/lib/thinreports/core/shape/text_block/format.rb +17 -18
- data/lib/thinreports/core/shape/text_block/formatter.rb +7 -8
- data/lib/thinreports/core/shape/text_block/formatter/basic.rb +13 -12
- data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +8 -9
- data/lib/thinreports/core/shape/text_block/formatter/number.rb +11 -12
- data/lib/thinreports/core/shape/text_block/formatter/padding.rb +9 -32
- data/lib/thinreports/core/shape/text_block/interface.rb +2 -2
- data/lib/thinreports/core/shape/text_block/internal.rb +19 -20
- data/lib/thinreports/core/utils.rb +33 -32
- data/lib/thinreports/generator.rb +6 -8
- data/lib/thinreports/generator/base.rb +15 -24
- data/lib/thinreports/generator/configuration.rb +10 -9
- data/lib/thinreports/generator/pdf.rb +27 -30
- data/lib/thinreports/generator/pdf/configuration.rb +11 -6
- data/lib/thinreports/generator/pdf/document.rb +28 -28
- data/lib/thinreports/generator/pdf/document/draw_shape.rb +30 -31
- data/lib/thinreports/generator/pdf/document/font.rb +53 -44
- data/lib/thinreports/generator/pdf/document/graphics.rb +8 -9
- data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +25 -25
- data/lib/thinreports/generator/pdf/document/graphics/basic.rb +25 -25
- data/lib/thinreports/generator/pdf/document/graphics/image.rb +15 -15
- data/lib/thinreports/generator/pdf/document/graphics/text.rb +40 -41
- data/lib/thinreports/generator/pdf/document/page.rb +20 -21
- data/lib/thinreports/generator/pdf/document/parse_color.rb +9 -10
- data/lib/thinreports/generator/pdf/document/parse_svg.rb +14 -15
- data/lib/thinreports/generator/pdf/drawer/base.rb +13 -14
- data/lib/thinreports/generator/pdf/drawer/list.rb +13 -14
- data/lib/thinreports/generator/pdf/drawer/list_section.rb +13 -14
- data/lib/thinreports/generator/pdf/drawer/page.rb +16 -17
- data/lib/thinreports/generator/pdf/prawn_ext.rb +17 -33
- data/lib/thinreports/layout.rb +2 -2
- data/lib/thinreports/layout/base.rb +22 -36
- data/lib/thinreports/layout/configuration.rb +11 -9
- data/lib/thinreports/layout/format.rb +26 -27
- data/lib/thinreports/layout/version.rb +8 -9
- data/lib/thinreports/report.rb +10 -14
- data/lib/thinreports/report/base.rb +104 -126
- data/lib/thinreports/report/events.rb +5 -5
- data/lib/thinreports/report/internal.rb +41 -33
- data/lib/thinreports/{core → report}/page.rb +38 -30
- data/lib/thinreports/version.rb +2 -3
- data/test/data/font.ttf +0 -0
- data/test/data/layout_block.tlf +1 -0
- data/test/data/layout_list.tlf +1 -0
- data/test/data/layout_list_noheader.tlf +1 -0
- data/test/data/layout_text1.tlf +1 -0
- data/test/data/layout_text2.tlf +1 -0
- data/test/test_helper.rb +74 -0
- data/test/{unit/tmp → tmp}/.gitkeep +0 -0
- data/test/unit/core/format/test_base.rb +14 -14
- data/test/unit/core/format/test_builder.rb +19 -23
- data/test/unit/core/shape/base/test_internal.rb +34 -37
- data/test/unit/core/shape/basic/test_basic_format.rb +4 -4
- data/test/unit/core/shape/basic/test_basic_interface.rb +15 -13
- data/test/unit/core/shape/basic/test_basic_internal.rb +19 -16
- data/test/unit/core/shape/basic/test_format.rb +4 -4
- data/test/unit/core/shape/basic/test_interface.rb +36 -46
- data/test/unit/core/shape/basic/test_internal.rb +23 -20
- data/test/unit/core/shape/image_block/test_format.rb +5 -5
- data/test/unit/core/shape/image_block/test_interface.rb +17 -16
- data/test/unit/core/shape/image_block/test_internal.rb +19 -16
- data/test/unit/core/shape/list/test_configuration.rb +45 -33
- data/test/unit/core/shape/list/test_events.rb +7 -7
- data/test/unit/core/shape/list/test_format.rb +16 -18
- data/test/unit/core/shape/list/test_manager.rb +5 -5
- data/test/unit/core/shape/list/test_page.rb +80 -22
- data/test/unit/core/shape/list/test_page_state.rb +12 -12
- data/test/unit/core/shape/list/test_section_format.rb +16 -17
- data/test/unit/core/shape/list/test_section_interface.rb +30 -22
- data/test/unit/core/shape/list/test_section_internal.rb +21 -19
- data/test/unit/core/shape/list/test_store.rb +7 -7
- data/test/unit/core/shape/manager/test_format.rb +11 -15
- data/test/unit/core/shape/manager/test_internal.rb +9 -9
- data/test/unit/core/shape/manager/test_target.rb +85 -57
- data/test/unit/core/shape/page_number/test_format.rb +4 -4
- data/test/unit/core/shape/page_number/test_interface.rb +11 -8
- data/test/unit/core/shape/page_number/test_internal.rb +5 -5
- data/test/unit/core/shape/styles/test_base.rb +9 -9
- data/test/unit/core/shape/styles/test_basic.rb +5 -5
- data/test/unit/core/shape/styles/test_graphic.rb +19 -33
- data/test/unit/core/shape/styles/test_text.rb +18 -7
- data/test/unit/core/shape/text/test_format.rb +6 -6
- data/test/unit/core/shape/text/test_internal.rb +11 -12
- data/test/unit/core/shape/text_block/formatter/test_basic.rb +16 -16
- data/test/unit/core/shape/text_block/formatter/test_datetime.rb +4 -4
- data/test/unit/core/shape/text_block/formatter/test_number.rb +34 -34
- data/test/unit/core/shape/text_block/formatter/test_padding.rb +44 -44
- data/test/unit/core/shape/text_block/test_format.rb +8 -8
- data/test/unit/core/shape/text_block/test_formatter.rb +17 -17
- data/test/unit/core/shape/text_block/test_interface.rb +37 -20
- data/test/unit/core/shape/text_block/test_internal.rb +38 -38
- data/test/unit/core/test_events.rb +5 -5
- data/test/unit/core/test_shape.rb +6 -6
- data/test/unit/core/test_utils.rb +68 -0
- data/test/unit/generator/pdf/document/graphics/test_attributes.rb +4 -4
- data/test/unit/generator/pdf/document/graphics/test_text.rb +60 -53
- data/test/unit/generator/pdf/document/test_draw_shape.rb +9 -7
- data/test/unit/generator/pdf/document/test_font.rb +79 -58
- data/test/unit/generator/pdf/document/test_graphics.rb +18 -19
- data/test/unit/generator/pdf/document/test_page.rb +44 -45
- data/test/unit/generator/pdf/document/test_parse_color.rb +5 -5
- data/test/unit/generator/pdf/test_configuration.rb +16 -9
- data/test/unit/generator/pdf/test_document.rb +8 -16
- data/test/unit/generator/test_base.rb +31 -42
- data/test/unit/generator/test_configuration.rb +6 -6
- data/test/unit/generator/test_pdf.rb +17 -14
- data/test/unit/layout/test_base.rb +34 -79
- data/test/unit/layout/test_configuration.rb +12 -37
- data/test/unit/layout/test_format.rb +36 -39
- data/test/unit/layout/test_version.rb +4 -4
- data/test/unit/report/test_base.rb +134 -213
- data/test/unit/report/test_events.rb +4 -4
- data/test/unit/report/test_internal.rb +84 -86
- data/test/unit/test_config.rb +31 -12
- data/test/unit/test_layout.rb +7 -7
- data/test/unit/test_report.rb +12 -24
- data/thinreports.gemspec +18 -22
- metadata +101 -200
- data/LICENSE +0 -1
- data/README.rdoc +0 -166
- data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
- data/lib/thinreports/core.rb +0 -20
- data/lib/thinreports/core/ext.rb +0 -5
- data/lib/thinreports/core/ext/array.rb +0 -19
- data/lib/thinreports/core/ext/hash.rb +0 -19
- data/lib/thinreports/core/ext/object.rb +0 -25
- data/lib/thinreports/core/format.rb +0 -14
- data/lib/thinreports/core/ordered_hash.rb +0 -39
- data/lib/thinreports/generator/pdf/drawer.rb +0 -16
- data/tasks/doc.rake +0 -12
- data/tasks/test.rake +0 -56
- data/test/benchmark/basic_estimate.tlf +0 -1
- data/test/benchmark/bench_basic_estimate.rb +0 -95
- data/test/case/character_spacing/character_spacing.rb +0 -8
- data/test/case/character_spacing/character_spacing.tlf +0 -1
- data/test/case/dynamic_image/dynamic_image.rb +0 -41
- data/test/case/dynamic_image/dynamic_image.tlf +0 -1
- data/test/case/dynamic_style/dynamic_style.rb +0 -154
- data/test/case/dynamic_style/dynamic_style.tlf +0 -1
- data/test/case/dynamic_style/dynamic_style_in_list.tlf +0 -1
- data/test/case/eudc/eudc.rb +0 -20
- data/test/case/eudc/eudc.tlf +0 -1
- data/test/case/hidden_shapes/hidden_shapes.rb +0 -9
- data/test/case/hidden_shapes/hidden_shapes.tlf +0 -1
- data/test/case/list_events/list_events.rb +0 -32
- data/test/case/list_events/list_events.tlf +0 -1
- data/test/case/list_manual_generation/list_manual_generation.tlf +0 -1
- data/test/case/list_page_number/list_page_number.tlf +0 -1
- data/test/case/page_number/page_number.rb +0 -33
- data/test/case/page_number/page_number.tlf +0 -1
- data/test/case/password_setting/password_setting.rb +0 -10
- data/test/case/password_setting/password_setting.tlf +0 -1
- data/test/case/single_line_tblock/single_line_tblock.tlf +0 -1
- data/test/case/tblock_overflow/tblock_overflow.rb +0 -20
- data/test/case/tblock_overflow/tblock_overflow.tlf +0 -1
- data/test/case/tblock_styles/tblock_styles.rb +0 -27
- data/test/case/tblock_styles/tblock_styles.tlf +0 -1
- data/test/case/text_align/text_align.rb +0 -8
- data/test/case/text_align/text_align.tlf +0 -1
- data/test/case/typeB_page_size/B4_ISO.tlf +0 -1
- data/test/case/typeB_page_size/B4_JIS.tlf +0 -1
- data/test/case/word_wrap/word_wrap.rb +0 -26
- data/test/case/word_wrap/word_wrap.tlf +0 -1
- data/test/unit/core/ext/array_spec.rb +0 -29
- data/test/unit/core/ext/hash_spec.rb +0 -29
- data/test/unit/core/ext/object_spec.rb +0 -30
- data/test/unit/core/ordered_hash_spec.rb +0 -51
- data/test/unit/core/shape/base/test_interface.rb +0 -52
- data/test/unit/core/utils_spec.rb +0 -56
- data/test/unit/data/basic_layout1.tlf +0 -1
- data/test/unit/data/basic_layout2.tlf +0 -1
- data/test/unit/data/basic_list_layout.tlf +0 -1
- data/test/unit/data/basic_list_noheader_layout.tlf +0 -1
- data/test/unit/helper.rb +0 -87
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52d5b58f89d69995f780cad5fee9ee7d9476ba48
|
4
|
+
data.tar.gz: 1ac6e9e07a7fb3776137cd9d4663fdbae832418e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bd6e15835d02834f428649d474bcdf398e1e550f406652c1827539628e2e83b1aa4e8a550e2003d1521ed950f011dbb9b858101bde330c2eb44322a68eb6dad
|
7
|
+
data.tar.gz: 25ec1244b98b2da6558b05ab5e36650993574c26aae541ed077934169e4f9ae0154b2a0e7153bedfa668e8f3107ca586fd0cac1b67cab461854559f3c12929de
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,16 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
|
-
|
4
|
-
- gem update --system 2.1.11
|
5
|
-
- gem --version
|
6
|
-
rvm:
|
7
|
-
- 1.8.7
|
3
|
+
rvm:
|
8
4
|
- 1.9.3
|
9
5
|
- 2.0.0
|
10
|
-
- 2.1.
|
6
|
+
- 2.1.6
|
7
|
+
- 2.2.2
|
11
8
|
- jruby
|
12
|
-
env:
|
13
|
-
- JRUBY_OPTS=--1.8
|
14
|
-
|
15
|
-
script: rake test:unit
|
16
9
|
|
10
|
+
script: rake test
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
## 0.8.0
|
2
|
+
|
3
|
+
This release is a stepping stone to next major version 1.0.0 release.
|
4
|
+
|
5
|
+
* Upgrade to Prawn 1.3 and drop support for Ruby 1.8.7 (#11)
|
6
|
+
* Change name of root module to Thinreports from ThinReports (#15)
|
7
|
+
* Implement `Item#value=` method (#20)
|
8
|
+
* Implement new list callbacks (#17)
|
9
|
+
* Implement `page[:item_id]=` as alias for `page.item(:item_id).value=` (#22)
|
10
|
+
* Support font-size style for Text and TextBlock (#23)
|
11
|
+
* Support for setting the default fallback font (#7)
|
12
|
+
* Remove `Report#generate_file` method (#13)
|
13
|
+
* Deprecate `Report#events`, and implement new callbacks (#18)
|
14
|
+
* Deprecate `List#events`, recommend to use `List#on_page_finalize` callback or create manually (#9)
|
15
|
+
|
16
|
+
### Upgrade to Prawn 1.3 and drop support for Ruby 1.8.7
|
17
|
+
|
18
|
+
We have dropped support for MRI 1.8.7 and 1.8 mode JRuby by upgrading to Prawn 1.3.
|
19
|
+
Currently supported versions are MRI 1.9.3 and 2.0.0 or higher, JRuby(1.9 mode) 1.7 or higher.
|
20
|
+
|
21
|
+
### Change name of root module to Thinreports from ThinReports
|
22
|
+
|
23
|
+
We have changed name of root module to `Thinreports` from `ThinReports`.
|
24
|
+
Old name `ThinReports` has been enabling as alias, but it will be removed
|
25
|
+
in the next major release.
|
26
|
+
|
27
|
+
### Deprecate `List#events` and `List#store`
|
28
|
+
|
29
|
+
`List#events` and `List#store` have been deprecated.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
report.layout.config.list do |list|
|
33
|
+
list.events.on :page_footer_insert do |e|
|
34
|
+
# ...
|
35
|
+
end
|
36
|
+
# => warn: "[DEPRECATION] ..."
|
37
|
+
|
38
|
+
list.events.on :footer_insert do |e|
|
39
|
+
# ...
|
40
|
+
end
|
41
|
+
# => warn: "[DEPRECATION] ..."
|
42
|
+
|
43
|
+
list.events.on :page_finalize do |e|
|
44
|
+
# ...
|
45
|
+
end
|
46
|
+
# => warn: "[DEPRECATION] ..."
|
47
|
+
end
|
48
|
+
|
49
|
+
list.store.price += 0 # => warn: "[DEPRECATION] ..."
|
50
|
+
```
|
51
|
+
|
52
|
+
Please use new callbacks instead:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
report.list do |list|
|
56
|
+
price = 0
|
57
|
+
|
58
|
+
list.on_page_footer_insert do |footer|
|
59
|
+
footer.item(:price).value = price
|
60
|
+
end
|
61
|
+
|
62
|
+
list.on_footer_insert do |footer|
|
63
|
+
# ...
|
64
|
+
end
|
65
|
+
|
66
|
+
list.on_page_finalize do
|
67
|
+
# ...
|
68
|
+
end
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
See [Issue #17](https://github.com/thinreports/thinreports-generator/issues/17), [Issue #9](https://github.com/thinreports/thinreports-generator/issues/9) and [examples/list_events](https://github.com/thinreports/thinreports-generator/tree/master/examples/list_events) for further details.
|
73
|
+
|
74
|
+
### Deprecate `Report#events`, and implement new callbacks
|
75
|
+
|
76
|
+
`Report#events` has been deprecated:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
report.events.on :page_create do |e|
|
80
|
+
e.page.item(:text1).value('Text1')
|
81
|
+
end
|
82
|
+
# => warn: "[DEPRECATION] ..."
|
83
|
+
|
84
|
+
report.events.on :generate do |e|
|
85
|
+
e.pages.each do |page|
|
86
|
+
page.item(:text2).value('Text2')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
# => warn: "[DEPRECATION] ..."
|
90
|
+
```
|
91
|
+
|
92
|
+
Please use `Report#on_page_create` callback instead.
|
93
|
+
However `Report#on_generate` callback has not been implemented,
|
94
|
+
but you can do the same things using `Report#pages` method.
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
report.on_page_create do |page|
|
98
|
+
page.item(:text1).value('Text1')
|
99
|
+
end
|
100
|
+
|
101
|
+
report.pages.each do |page|
|
102
|
+
page.item(:text2).value('Text2')
|
103
|
+
end
|
104
|
+
|
105
|
+
report.generate filename: 'foo.pdf'
|
106
|
+
```
|
107
|
+
|
108
|
+
See [Issue #18](https://github.com/thinreports/thinreports-generator/issues/18) for further details.
|
109
|
+
|
110
|
+
### Implement `page[:item_id]=` as alias for `page.item(:item_id).value=` (#22)
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
# New setter, same as `page.item(:text_block).value = 'tblock value'`
|
114
|
+
page[:text_block] = 'tblock value'
|
115
|
+
# New getter, same as `page.item(:text_block).value`
|
116
|
+
page[:text_block] # => "tblock value"
|
117
|
+
page.item(:text_block).value # => "tblock value"
|
118
|
+
|
119
|
+
page[:image_block] = '/path/to/image.png'
|
120
|
+
page[:image_block] # => "/path/to/image.png"
|
121
|
+
```
|
122
|
+
|
123
|
+
See [Issue #22](https://github.com/thinreports/thinreports-generator/issues/22) for further details.
|
124
|
+
|
125
|
+
### Implement `Item#value=` method
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
page.item(:text_block).value('value')
|
129
|
+
page.item(:text_block).value = 'value'
|
130
|
+
page.item(:image_block).src('/path/to/image.tlf')
|
131
|
+
page.item(:image_block).src = '/path/to/image.tlf'
|
132
|
+
```
|
133
|
+
|
134
|
+
See [Issue #20](https://github.com/thinreports/thinreports-generator/issues/20) for further details.
|
135
|
+
|
136
|
+
### Support font-size style for Text and TextBlock
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
page.item(:text).style(:font_size, 20)
|
140
|
+
page.item(:text_block).style(:font_size, 20)
|
141
|
+
page.item(:text_block).style(:font_size) # => 20
|
142
|
+
```
|
143
|
+
|
144
|
+
See [Issue #23](https://github.com/thinreports/thinreports-generator/issues/23) for further details.
|
145
|
+
|
146
|
+
### Support for setting the default fallback font
|
147
|
+
|
148
|
+
Please see [Issue #7](https://github.com/thinreports/thinreports-generator/issues/7) for further details.
|
149
|
+
|
150
|
+
## 0.7.7.1
|
151
|
+
|
152
|
+
* No release for generator
|
153
|
+
|
154
|
+
## 0.7.7
|
155
|
+
|
156
|
+
### Features
|
157
|
+
|
158
|
+
* ページ番号ツール [Katsuya Hidaka]
|
159
|
+
* New "Word-wrap" property of TextBlock [Katsuya Hidaka]
|
160
|
+
* B4/B5 の ISO サイズを追加 [Takumi FUJISE / Minoru Maeda / Katsuya Hidaka]
|
161
|
+
* generate filename: 'foo.pdf' を実装、#generate_file を非推奨へ [Katsuya Hidaka]
|
162
|
+
* start_new_page layout: 'file.tlf' でもデフォルトレイアウトが設定されるよう改善 [Eito Katagiri / Katsuya Hidaka]
|
163
|
+
|
164
|
+
### Bug fixes
|
165
|
+
|
166
|
+
* Report#use_layout で list の設定を行うとエラーが発生する [Katsuya Hidaka]
|
167
|
+
* Layout::Format#page_margin_right が不正な値を返す [Katsuya Hidaka]
|
168
|
+
* セキュリティを設定した PDF を印刷すると "このページにはエラーがあります..." メッセージが表示される [Katsuya Hidaka]
|
169
|
+
* B4 サイズで出力した PDF の用紙サイズが正しくない [Takumi FUJISE / Katsuya Hidaka]
|
170
|
+
|
171
|
+
## 0.7.6
|
172
|
+
|
173
|
+
### Features
|
174
|
+
|
175
|
+
* デフォルトレイアウトを書き換え可能へ変更 [Katsuya Hidaka]
|
176
|
+
|
177
|
+
### Bug fixes
|
178
|
+
|
179
|
+
* Fix raise NoMethodError when has no default layout [Katsuya Hidaka]
|
180
|
+
|
181
|
+
## 0.7.5
|
182
|
+
|
183
|
+
### Features
|
184
|
+
|
185
|
+
* テキストブロックのオーバフロープロパティ [Katsuya Hidaka]
|
186
|
+
* list メソッドのデフォルト id と Report#list の追加 [Katsuya Hidaka]
|
187
|
+
|
188
|
+
### Bug fixes
|
189
|
+
|
190
|
+
* gem install 時にRDoc生成時のエラーが表示される場合がある [Katsuya Hidaka]
|
191
|
+
* エディターにて一覧表ツールのヘッダーを使わない場合の動作について [吉田 和弘 / Katsuya Hidaka]
|
192
|
+
|
193
|
+
## 0.7.0
|
194
|
+
|
195
|
+
### Features
|
196
|
+
|
197
|
+
* Listに :page_finalize イベントを追加
|
198
|
+
* ダイナミックスタイルの拡充
|
199
|
+
* イメージブロックの実装
|
200
|
+
* Tblockで行間、横位置、縦位置、文字間隔の指定を可能に
|
201
|
+
* Prawn 0.12.0 を採用
|
202
|
+
* メタ情報のタイトルに反映
|
203
|
+
* Example Test環境の構築
|
204
|
+
* 外字の埋め込みサポート
|
205
|
+
* clean taskの削除
|
206
|
+
* YARD Docのテンプレート追加
|
207
|
+
* ロードするprawnのバージョンを固定
|
208
|
+
* .generate, .generate_fileメソッドのオプション指定をフラット化
|
209
|
+
* 単行モードテキストブロックがレイアウトで定義した「高さ」の影響を受けないように
|
210
|
+
* PXD形式の出力フォーマット廃止とデフォルトタイプの導入
|
211
|
+
* $KCODEによる文字カウント処理の改善
|
212
|
+
* List#headerの挙動を改善
|
213
|
+
* Errors::UnknownItemId 時のエラーメッセージを分かりやすく
|
214
|
+
* テスト漏れに対するテストコード作成とテスト
|
215
|
+
|
216
|
+
### Bug fixes
|
217
|
+
|
218
|
+
* フッターが挿入時、リスト領域をオーバフローしない場合でも改ページされる場合がある
|
219
|
+
* Tblockで基本書式のみ設定されている場合、その書式が反映されない
|
220
|
+
* Tblockがフォントサイズに対して小さすぎる場合にエラー
|
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,286 @@
|
|
1
|
+
# Thinreports Generator [![Join the chat at https://gitter.im/thinreports/thinreports-generator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/thinreports/thinreports-generator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/thinreports.svg)](http://badge.fury.io/rb/thinreports)
|
4
|
+
[![](http://img.shields.io/travis/thinreports/thinreports-generator.svg?style=flat)](http://travis-ci.org/thinreports/thinreports-generator)
|
5
|
+
[![](http://img.shields.io/codeclimate/github/thinreports/thinreports-generator.svg?style=flat)](https://codeclimate.com/github/thinreports/thinreports-generator)
|
6
|
+
[![](http://img.shields.io/gemnasium/thinreports/thinreports-generator.svg?style=flat)](https://gemnasium.com/thinreports/thinreports-generator)
|
7
|
+
|
8
|
+
[Thinreports](http://www.thinreports.org) is an open source report generating tool for Ruby.
|
9
|
+
|
10
|
+
* Thinreports Editor (GUI Designer)
|
11
|
+
* Thinreports Generator (Report Generator for Ruby)
|
12
|
+
|
13
|
+
## Getting Started
|
14
|
+
|
15
|
+
* [Installation Guide](http://www.thinreports.org/documentation/getting-started/installation.html)
|
16
|
+
* [Quick Start Guide](http://www.thinreports.org/documentation/getting-started/quickstart.html)
|
17
|
+
* [Examples](https://github.com/thinreports/thinreports-examples)
|
18
|
+
* [Rails4 Example](https://github.com/thinreports/thinreports-rails4-example)
|
19
|
+
* [Changelog](https://github.com/thinreports/thinreports-generator/blob/master/CHANGELOG.md)
|
20
|
+
* [Discussion Group](https://groups.google.com/forum/#!forum/thinreports)
|
21
|
+
* [![Join the chat at https://gitter.im/thinreports/thinreports-generator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/thinreports/thinreports-generator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
22
|
+
|
23
|
+
## Supported versions
|
24
|
+
|
25
|
+
* Ruby 1.9.3, 2.0, 2.1, 2.2
|
26
|
+
* JRuby 1.7.0+ (1.9 mode)
|
27
|
+
|
28
|
+
## Quick Reference
|
29
|
+
|
30
|
+
**NOTE:** You need to create a layout file `.tlf` using [Thinreports Editor](http://www.thinreports.org/features/editor/).
|
31
|
+
|
32
|
+
### Basic Objects and Basic Usage
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require 'thinreports'
|
36
|
+
|
37
|
+
report = Thinreports::Report.new layout: 'report.tlf'
|
38
|
+
|
39
|
+
report.start_new_page do
|
40
|
+
item(:title).value('Thinreports')
|
41
|
+
end
|
42
|
+
|
43
|
+
report.start_new_page do |page|
|
44
|
+
# Item Finder
|
45
|
+
page.item(:item_id) # => Item object
|
46
|
+
page[:item_id] # => Item object
|
47
|
+
|
48
|
+
# Text block
|
49
|
+
page.item(:text_block).value('Pure Ruby')
|
50
|
+
page.item(:text_block).value = 'Pure Ruby'
|
51
|
+
page[:text_block] = 'Pure Ruby'
|
52
|
+
page.item('text_block').set('value', color: '#0000ff')
|
53
|
+
page.item(:text_block).format_enabled(false)
|
54
|
+
|
55
|
+
# Image block
|
56
|
+
page.item(:image_block).src('/path/to/image.png')
|
57
|
+
page.item(:image_block).src = '/path/to/image.png'
|
58
|
+
page[:image_block] = '/path/to/image.png'
|
59
|
+
require 'open-uri'
|
60
|
+
page.item(:image_block).src(open('http://www.thinreports.org/assets/logos/thinreports-logo.png'))
|
61
|
+
|
62
|
+
# Attributes
|
63
|
+
page.item(:any).hide
|
64
|
+
page.item(:any).show
|
65
|
+
page.item(:any).visible(true)
|
66
|
+
page.item(:any).visible? # => true
|
67
|
+
page.item(:any).id # => "any"
|
68
|
+
|
69
|
+
# Styles
|
70
|
+
page.item(:text).style(:color, 'red')
|
71
|
+
page.item(:text).style(:bold, true)
|
72
|
+
page.item(:text).style(:italic, true)
|
73
|
+
page.item(:text).style(:linethrough, true)
|
74
|
+
page.item(:text).style(:underline, true)
|
75
|
+
page.item(:text).style(:font_size, 20)
|
76
|
+
|
77
|
+
page.item(:text).style(:align, :left or :center or :right)
|
78
|
+
page.item(:text).style(:valign, :top or :center or :bottom)
|
79
|
+
|
80
|
+
page.item(:rectangle).style(:border_color, '#ff0000')
|
81
|
+
.style(:border_width, 1)
|
82
|
+
.style(:fill_color, '#ffffff')
|
83
|
+
|
84
|
+
# Bulk setting of styles
|
85
|
+
page.item(:text).styles(color: '#00000', align: :right)
|
86
|
+
|
87
|
+
# Bulk setting of values
|
88
|
+
page.values text_block_a: 'value', text_block_b: 'value'
|
89
|
+
|
90
|
+
# Helpers
|
91
|
+
page.item_exists?(:existing_id) # => true
|
92
|
+
page.item_exists?('existing_id') # => true
|
93
|
+
page.item_exists?(:unknown_id) # => false
|
94
|
+
end
|
95
|
+
|
96
|
+
report.generate(filename: 'report.pdf')
|
97
|
+
```
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
Thinreports::Report.generate(filename: 'report.pdf', layout: 'report.tlf') do |report|
|
101
|
+
report.start_new_page do |page|
|
102
|
+
# :
|
103
|
+
end
|
104
|
+
end
|
105
|
+
```
|
106
|
+
|
107
|
+
### Report and Page
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
report = Thinreports::Report.new layout: 'foo.tlf'
|
111
|
+
|
112
|
+
3.times { report.start_new_page }
|
113
|
+
|
114
|
+
# Returns all pages
|
115
|
+
report.pages # => [<Report::Page>, <Report::Page>, <Report::Page>]
|
116
|
+
# Returns number of pages
|
117
|
+
report.page_count # => 3
|
118
|
+
|
119
|
+
# Add a blank page
|
120
|
+
report.add_blank_page
|
121
|
+
|
122
|
+
report.pages.last # => Report::BlankPage
|
123
|
+
```
|
124
|
+
|
125
|
+
### Using multiple layouts
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
report = Thinreports::Report.new
|
129
|
+
|
130
|
+
report.use_layout '/path/to/default.tlf', default: true
|
131
|
+
report.use_layout '/path/to/other1.tlf', id: :other
|
132
|
+
|
133
|
+
report.start_new_page do |page|
|
134
|
+
# use '/path/to/default.tlf' layout
|
135
|
+
end
|
136
|
+
|
137
|
+
report.start_new_page layout: :other do |page|
|
138
|
+
# use '/path/to/other1.tlf' layout
|
139
|
+
end
|
140
|
+
|
141
|
+
report.start_new_page layout: '/path/to/other2.tlf' do |page|
|
142
|
+
# use '/path/to/other2.tlf' layout
|
143
|
+
end
|
144
|
+
```
|
145
|
+
|
146
|
+
### Callbacks
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
report = Thinreports::Report.new layout: 'foo.tlf'
|
150
|
+
|
151
|
+
# It will be called before finalizing each page
|
152
|
+
report.on_page_create do |page|
|
153
|
+
page.item(:text).value('Text for all pages')
|
154
|
+
end
|
155
|
+
```
|
156
|
+
|
157
|
+
See also [examples/report_callbacks](https://github.com/thinreports/thinreports-generator/tree/master/examples/report_callbacks).
|
158
|
+
|
159
|
+
### List
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
report = Thinreports::Report.new layout: 'list.tlf'
|
163
|
+
|
164
|
+
report.list.header do |header|
|
165
|
+
header.item(:text_block).value('Title')
|
166
|
+
end
|
167
|
+
|
168
|
+
10.times do |n|
|
169
|
+
report.list.add_row do |row|
|
170
|
+
row.item(:text_block).value(n)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
report.generate(filename: 'list.pdf')
|
175
|
+
```
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
report = Thinreports::Report.new layout: 'list_with_footer.tlf'
|
179
|
+
|
180
|
+
report.list do |list|
|
181
|
+
total_price = 0
|
182
|
+
price_per_page = 0
|
183
|
+
|
184
|
+
list.on_page_finalize do
|
185
|
+
total_price += price_per_page
|
186
|
+
price_per_page = 0
|
187
|
+
end
|
188
|
+
|
189
|
+
list.on_page_footer_insert do |footer|
|
190
|
+
footer.values price: price_per_page
|
191
|
+
end
|
192
|
+
|
193
|
+
list.on_footer_insert do |footer|
|
194
|
+
footer.item(:price).value(total_price)
|
195
|
+
end
|
196
|
+
|
197
|
+
[100, 200, 300].each do |price|
|
198
|
+
list.add_row do |row|
|
199
|
+
row[:price] = price
|
200
|
+
end
|
201
|
+
price_per_page += price
|
202
|
+
end
|
203
|
+
end
|
204
|
+
```
|
205
|
+
|
206
|
+
See also [examples/list_events](https://github.com/thinreports/thinreports-generator/tree/master/examples/list_events).
|
207
|
+
|
208
|
+
### Page Number
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
# Setting starting number of page
|
212
|
+
report.start_page_number_from 5
|
213
|
+
|
214
|
+
# Setting whether to count new page
|
215
|
+
report.start_new_page count: true # default
|
216
|
+
report.start_new_page count: false
|
217
|
+
|
218
|
+
# Change styles
|
219
|
+
report.start_new_page do |page|
|
220
|
+
page.item(:pageno).hide
|
221
|
+
page.item(:pageno).show
|
222
|
+
page.item(:pageno).visible(false)
|
223
|
+
page.item(:pageno).styles(color: 'red', bold: true)
|
224
|
+
end
|
225
|
+
```
|
226
|
+
|
227
|
+
See also [examples/page_number](https://github.com/thinreports/thinreports-generator/blob/master/examples/page_number) and [examples/list_page_number](https://github.com/thinreports/thinreports-generator/blob/master/examples/list_page_number).
|
228
|
+
|
229
|
+
### Configuring fallback fonts
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
Thinreports.configure do |config|
|
233
|
+
config.fallback_fonts = '/path/to/fallback.ttf'
|
234
|
+
end
|
235
|
+
|
236
|
+
Thinreports.config.fallback_fonts = ['/path/to/font_a.ttf', '/path/to/font_b.ttf']
|
237
|
+
```
|
238
|
+
|
239
|
+
See also [examples/eudc](https://github.com/thinreports/thinreports-generator/blob/master/examples/eudc).
|
240
|
+
|
241
|
+
## Features
|
242
|
+
|
243
|
+
Features of Editor is [here](http://www.thinreports.org/features/editor/).
|
244
|
+
|
245
|
+
### Easy to generate PDF
|
246
|
+
|
247
|
+
Design layout using Editor, then embed values to text field in layout.
|
248
|
+
|
249
|
+
### Simple runtime environment
|
250
|
+
|
251
|
+
Ruby, RubyGems, Prawn and Generator.
|
252
|
+
|
253
|
+
### Dynamic operation
|
254
|
+
|
255
|
+
Generator can dynamically:
|
256
|
+
|
257
|
+
* change value of TextBlock and ImageBlock
|
258
|
+
* change style (border, fill, visibility, position, color, font) of Shape
|
259
|
+
|
260
|
+
### Others
|
261
|
+
|
262
|
+
* External characters (Gaiji) for Japanese
|
263
|
+
|
264
|
+
## Contributing
|
265
|
+
|
266
|
+
### Report bug, post your suggestion
|
267
|
+
|
268
|
+
If you find bugs or improvements for the Editor, please report it [here](https://github.com/thinreports/thinreports-generator/issues/new).
|
269
|
+
|
270
|
+
### Sending a Pull Request
|
271
|
+
|
272
|
+
1. Fork it
|
273
|
+
2. Clone your forked repository
|
274
|
+
3. Create your feature branch: `git checkout -b my-new-feature`
|
275
|
+
4. Fix your feature
|
276
|
+
5. Commit your changes: `git commit -am 'Fixed some bugs or features'`
|
277
|
+
6. Push to the branch: `git push origin my-new-feature`
|
278
|
+
7. Create new Pull Request
|
279
|
+
|
280
|
+
## License
|
281
|
+
|
282
|
+
Thinreports Generator is licensed under the [MIT-License](https://github.com/thinreports/thinreports-generator/blob/master/MIT-LICENSE).
|
283
|
+
|
284
|
+
## Copyright
|
285
|
+
|
286
|
+
© 2010-2015 [Matsukei Co.,Ltd](http://www.matsukei.co.jp).
|