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

Formatting Numbers

Java Bibliotheken

A fundamental assumption of software developers is that the system libraries are error-free and perform well. Every now and then you are taught better, but after a while the memories fade and you hang on to the original misconceptions.

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.

More About Range Expressions

FreshMarker as a Template Engine supports a whole range of data types for its model values. This data type are usually a mapping of the corresponding Java types such as String, Boolean, Long, Beans, Records, List and Maps. In addition, FreshMarker has the data type Range, which describes intervals with a lower and an optional upper limit.

More Operator Overloading

In the previous article on operator overloading, the implementation for the numerical addition and multiplication operators was presented. In this article, some other operators will be provided with this feature and some details will be discussed that should be taken into account when operator overloading.

FreshMarker Operator Overloading

Operator overloading is a programming technique in which an existing operator is extended or adapted to user-defined data types. This makes it possible to design user-defined classes in such a way that they behave syntactically like built-in data types and facilitates intuitive and readable use of these types using the familiar operators. This article presents the integration of operator overloading in FreshMarker.