FreshMarker 2.7.0 – New Release!

After two months of development, I’m pleased to announce the release of FreshMarker version 2.7.0. This time, the focus was on functional hash processing, more flexible formatting, and a major step toward a more consistent template syntax. Overall, it’s a well-rounded mix of new expression capabilities and improved code quality in templates. New Features Deprecation … Read more

The End of Loose Tag End

While designing a new feature, I once again stumbled upon a feature of the template language that I haven’t liked for a long time. The syntax of the directives is modeled after HTML elements, not XML elements. As long as you don’t want to change the syntax of the template language, this isn’t a problem. But if you have a great idea for a new feature, you’re in for a world of trouble.

Partial Reduction of Range Lists

One of the most useful optimizations in FreshMarker is partial reduction: templates can be partially evaluated in advance if part of the model is already known. Until now, however, partial reduction had a blind spot—List directives with ranges (1..4, 4..1, 1..) were ignored during reduction and passed through as simple, non-reducing fragments. This changes with version 2.7.0.

Nested Directives with Parameters

When replicating the concepts of another template engine, there are always moments when you put off working on a particular concept. This rarely has anything to do with the complexity of the concept itself, but often stems from a personal aversion. For FreshMarker, this has meant that some concepts have been implemented late or completely reworked. Some concepts are still awaiting implementation. One of these concepts is the parameters of the nested directive, which will be implemented for FreshMarker 2.7.0.

The General Concatenation Operator

The FreshMarker Template Language provides two operators for concatenating string values: the string concatenation operators + and ~. Both operators produce a string from their two operands. The difference between the two operators lies in the way the strings are joined together. The unique feature of the ~ operator leads us to the new general concatenation operator.

Auto Hemisphere

Some implementations aren’t based on clever technical tricks, but rather on sheer diligence. That’s why it took FreshMarker Astro quite a while to finally figure out which side of the world a template engine instance is currently located on. The following article describes how FreshMarker Astro managed to get out of this predicament and almost always guesses the hemisphere correctly.

Enum Hashes

FreshMarker is based on the concepts of another template engine. This is evident from its directives, interpolations, and, of course, its name. Another detail also betrays its origins. The types in the FreshMarker Template Language for collections are sequences and hashes. Hashes represent mappings from strings to values. We now want to relax this restriction.