FreshMarker Includes (2)

In the first article on the Include Directive, I showed how this directive can be implemented in FreshMarker. Although additional content can now be inserted into the template, some additional details are still missing. An important detail is the avoidance of recursive includes. These usually never end well. The following template recursive.fmt shows the simplest form of the problem.

FreshMarker Includes

Some time ago I had the pleasure of giving a talk about FreshMarker at the Java User Group Bielefeld. At this event, the question arose as to why FreshMarker does not have an include directive like FreeMarker. The include directive can be used in FreeMarker to insert additional content into templates.

FreshMarker bei der JUG Bielefeld

Am 8. Januar 2025 ist es soweit, der erste Vortrag über die Template Engine FreshMarker. Um 18 Uhr stelle ich die Kernfunktionalitäten der Engine vor und erläutere außerdem, was ein Entwickler neben dem Programmieren, sonst noch alles beachten muss. https://www.meetup.com/de-DE/de-DE/java-user-group-bielefeld/events/305164577

Lorem ipsum dolor sit amet

The title of this article is no mistake. Anyone who has looked at the FreshMarker Random plugin recently will probably have discovered the new sentence and paragraph built-ins. These two bilt-ins support the library with the generation of the famous Lorem Ipsum pseudo-texts. Without delving deep into history, the Lorem Ipsum texts are a corruption of a Cicero text and serve as dummy texts.

FreshMarker – Groundhog Day

The moment is a wonderful thing, but not for software developers, because it keeps on moving. How can you write a test if the value changes with every test run? Functionality has always been an abomination that concealed some form of now. In FreshMarker, for example, this little monster can be found in the built-in variable .now.

FreshMarker Random Plug-In

The topic of randomness has visited this blog several times. There was a post about the Voses algorithm and random values in JUnit 5 Test. So why not provide random values in FreshMarker. Since random values are rarely needed in templates, this extension is not realized in FreshMarker itself, but in a separate plugin. In addition, this is a good opportunity to demonstrate the FreshMarker plugin mechanism.

FreshMarker I18N

Internationalization, or I18N for short, is a skill that every modern software must master. Long gone are the days when software could only offer an English only interface. Localizable values such as dates and numbers can always be output in FreshMarker using the language-specific formatter. The situation is different with terms that need to be adapted to the language of the document.

Even more about Ranges

In the last article on FreshMarker Ranges, the Right-limited Exclusive Ranges and Length-limited Ranges were introduced. They were not part of the FreshMarker Ranges support for quite some time. Previously, it was only possible to create regular ranges with the Length-limited Ranges syntax, i.e. ranges that represent monotonically increasing sequences. The reason is simply illustrated … Read more

List Directives with filter and limit

One of the fundamental design decisions for FreshMarker is always the question of whether a feature is actually needed or whether pre-processing the data can solve the problem. This is always a delicate balancing act, because any unnecessary pre-processing casts a shadow on the attractiveness of the template engine. It’s always a question of whether … Read more

FreshMarker Bricks

In a Reddit forum, a suggestion was made to support template fragments in FreshMarker. Template fragments are parts of a template that can be used individually. The question that naturally arises is why would you want to use parts of a template individually? After all, many template engines offer the option of construct a template from different sources using include instructions. Such an include can then also be used individually.