-
Notifications
You must be signed in to change notification settings - Fork 1
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
Custom placeholders implementation #10
Comments
The way I see it, a custom placeholder library adds a lot of complexity to jocument seperated from the actual generating work. |
Codecitizen:
We already have a plugin system, since you can easily implement custom placeholders, but we have to make PlaceholderResolver an abstract class and add some registration/resolving logic. Like a program or template global custom placeholder registry. Would do in a separate issue. I like how hamcrest separates its dependencies into hamcrest-core for the assertion mechanism and hamcrest-library for their standard lib. We could do jocuments-core jocuments-docx-elements jocuments-xlsx-elements or by type jocuments-table-elements .... |
Seems like a reasonable approach to me aswell +1 Re packaging: Maybe like some apache projects, where the exposed packages are actually just wrapping of functionality taken from some repositories, so a placeholder resolver could be in multiple repositories? |
Codecitizen:
I guess we should see the registration of customer palceholder defintions at the resolver level. The resolver is the component responsible for deciding how to replace a placeholder. So it should detect if its custom and if there's a implementation for it. I could imagine this either being passed to the template or resolver directly as registry object or with an additional aspect oriented approach, where you place annotations on the resolver functions / clases (e.g. @DocumentPlaceholder(name = "PICTUER-TABLE", mimeTypes = {DOCX,XLSX})).
You mean like use case oriented? Like in Apache Commons? |
I like the Aspect oriented approach, generally I think the placeholders should be registered at the resolver, not the template, since the control of the generation service should be in the hands of the developers and not the user.
Yes |
Codecitizen: |
If possible, placeholders should also be parameterisable (like e.g {{image https://www.example.com/image.jpg}}) |
First sketch for how this could work:
TODO: Determine whether necessary/how to do context passing in aspects |
The concept of placeholders can be used to integrate optional functionality into the jocument library.
This could, for example, be tables of contents, custom processing of external files (inserting the abstract of a report).
In this issue, the implementation details of a "custom placeholder" standard library are discussed, for custom placeholder suggestions see #9.
The text was updated successfully, but these errors were encountered: