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

Add template engine ADR #11900

Merged
merged 13 commits into from
Oct 23, 2024
Merged

Add template engine ADR #11900

merged 13 commits into from
Oct 23, 2024

Conversation

InAnYan
Copy link
Collaborator

@InAnYan InAnYan commented Oct 9, 2024

Mandatory checks

- [ ] Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
- [ ] Tests created for changes (if applicable)
- [ ] Manually tested changed features in running JabRef (always required)
- [ ] Screenshots added in PR description (for UI changes)
- [ ] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
- [ ] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.


Refs koppor#392

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pleae add an example for each temlating engine. Just reading the pros and cons, one cannot really decide.

I think, the main decision driver is a "nice" syntax. - Please add this as first decision driver.

docs/decisions/0039-template-engine.md Outdated Show resolved Hide resolved
docs/decisions/0039-template-engine.md Outdated Show resolved Hide resolved
docs/decisions/0039-template-engine.md Outdated Show resolved Hide resolved
docs/decisions/0039-template-engine.md Outdated Show resolved Hide resolved
docs/decisions/0039-template-engine.md Outdated Show resolved Hide resolved
docs/decisions/0039-template-engine.md Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You modified Markdown (*.md) files and did not meet JabRef's rules for consistently formatted Markdown files.
To ensure consistent styling, we have markdown-lint in place.
Markdown lint's rules help to keep our Markdown files consistent within this repository and consistent with the Markdown files outside here.

You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "Markdown".

@InAnYan
Copy link
Collaborator Author

InAnYan commented Oct 12, 2024

I think you understand this is unfinished ADR, because I haven't used layout files and template engines much in Java.

I wrote everything for AI, and every option seems to be fine

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You modified Markdown (*.md) files and did not meet JabRef's rules for consistently formatted Markdown files.
To ensure consistent styling, we have markdown-lint in place.
Markdown lint's rules help to keep our Markdown files consistent within this repository and consistent with the Markdown files outside here.

You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "Markdown".

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix linting issues

Add one example for each entry. Maye with an example of #11884.

                    #foreach( $entry in $entries )
                    ${CanonicalBibEntry.getCanonicalRepresentation($entry)}
                    #end""",

The example is good, because it shows

  • forEach loops
  • how to call existing functions

We should also add one function call for JabRef's functions - https://docs.jabref.org/collaborative-work/export/customexports

\format[HTMLChars,AuthorFirstFirst]{\editor}

New probably

$AuthorFirstFirst$(HTMLChars($entry.editor))

I am not sure about $entry.editor. Is it $entry.getField(editor).get()`? -- I don't want the template engine be verbose.

The current code is at org.jabref.logic.layout.LayoutEntry#handleOptionField. (Many class variables 🙈)

  • Add new Decision Driver: Short and understandable syntax. Especially good handling of unset fields and empty Optionals.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You modified Markdown (*.md) files and did not meet JabRef's rules for consistently formatted Markdown files.
To ensure consistent styling, we have markdown-lint in place.
Markdown lint's rules help to keep our Markdown files consistent within this repository and consistent with the Markdown files outside here.

You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "Markdown".

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please all examples consistent

please remove all gempl te placeholders in the options

- Main page: <https://www.thymeleaf.org/>.
- Documentation: <https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html>.

Example (not related to AI):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? 😅

@koppor
Copy link
Member

koppor commented Oct 15, 2024

@koppor
Copy link
Member

koppor commented Oct 15, 2024

Reading the syntax, +1 for Velocity.

Velocity's goal is to keep templates as simple as possible

From: https://stackoverflow.com/a/1984458/873282

And this is what we mainly want!

@koppor koppor mentioned this pull request Oct 16, 2024
4 tasks
@koppor koppor added the status: changes required Pull requests that are not yet complete label Oct 23, 2024
@InAnYan InAnYan removed the status: changes required Pull requests that are not yet complete label Oct 23, 2024
@InAnYan
Copy link
Collaborator Author

InAnYan commented Oct 23, 2024

I chose Apache Velocity

Sorry, on your all behalf :)

I want to complete this ADR

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, text is good enough.

@koppor koppor enabled auto-merge October 23, 2024 16:04
@koppor koppor added this pull request to the merge queue Oct 23, 2024
Merged via the queue into JabRef:main with commit 5c75124 Oct 23, 2024
24 of 25 checks passed
@koppor koppor deleted the template-engine-adr branch October 23, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants