Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate the README of the section-format examples into English #121

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions test/features/section_report_basic/README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
# Basic
# Basic Usage

section-report 形式では、ヘッダー・フッター・繰り返し行の3つの種類のセクションを複数定義でき、それらを組み合わせた PDF を生成することができる。
In the section-format, multiple sections of three types can be defined (header, footer, and repeatable section), and PDFs can be generated by combining them.

- [Example code](test_feature.rb)
- [Example template file](template.tlf)
- [Example PDF](expect.pdf)

## セクション
## Section types

ヘッダー `headers`
Header `headers`

- 複数定義できる
- テンプレートで定義した順に描画される
- パラメータで非表示にすることもできる
- "毎ページ表示" が有効なら毎ページ、そうでなければ最初のページに描画される (厳密にはパラメータグループごとに最初のページに描画)
- Multiple definitions possible
- Draw in the order defined in the template
- Can be hidden by a parameter
- If "show every page" is enabled, it will be drawn on every page, otherwise it will be drawn on the first page of each parameter group

フッター `footers`
Footer `footers`

- 複数定義できる
- テンプレートで定義した順に描画される
- パラメータで非表示にすることもできる
- Muliple definitions possible
- Draw in the order defined in the template
- Can be hidden by a parameter

繰り返し行 `details`
Detail `details`

- 複数定義できる
- パラメータで追加した順で描画される
- 繰り返し行の `id` を指定して追加することで、複数の行を組み合わせて描画することができる
- Multiple definitions possible
- Draw in the order added by the parameter
- Multiple definitions can be combined and drawn

## 改ページ
## Page break

ページに入り切らないセクションは、次のページに描画される。
Sections overflowing the page are drawn on the next page.

## PDF の生成
## Generating a PDF

次のようなパラメータを `Thinreports.generate` に渡すことで PDF を生成する。
Generate a PDF by passing the following parameters to `Thinreports.generate`.

```ruby
params = {
Expand Down Expand Up @@ -70,7 +70,7 @@ params = {
Thinreports.generate(params, filename: '/path/to/output.pdf')
```

PDF データを取得する場合は `filename` を省略する。
When getting PDF data, omit the `filename` argument.

```ruby
Thinreports.generate(params) #=> PDF data
Expand Down
9 changes: 5 additions & 4 deletions test/features/section_report_multiple_groups/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Multiple Groups

group によって複数のパラメータを渡すことができ、それらを一つの PDF に描画することができる。
Multiple parameter sets can be passed as a group and drawn into a single PDF.

- [Example code](test_feature.rb)
- [Example template file](template.tlf)
- [Example PDF](expect.pdf)

group の主な機能は次の通り。
- group ごとに改ページされる
- "毎ページ表示" オプションが無効なヘッダーやフッターは group ごとに描画される
The main functions of groups are as follows:

- Page break for each group
- Headers and footers for which the "show every page" is disabled will be drawn only once per group
52 changes: 27 additions & 25 deletions test/features/section_report_section_auto_stretch/README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
# Section Auto Stretch

自動伸縮を有効にすることで、描画後の内容に応じて section の高さを自動的に伸縮させることができる。
By enabling auto-stretch, the height of the section can be automatically stretched according to the content after drawing.

- [Example code](test_feature.rb)
- [Example template file](template.tlf)
- [Example PDF](expect.pdf)

## 伸縮時の高さの算出
## Calculating the height when stretching

### 下余白とコンテンツの下位置
### Bottom margin and bottom position of content

section の伸縮後の高さは「下余白」と「コンテンツの下位置」によって決定する。
The height of the section after it is stretched is determined by the bottom margin and the bottom position of the content.

コンテンツの下位置
- section 内の item の最下部の位置を指す (「下余白に影響」が無効の item は除外)
- 描画結果によって変動する
Bottom Position of Content

下余白
- コンテンツの下位置から section の下位置との距離又は領域を指す
- 定義時の内容で決定し不変
- The bottom position of the item in the section (except for items for which "Affect bottom margin" is disabled)
- Varies depending on the drawing result

詳細は [Section Bottom Margin](../section_report_section_bottom_margin/README.md) を参照。
Bottom Margin

### 高さの算出
- The height or area between the bottom position of the content and the bottom position of the section
- Determined and fixed by the content of the template definition

section の高さは次のように定義する。
See [Section Bottom Margin](../section_report_section_bottom_margin/README.md) for details.

### Calculating the height

The height of the section is defined as follows:

```
section の高さ = コンテンツの下位置 + 下余白の高さ
height of section = bottom of content + height of bottom margin
```

text-block stack-view などの item が伸縮した場合、コンテンツの下位置が変動する可能性がある。sectionの自動伸縮が有効な場合、その変動後のコンテンツの下位置に基づいてsectionの高さが変化する。
When an item such as text-block or stack-view is stretched, the bottom position of the content may change, and if auto-stretch of the section is enabled, the height of the section will be changed based on the changed bottom position of the content.

## 拡張
## Expanding the height

高さの拡張は以下の条件によって発生する。
Expanding the height occurs in the following cases:

- text-block の描画後の高さが定義の高さよりも高くなり、その結果 section のコンテンツの下位置が大きくなる場合
- stack-view の描画後の高さが定義の高さよりも高くなり、その結果 section のコンテンツの下位置が大きくなる場合
- When the height of the text-block after drawing becomes higher than the defined height, and as a result, the bottom position of the section content becomes larger
- When the height of stack-view becomes higher than the defined height, and as a result, the bottom position of the section content becomes larger

このとき、section は以下のように拡張する。
In these cases, the height of the section is expanded as follows:

![](images/auto-stretch-expand.png)

## 縮小
## Shrinking the height

高さの縮小は以下の条件によって発生する。
Shrinking the height occurs in the following cases:

- stack-view の高さが定義の高さよりも小さくなり、その結果 section のコンテンツの下位置が小さくなる場合
- 縦位置が「上揃え」の image-block の画像が定義した領域の高さよりも小さくなり、その結果 section のコンテンツの下位置が小さくなる場合
- When the height of the stack-view becomes smaller than the defined height, and as a result, the bottom position of the section content becomes smaller
- When the image of an image-block whose vertical position is top becomes smaller than the height of the defined area, and as a result, the bottom position of the section content becomes smaller

このとき、section は以下のように縮小する。
In these cases, the height of the section is shrinked as follows:

![](images/auto-stretch-shrink.png)
12 changes: 6 additions & 6 deletions test/features/section_report_section_bottom_margin/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Section Bottom Margin

section の下余白(bottom margin)とは、section のコンテンツの下位置と、section の下位置との間の距離である。
The bottom margin of a section is the distance between the bottom position of the section content and the bottom position of the section.

- [Example code](test_feature.rb)
- [Example template file](template.tlf)
- [Example PDF](expect.pdf)


「下余白に影響(affect-bottom-margin)」が無効の item は、下余白には影響しない。
An item whose affect-bottom-margin is disabled does not affect the calculation of the bottom margin.

![](images/bottom-margin-diagram-1.png)

上図の例の場合、item3 は「下余白に影響」が無効なので、下余白には影響しない。
item2 の下位置が「sectionのコンテンツの下位置」となるため、item2の下位置と section の下位置の間(グレーの網掛けの部分)が、この section の下余白となる。
In the example above, item3 does not affect the bottom margin because affect-bottom-margin is disabled.

Since the bottom position of item2 is the bottom position of the section content, the space between the bottoom position of item2 and the bottom position of the section (the gray shaded area) is the bottom margin of this section.

section の自動伸縮が有効のときは、section の下余白を保った状態で section が自動的に伸縮する。詳細は [Section Auto Stretch](../section_report_section_auto_stretch/README.md) を参照
When auto-stretch is enabled, the section will be automatically stretched while keepking the bottom margin of the section. See [Section Auto Stretch](../section_report_section_auto_stretch/README.md) for details.
10 changes: 5 additions & 5 deletions test/features/section_report_section_parameters/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Section Parameter

section の定義時のプロパティの一部はパラメータで変更することができる。
Some properties in the definition of each section can be changed by parameters.

- [Example code](test_feature.rb)
- [Example template file](template.tlf)
- [Example PDF](expect.pdf)

## 表示
## Display

header と footer は `display` プロパティで表示または非表示にすることができる。
Headers and footers can be shown or hidden with the display property.

```
header_and_footer: {
display: Boolean
}
```

## 最小の高さ
## Minimum height

`min_height` プロパティで section の描画時の最小の高さを指定することができる。
The min_height property can be used to set the minimum height of a section.

```
header_and_footer: {
Expand Down