You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Philip Schlesinger <ps...@cryoport.com.INVALID> on 2024/08/15 00:30:57 UTC

Linter / Syntax Checker for template files for Engine 2.3?

Hi all,

Where can I find a linter / syntax checker for template files written for Engine 2.3?

Jama Software’s implementation of Velocity Engine 2.3 starts with an export of a Word .mht file.  Jama then adds in data sources and macros.

The _boilerplate_ Velocity template file for a Word document is – I kid you not – 4,408 lines of code.

The amount of code that needs to be touched to customize the template file for one’s own usage: less than 200 lines of code – about 4.5%.

At this time, they do not permit the usage of parent-template.vm and child-template.vm – then using the #parse directive.

So to reduce the chance of a fat-finger, I’ve split the 4,408 lines of code boilerplate file into multiple files – separating out sections where one would customize (title page, header, main body, etc.) from the sections which one should normally not touch (for instance: the CSS that came from the Word .mht file).

With a `cat *.vm` command, voila! We have a unified file again.

Just to be safe, I’d like to run a linter / syntax checker on it.  So far the only checker I’ve found that is built to support Engine 2.3 is `pmd`: https://docs.pmd-code.org/latest/pmd_rules_velocity.html

Even then, I’m not sure if it’s truly doing a thorough lint / syntax check.

The npm velocity-lint hasn’t been updated in 8 years: https://github.com/leemotive/velocity-lint

Velocity-validator last got an update 6 years ago: https://github.com/todvora/velocity-validator

This whole StackOverflow is from 14 years ago: https://stackoverflow.com/questions/1910857/apache-velocity-is-there-a-standard-way-of-verifying-the-correctness-of-a-templ

I’ve seen posts about a “Template Tool” – but I can’t find it – and I’m guessing it hasn’t been supported in years.

Hence my email to the community.

Is there a velocity linter / syntax checker out there that evaluates Engine 2.3 – or is there example code that I can copy/paste to build my own?

Thank you for your assistance!

--

Philip Schlesinger
Solution Architect – Core Systems

[Blue text on a black background  Description automatically generated]<http://www.cryoport.com/>
­­
Office:  +1 (949) 681-2794
24/7/365 Support:  +1 (949) 470-2305

Americas • EMEA • APAC
cryoport.com<http://cryoport.com/>

[A blue circle with white and black logo  Description automatically generated]<https://www.linkedin.com/company/856887>[A blue circle with white x in it  Description automatically generated]<https://twitter.com/cryoport> [A blue circle with a white play button  Description automatically generated] <https://www.youtube.com/user/CryoportVideo>
­­
The information contained in this e-mail message is privileged and confidential information and is intended only for the use of the individual and/or entity identified in the address of this message. If the reader of this message is not the intended recipient, or an employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution, or reliance upon the contents of this email is strictly prohibited. If you have received this communication in error, please notify us by return e-mail. In this circumstance, we request that you delete the original message from your system.


Re: Linter / Syntax Checker for template files for Engine 2.3?

Posted by Nathan Bubna <nb...@gmail.com>.
Your research is fairly complete, so far as i know. I would not scorn,
however, a linter/validator that is old. I don't think we have changed
anything in terms of valid syntax. There were perhaps some subtle changes
and those maybe behind flags even since 2.1 (5+ years ago) and maybe a few
more (additive) changes between 2.0 and 2.1 (7 yrs ago). And even 2.0
itself did not deprecate syntax that i recall, largely it added options and
changed some behavior/API features. I suspect that any 1.x validator will
still be of value in the 2.x era.

Oh, and TemplateTool had not validation/syntax features.

On Wed, Aug 14, 2024 at 5:31 PM Philip Schlesinger
<ps...@cryoport.com.invalid> wrote:

> Hi all,
>
>
>
> Where can I find a linter / syntax checker for template files written for
> Engine 2.3?
>
>
>
> Jama Software’s implementation of Velocity Engine 2.3 starts with an
> export of a Word .mht file.  Jama then adds in data sources and macros.
>
>
>
> The _*boilerplate*_ Velocity template file for a Word document is – I kid
> you not – 4,408 lines of code.
>
>
>
> The amount of code that needs to be touched to customize the template file
> for one’s own usage: less than 200 lines of code – about 4.5%.
>
>
>
> At this time, they do not permit the usage of parent-template.vm and
> child-template.vm – then using the #parse directive.
>
>
>
> So to reduce the chance of a fat-finger, I’ve split the 4,408 lines of
> code boilerplate file into multiple files – separating out sections where
> one would customize (title page, header, main body, etc.) from the sections
> which one should normally not touch (for instance: the CSS that came from
> the Word .mht file).
>
>
>
> With a `cat *.vm` command, voila! We have a unified file again.
>
>
>
> Just to be safe, I’d like to run a linter / syntax checker on it.  So far
> the only checker I’ve found that is built to support Engine 2.3 is `pmd`:
> https://docs.pmd-code.org/latest/pmd_rules_velocity.html
>
>
>
> Even then, I’m not sure if it’s truly doing a thorough lint / syntax check.
>
>
>
> The npm velocity-lint hasn’t been updated in 8 years:
> https://github.com/leemotive/velocity-lint
>
>
>
> Velocity-validator last got an update 6 years ago:
> https://github.com/todvora/velocity-validator
>
>
>
> This whole StackOverflow is from 14 years ago:
> https://stackoverflow.com/questions/1910857/apache-velocity-is-there-a-standard-way-of-verifying-the-correctness-of-a-templ
>
>
>
> I’ve seen posts about a “Template Tool” – but I can’t find it – and I’m
> guessing it hasn’t been supported in years.
>
>
>
> Hence my email to the community.
>
>
>
> Is there a velocity linter / syntax checker out there that evaluates
> Engine 2.3 – or is there example code that I can copy/paste to build my own?
>
>
>
> Thank you for your assistance!
>
>
>
> --
>
>
>
> *Philip Schlesinger*
> *Solution Architect – Core Systems*
>
>
>
> [image: Blue text on a black background Description automatically
> generated] <http://www.cryoport.com/>
>
> *­­*
>
> *Office:  *+1 (949) 681-2794
>
> *24/7/365 Support:  *+1 (949) 470-2305
>
>
>
> *Americas **•** EMEA **•* *APAC*
>
> *cryoport.com* <http://cryoport.com/>
>
>
>
> [image: A blue circle with white and black logo Description automatically
> generated] <https://www.linkedin.com/company/856887>[image: A blue circle
> with white x in it Description automatically generated]
> <https://twitter.com/cryoport> [image: A blue circle with a white play
> button Description automatically generated]
> <https://www.youtube.com/user/CryoportVideo>
>
> ­­
>
> The information contained in this e-mail message is privileged and
> confidential information and is intended only for the use of the individual
> and/or entity identified in the address of this message. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible to deliver it to the intended recipient, you are hereby
> notified that any disclosure, copying, distribution, or reliance upon the
> contents of this email is strictly prohibited. If you have received this
> communication in error, please notify us by return e-mail. In this
> circumstance, we request that you delete the original message from your
> system.
>
>
>