You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@freemarker.apache.org by Daniel Dekany <dd...@apache.org> on 2019/01/17 19:13:03 UTC

Opinions about the new ?truncate built-in?

I have added the str?truncate(maxLength) built-in (and its other
variations) to the 2.3-gae head. This is something that users have
requested and implemented their own for who knows how many times, yet
it wasn't added to FreeMarker till now, as there's no single correct
way of text truncation. So what I did is making the algorithm
pluggable, and giving a default that I think reflects a good practice.
I guess most users will just go along (instead of quickly adding some
simplistic #function their own), but those who have other ideas can
still keep using ?truncate.

Please tell your opinions, ideas, or even better, test it!

From https://freemarker.apache.org/builds/fm2/versions_2_3_29.html:
Added new built-ins for truncating text. string?truncate(length)
truncates the text to the given length, and by default adds [...] at
the end if truncation has happened. Truncation happens at word
boundaries, unless the result is too short that way, in which case it
falls back to truncation mid word. There's also ?truncate_w to force
Word Boundary truncation, and ?truncate_c (for Character Boundary)
that doesn't care about word boundaries. The truncation algorithm is
pluggable in the FreeMarker configuration. See the reference for more
details.

Built-in documentation:
https://freemarker.apache.org/builds/fm2/ref_builtins_string.html#ref_builtin_truncate

Related API-s:
https://freemarker.apache.org/builds/fm2/api/freemarker/core/TruncateBuiltinAlgorithm.html
https://freemarker.apache.org/builds/fm2/api/freemarker/core/DefaultTruncateBuiltinAlgorithm.html
https://freemarker.apache.org/builds/fm2/api/freemarker/core/Configurable.html#setTruncateBuiltinAlgorithm-freemarker.core.TruncateBuiltinAlgorithm-

Commit:
https://github.com/apache/freemarker/commit/7c5ef10ef3da3b94fc5cdf9d61c966282b6cd8ac

-- 
Thanks,
 Daniel Dekany


Re: Opinions about the new ?truncate built-in?

Posted by Woonsan Ko <wo...@apache.org>.
On Wed, Mar 6, 2019 at 2:52 AM Daniel Dekany <dd...@apache.org> wrote:
>
> Sorry for the later reply...
>
> I have uploaded the current development version (so now it includes
> the lambda feature as well) to the Maven snapshot repository:
> https://repository.apache.org/content/repositories/snapshots/org/freemarker/freemarker/2.3.29-SNAPSHOT/
> https://repository.apache.org/content/repositories/snapshots/org/freemarker/freemarker-gae/2.3.29-SNAPSHOT/
>
> So, ensure that you have the
> https://repository.apache.org/content/repositories/snapshots/
> repository added to either the project pom.xml (maybe it's already
> there for OFBiz - I think it should be anyway), or to
> ~/.m2/settings.xml as snapshot repository:
>
> Version number is: 2.3.29-SNAPSHOT
>
> Woonsan: This is easier for someone who isn't already set up to build
> FreeMarker. See also:
> https://freemarker.apache.org/committer-howto.html#deploy-snapshot

Right. Makes sense. Thanks for the info!

Woonsan

>
>
> Saturday, March 2, 2019, 12:13:09 PM, Jacques Le Roux wrote:
>
> > Hi Daniel,
> >
> > I tried to test this morning using OFBiz, but I have not much time
> > and freemarker:2.3.29 is not available in Maven (we use Jcenter in our Gradle
> > build, but I have a local m2 repository too)
> >
> > https://maven-repository.com/artifact/org.freemarker/freemarker
> >
> > So I'll wait its release to test except if you can explain me how
> > to circumvent this issue using my local m2 repository too
> >
> > Thanks
> >
> > Jacques
> >
> > Le 17/01/2019 à 20:13, Daniel Dekany a écrit :
> >> I have added the str?truncate(maxLength) built-in (and its other
> >> variations) to the 2.3-gae head. This is something that users have
> >> requested and implemented their own for who knows how many times, yet
> >> it wasn't added to FreeMarker till now, as there's no single correct
> >> way of text truncation. So what I did is making the algorithm
> >> pluggable, and giving a default that I think reflects a good practice.
> >> I guess most users will just go along (instead of quickly adding some
> >> simplistic #function their own), but those who have other ideas can
> >> still keep using ?truncate.
> >>
> >> Please tell your opinions, ideas, or even better, test it!
> >>
> >> >From https://freemarker.apache.org/builds/fm2/versions_2_3_29.html:
> >> Added new built-ins for truncating text. string?truncate(length)
> >> truncates the text to the given length, and by default adds [...] at
> >> the end if truncation has happened. Truncation happens at word
> >> boundaries, unless the result is too short that way, in which case it
> >> falls back to truncation mid word. There's also ?truncate_w to force
> >> Word Boundary truncation, and ?truncate_c (for Character Boundary)
> >> that doesn't care about word boundaries. The truncation algorithm is
> >> pluggable in the FreeMarker configuration. See the reference for more
> >> details.
> >>
> >> Built-in documentation:
> >> https://freemarker.apache.org/builds/fm2/ref_builtins_string.html#ref_builtin_truncate
> >>
> >> Related API-s:
> >> https://freemarker.apache.org/builds/fm2/api/freemarker/core/TruncateBuiltinAlgorithm.html
> >> https://freemarker.apache.org/builds/fm2/api/freemarker/core/DefaultTruncateBuiltinAlgorithm.html
> >> https://freemarker.apache.org/builds/fm2/api/freemarker/core/Configurable.html#setTruncateBuiltinAlgorithm-freemarker.core.TruncateBuiltinAlgorithm-
> >>
> >> Commit:
> >> https://github.com/apache/freemarker/commit/7c5ef10ef3da3b94fc5cdf9d61c966282b6cd8ac
> >>
> >
>
> --
> Thanks,
>  Daniel Dekany
>

Re: Opinions about the new ?truncate built-in?

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Daniel,

It will be delayed but I should test it this week

Jacques

Le 06/03/2019 à 08:52, Daniel Dekany a écrit :
> Sorry for the later reply...
>
> I have uploaded the current development version (so now it includes
> the lambda feature as well) to the Maven snapshot repository:
> https://repository.apache.org/content/repositories/snapshots/org/freemarker/freemarker/2.3.29-SNAPSHOT/
> https://repository.apache.org/content/repositories/snapshots/org/freemarker/freemarker-gae/2.3.29-SNAPSHOT/
>
> So, ensure that you have the
> https://repository.apache.org/content/repositories/snapshots/
> repository added to either the project pom.xml (maybe it's already
> there for OFBiz - I think it should be anyway), or to
> ~/.m2/settings.xml as snapshot repository:
>
> Version number is: 2.3.29-SNAPSHOT
>
> Woonsan: This is easier for someone who isn't already set up to build
> FreeMarker. See also:
> https://freemarker.apache.org/committer-howto.html#deploy-snapshot
>
>
> Saturday, March 2, 2019, 12:13:09 PM, Jacques Le Roux wrote:
>
>> Hi Daniel,
>>
>> I tried to test this morning using OFBiz, but I have not much time
>> and freemarker:2.3.29 is not available in Maven (we use Jcenter in our Gradle
>> build, but I have a local m2 repository too)
>>
>> https://maven-repository.com/artifact/org.freemarker/freemarker
>>
>> So I'll wait its release to test except if you can explain me how
>> to circumvent this issue using my local m2 repository too
>>
>> Thanks
>>
>> Jacques
>>
>> Le 17/01/2019 à 20:13, Daniel Dekany a écrit :
>>> I have added the str?truncate(maxLength) built-in (and its other
>>> variations) to the 2.3-gae head. This is something that users have
>>> requested and implemented their own for who knows how many times, yet
>>> it wasn't added to FreeMarker till now, as there's no single correct
>>> way of text truncation. So what I did is making the algorithm
>>> pluggable, and giving a default that I think reflects a good practice.
>>> I guess most users will just go along (instead of quickly adding some
>>> simplistic #function their own), but those who have other ideas can
>>> still keep using ?truncate.
>>>
>>> Please tell your opinions, ideas, or even better, test it!
>>>
>>> >From https://freemarker.apache.org/builds/fm2/versions_2_3_29.html:
>>> Added new built-ins for truncating text. string?truncate(length)
>>> truncates the text to the given length, and by default adds [...] at
>>> the end if truncation has happened. Truncation happens at word
>>> boundaries, unless the result is too short that way, in which case it
>>> falls back to truncation mid word. There's also ?truncate_w to force
>>> Word Boundary truncation, and ?truncate_c (for Character Boundary)
>>> that doesn't care about word boundaries. The truncation algorithm is
>>> pluggable in the FreeMarker configuration. See the reference for more
>>> details.
>>>
>>> Built-in documentation:
>>> https://freemarker.apache.org/builds/fm2/ref_builtins_string.html#ref_builtin_truncate
>>>
>>> Related API-s:
>>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/TruncateBuiltinAlgorithm.html
>>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/DefaultTruncateBuiltinAlgorithm.html
>>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/Configurable.html#setTruncateBuiltinAlgorithm-freemarker.core.TruncateBuiltinAlgorithm-
>>>
>>> Commit:
>>> https://github.com/apache/freemarker/commit/7c5ef10ef3da3b94fc5cdf9d61c966282b6cd8ac
>>>

Re: Opinions about the new ?truncate built-in?

Posted by Daniel Dekany <dd...@apache.org>.
Sorry for the later reply...

I have uploaded the current development version (so now it includes
the lambda feature as well) to the Maven snapshot repository:
https://repository.apache.org/content/repositories/snapshots/org/freemarker/freemarker/2.3.29-SNAPSHOT/
https://repository.apache.org/content/repositories/snapshots/org/freemarker/freemarker-gae/2.3.29-SNAPSHOT/

So, ensure that you have the
https://repository.apache.org/content/repositories/snapshots/
repository added to either the project pom.xml (maybe it's already
there for OFBiz - I think it should be anyway), or to
~/.m2/settings.xml as snapshot repository:

Version number is: 2.3.29-SNAPSHOT

Woonsan: This is easier for someone who isn't already set up to build
FreeMarker. See also:
https://freemarker.apache.org/committer-howto.html#deploy-snapshot


Saturday, March 2, 2019, 12:13:09 PM, Jacques Le Roux wrote:

> Hi Daniel,
>
> I tried to test this morning using OFBiz, but I have not much time
> and freemarker:2.3.29 is not available in Maven (we use Jcenter in our Gradle
> build, but I have a local m2 repository too)
>
> https://maven-repository.com/artifact/org.freemarker/freemarker
>
> So I'll wait its release to test except if you can explain me how
> to circumvent this issue using my local m2 repository too
>
> Thanks
>
> Jacques
>
> Le 17/01/2019 à 20:13, Daniel Dekany a écrit :
>> I have added the str?truncate(maxLength) built-in (and its other
>> variations) to the 2.3-gae head. This is something that users have
>> requested and implemented their own for who knows how many times, yet
>> it wasn't added to FreeMarker till now, as there's no single correct
>> way of text truncation. So what I did is making the algorithm
>> pluggable, and giving a default that I think reflects a good practice.
>> I guess most users will just go along (instead of quickly adding some
>> simplistic #function their own), but those who have other ideas can
>> still keep using ?truncate.
>>
>> Please tell your opinions, ideas, or even better, test it!
>>
>> >From https://freemarker.apache.org/builds/fm2/versions_2_3_29.html:
>> Added new built-ins for truncating text. string?truncate(length)
>> truncates the text to the given length, and by default adds [...] at
>> the end if truncation has happened. Truncation happens at word
>> boundaries, unless the result is too short that way, in which case it
>> falls back to truncation mid word. There's also ?truncate_w to force
>> Word Boundary truncation, and ?truncate_c (for Character Boundary)
>> that doesn't care about word boundaries. The truncation algorithm is
>> pluggable in the FreeMarker configuration. See the reference for more
>> details.
>>
>> Built-in documentation:
>> https://freemarker.apache.org/builds/fm2/ref_builtins_string.html#ref_builtin_truncate
>>
>> Related API-s:
>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/TruncateBuiltinAlgorithm.html
>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/DefaultTruncateBuiltinAlgorithm.html
>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/Configurable.html#setTruncateBuiltinAlgorithm-freemarker.core.TruncateBuiltinAlgorithm-
>>
>> Commit:
>> https://github.com/apache/freemarker/commit/7c5ef10ef3da3b94fc5cdf9d61c966282b6cd8ac
>>
>

-- 
Thanks,
 Daniel Dekany


Re: Opinions about the new ?truncate built-in?

Posted by Woonsan Ko <wo...@apache.org>.
On Mon, Mar 4, 2019 at 1:29 PM Jacques Le Roux
<ja...@les7arts.com> wrote:
>
> Thanks Woonsan,
You're welcome. :-)
BTW, if not done yet, please follow the "Building FreeMarker" section
in the README.md file. That is,
- `ant download-ivy` if ivy isn't installed yet on your machine.
- Copy build.properties.sample to build.properties. Just set
"boot.classpath.j2se1.8=..." property and "mvnCommand=..." property
for your env. You can comment out "boot.classpath.j2se1.5" and
"boot.classpath.j2se1.6" on JDK 1.8.

That will be it.

Woonsan

>
> I'll do that :)
>
> Jacques
>
> Le 04/03/2019 à 06:20, Woonsan Ko a écrit :
> > On Sat, Mar 2, 2019 at 6:15 AM Jacques Le Roux
> > <ja...@les7arts.com> wrote:
> >> Hi Daniel,
> >>
> >> I tried to test this morning using OFBiz, but I have not much time and freemarker:2.3.29 is not available in Maven (we use Jcenter in our Gradle
> >> build, but I have a local m2 repository too)
> >>
> >> https://maven-repository.com/artifact/org.freemarker/freemarker
> >>
> >> So I'll wait its release to test except if you can explain me how to circumvent this issue using my local m2 repository too
> > For another feature (lambda), I tested the feature with a local maven install:
> >
> > 1. Pull and check out 2.3 branch. (I had to use 2.3-gae branch for
> > lambda feature, but the feature in this thread was also in 2.3
> > branch.)
> > 2. Build with `ant jar maven-install` (which will build and install
> > the jar into your local maven repo.)
> > 3. Change the FreeMarker dependency version in your project to 2.3.29-SNAPHSOT.
> > 4. Build/run/test your project.
> >
> > Regards,
> >
> > Woonsan
> >
> >> Thanks
> >>
> >> Jacques
> >>
> >> Le 17/01/2019 à 20:13, Daniel Dekany a écrit :
> >>> I have added the str?truncate(maxLength) built-in (and its other
> >>> variations) to the 2.3-gae head. This is something that users have
> >>> requested and implemented their own for who knows how many times, yet
> >>> it wasn't added to FreeMarker till now, as there's no single correct
> >>> way of text truncation. So what I did is making the algorithm
> >>> pluggable, and giving a default that I think reflects a good practice.
> >>> I guess most users will just go along (instead of quickly adding some
> >>> simplistic #function their own), but those who have other ideas can
> >>> still keep using ?truncate.
> >>>
> >>> Please tell your opinions, ideas, or even better, test it!
> >>>
> >>> >From https://freemarker.apache.org/builds/fm2/versions_2_3_29.html:
> >>> Added new built-ins for truncating text. string?truncate(length)
> >>> truncates the text to the given length, and by default adds [...] at
> >>> the end if truncation has happened. Truncation happens at word
> >>> boundaries, unless the result is too short that way, in which case it
> >>> falls back to truncation mid word. There's also ?truncate_w to force
> >>> Word Boundary truncation, and ?truncate_c (for Character Boundary)
> >>> that doesn't care about word boundaries. The truncation algorithm is
> >>> pluggable in the FreeMarker configuration. See the reference for more
> >>> details.
> >>>
> >>> Built-in documentation:
> >>> https://freemarker.apache.org/builds/fm2/ref_builtins_string.html#ref_builtin_truncate
> >>>
> >>> Related API-s:
> >>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/TruncateBuiltinAlgorithm.html
> >>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/DefaultTruncateBuiltinAlgorithm.html
> >>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/Configurable.html#setTruncateBuiltinAlgorithm-freemarker.core.TruncateBuiltinAlgorithm-
> >>>
> >>> Commit:
> >>> https://github.com/apache/freemarker/commit/7c5ef10ef3da3b94fc5cdf9d61c966282b6cd8ac
> >>>

Re: Opinions about the new ?truncate built-in?

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Woonsan,

I'll do that :)

Jacques

Le 04/03/2019 à 06:20, Woonsan Ko a écrit :
> On Sat, Mar 2, 2019 at 6:15 AM Jacques Le Roux
> <ja...@les7arts.com> wrote:
>> Hi Daniel,
>>
>> I tried to test this morning using OFBiz, but I have not much time and freemarker:2.3.29 is not available in Maven (we use Jcenter in our Gradle
>> build, but I have a local m2 repository too)
>>
>> https://maven-repository.com/artifact/org.freemarker/freemarker
>>
>> So I'll wait its release to test except if you can explain me how to circumvent this issue using my local m2 repository too
> For another feature (lambda), I tested the feature with a local maven install:
>
> 1. Pull and check out 2.3 branch. (I had to use 2.3-gae branch for
> lambda feature, but the feature in this thread was also in 2.3
> branch.)
> 2. Build with `ant jar maven-install` (which will build and install
> the jar into your local maven repo.)
> 3. Change the FreeMarker dependency version in your project to 2.3.29-SNAPHSOT.
> 4. Build/run/test your project.
>
> Regards,
>
> Woonsan
>
>> Thanks
>>
>> Jacques
>>
>> Le 17/01/2019 à 20:13, Daniel Dekany a écrit :
>>> I have added the str?truncate(maxLength) built-in (and its other
>>> variations) to the 2.3-gae head. This is something that users have
>>> requested and implemented their own for who knows how many times, yet
>>> it wasn't added to FreeMarker till now, as there's no single correct
>>> way of text truncation. So what I did is making the algorithm
>>> pluggable, and giving a default that I think reflects a good practice.
>>> I guess most users will just go along (instead of quickly adding some
>>> simplistic #function their own), but those who have other ideas can
>>> still keep using ?truncate.
>>>
>>> Please tell your opinions, ideas, or even better, test it!
>>>
>>> >From https://freemarker.apache.org/builds/fm2/versions_2_3_29.html:
>>> Added new built-ins for truncating text. string?truncate(length)
>>> truncates the text to the given length, and by default adds [...] at
>>> the end if truncation has happened. Truncation happens at word
>>> boundaries, unless the result is too short that way, in which case it
>>> falls back to truncation mid word. There's also ?truncate_w to force
>>> Word Boundary truncation, and ?truncate_c (for Character Boundary)
>>> that doesn't care about word boundaries. The truncation algorithm is
>>> pluggable in the FreeMarker configuration. See the reference for more
>>> details.
>>>
>>> Built-in documentation:
>>> https://freemarker.apache.org/builds/fm2/ref_builtins_string.html#ref_builtin_truncate
>>>
>>> Related API-s:
>>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/TruncateBuiltinAlgorithm.html
>>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/DefaultTruncateBuiltinAlgorithm.html
>>> https://freemarker.apache.org/builds/fm2/api/freemarker/core/Configurable.html#setTruncateBuiltinAlgorithm-freemarker.core.TruncateBuiltinAlgorithm-
>>>
>>> Commit:
>>> https://github.com/apache/freemarker/commit/7c5ef10ef3da3b94fc5cdf9d61c966282b6cd8ac
>>>

Re: Opinions about the new ?truncate built-in?

Posted by Woonsan Ko <wo...@apache.org>.
On Sat, Mar 2, 2019 at 6:15 AM Jacques Le Roux
<ja...@les7arts.com> wrote:
>
> Hi Daniel,
>
> I tried to test this morning using OFBiz, but I have not much time and freemarker:2.3.29 is not available in Maven (we use Jcenter in our Gradle
> build, but I have a local m2 repository too)
>
> https://maven-repository.com/artifact/org.freemarker/freemarker
>
> So I'll wait its release to test except if you can explain me how to circumvent this issue using my local m2 repository too

For another feature (lambda), I tested the feature with a local maven install:

1. Pull and check out 2.3 branch. (I had to use 2.3-gae branch for
lambda feature, but the feature in this thread was also in 2.3
branch.)
2. Build with `ant jar maven-install` (which will build and install
the jar into your local maven repo.)
3. Change the FreeMarker dependency version in your project to 2.3.29-SNAPHSOT.
4. Build/run/test your project.

Regards,

Woonsan

>
> Thanks
>
> Jacques
>
> Le 17/01/2019 à 20:13, Daniel Dekany a écrit :
> > I have added the str?truncate(maxLength) built-in (and its other
> > variations) to the 2.3-gae head. This is something that users have
> > requested and implemented their own for who knows how many times, yet
> > it wasn't added to FreeMarker till now, as there's no single correct
> > way of text truncation. So what I did is making the algorithm
> > pluggable, and giving a default that I think reflects a good practice.
> > I guess most users will just go along (instead of quickly adding some
> > simplistic #function their own), but those who have other ideas can
> > still keep using ?truncate.
> >
> > Please tell your opinions, ideas, or even better, test it!
> >
> > >From https://freemarker.apache.org/builds/fm2/versions_2_3_29.html:
> > Added new built-ins for truncating text. string?truncate(length)
> > truncates the text to the given length, and by default adds [...] at
> > the end if truncation has happened. Truncation happens at word
> > boundaries, unless the result is too short that way, in which case it
> > falls back to truncation mid word. There's also ?truncate_w to force
> > Word Boundary truncation, and ?truncate_c (for Character Boundary)
> > that doesn't care about word boundaries. The truncation algorithm is
> > pluggable in the FreeMarker configuration. See the reference for more
> > details.
> >
> > Built-in documentation:
> > https://freemarker.apache.org/builds/fm2/ref_builtins_string.html#ref_builtin_truncate
> >
> > Related API-s:
> > https://freemarker.apache.org/builds/fm2/api/freemarker/core/TruncateBuiltinAlgorithm.html
> > https://freemarker.apache.org/builds/fm2/api/freemarker/core/DefaultTruncateBuiltinAlgorithm.html
> > https://freemarker.apache.org/builds/fm2/api/freemarker/core/Configurable.html#setTruncateBuiltinAlgorithm-freemarker.core.TruncateBuiltinAlgorithm-
> >
> > Commit:
> > https://github.com/apache/freemarker/commit/7c5ef10ef3da3b94fc5cdf9d61c966282b6cd8ac
> >

Re: Opinions about the new ?truncate built-in?

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Daniel,

I tried to test this morning using OFBiz, but I have not much time and freemarker:2.3.29 is not available in Maven (we use Jcenter in our Gradle 
build, but I have a local m2 repository too)

https://maven-repository.com/artifact/org.freemarker/freemarker

So I'll wait its release to test except if you can explain me how to circumvent this issue using my local m2 repository too

Thanks

Jacques

Le 17/01/2019 à 20:13, Daniel Dekany a écrit :
> I have added the str?truncate(maxLength) built-in (and its other
> variations) to the 2.3-gae head. This is something that users have
> requested and implemented their own for who knows how many times, yet
> it wasn't added to FreeMarker till now, as there's no single correct
> way of text truncation. So what I did is making the algorithm
> pluggable, and giving a default that I think reflects a good practice.
> I guess most users will just go along (instead of quickly adding some
> simplistic #function their own), but those who have other ideas can
> still keep using ?truncate.
>
> Please tell your opinions, ideas, or even better, test it!
>
> >From https://freemarker.apache.org/builds/fm2/versions_2_3_29.html:
> Added new built-ins for truncating text. string?truncate(length)
> truncates the text to the given length, and by default adds [...] at
> the end if truncation has happened. Truncation happens at word
> boundaries, unless the result is too short that way, in which case it
> falls back to truncation mid word. There's also ?truncate_w to force
> Word Boundary truncation, and ?truncate_c (for Character Boundary)
> that doesn't care about word boundaries. The truncation algorithm is
> pluggable in the FreeMarker configuration. See the reference for more
> details.
>
> Built-in documentation:
> https://freemarker.apache.org/builds/fm2/ref_builtins_string.html#ref_builtin_truncate
>
> Related API-s:
> https://freemarker.apache.org/builds/fm2/api/freemarker/core/TruncateBuiltinAlgorithm.html
> https://freemarker.apache.org/builds/fm2/api/freemarker/core/DefaultTruncateBuiltinAlgorithm.html
> https://freemarker.apache.org/builds/fm2/api/freemarker/core/Configurable.html#setTruncateBuiltinAlgorithm-freemarker.core.TruncateBuiltinAlgorithm-
>
> Commit:
> https://github.com/apache/freemarker/commit/7c5ef10ef3da3b94fc5cdf9d61c966282b6cd8ac
>