Skip to content

Implement "New Report Type: Section Report" #12

@hidakatsuya

Description

@hidakatsuya

Summary

We have implemented the section-report format proposed at the Issue: New Report Type: SectionReport, and created pull requests for the generator and the editor respectively.

We are actually using this implementation in our products and would like to provide this to the Thinreports community.

However, our current implementation is incomplete and still have some issues to discuss. We would like to discuss how to solve those issues, how to proceed with the development, and work with the community towards the release of the section-report format.

Specification

The specifications of our section report implementation is based on the Issue: New Report Type: SectionReport.

Issues

However, the current implementation contains specifications that differ from the Issue: New Report Type: SectionReport, features that we added independently, and specifications that we have not been implemented. There are also some known issues. See the Implementation Status section of each pull request for details.

Examples

We have created some examples of the section-report format features as feature tests for the generator. Each example includes a description of the specifications, a Ruby code, a template file, and an output PDF file.

Note

Our blog post about the section-report format may be helpful:

Getting Started

Installing

See the Getting Started section of each pull request.

Hello World

First, create a template.

detailed instructions for creating a template

Launch the editor applicaiton.

img1

Delete the header and footer sections, which are unnecessary in this example.
Click the section region to select, and click 削除 (Delete) in the 編集 (Edit) menu.

img2

Specify the properties of the detail section.
Click the detail section region. In the right property pane, input hello_world as the ID attribute. And enter 100 as the 高さ (height) attribute.

img3

Put a text-block on the detail section.
Select the text-block tool (the red circle in the figure) in the toolbar. And drag and drop in the detail section to create a text-block at the region. You can leave the text-block properties as the default values.

img4

The template is now complete.

This is a simple template which has a detail section whose ID is hello_world. The detail section includes a text-block whose ID is text.

img6

Create a dirctory named hello_world in an arbitrary location, and save the template as template.tlf in the hello_world directory.

Then, create generate.rb in the hello_world directory, and write the following code:

require 'thinreports'

report_params = {
  type: :section,
  layout_file: 'template.tlf',
  params: {
    groups: [
      {
        details: [
          {
            id: 'hello_world',
            items: {
              text: 'Hello World'
            }
          },
          {
            id: 'hello_world',
            items: {
              text: 'Hello Thinreports'
            }
          }
        ]
      }
    ]
  }
}

Thinreports.generate(report_params, filename: 'hello.pdf')

Execute this, and hello.pdf is generated in the hello_world directory.

$ cd /path/to/hello_world
$ ruby generate.rb

hello.pdf:
hello.pdf

Future Development

There are still some issues and unimplemented specifications left. But the section-report format is a huge specification and it would be difficult to complete this on our own. Not only are there insufficient development resources, but there is also a need for discussion to make the specifications optimal for Thinreports.

Based on our implementation, we would like to discuss and develop it gradually with the community.

Specifically, we propose the following development approach:

  1. Merge the current code into the master branch basically as it is.
  2. In issues, discuss and determine specifications and architectures that need to be discussed.
  3. Document the specifications as needed.
  4. Create tasks as issues based on the determined specifications.
  5. Develop based on the tasks.

In order for many developers to participate, we need a foundation such as the specifications and the tasks. It may take some time to put it in place, but we think it is necessary for sustainable development.

It's also a good idea to create small tasks and use labels like good for first issue to make it easier for new developers to join, and use the GitHub Project to clarify the roadmap and development status.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions