# Pages in Freemarker

## Creating a FreeMarker Output Sheet

FreeMarker sheets are detected by PCGen by their file name suffix. A template ending in .ftl will be processed by FreeMarker rather than by PCGen’s legacy output engine. The extension of the file to be produced should be immediately before that and preceded by a . or -. So a template to produce html output might be named csheet-first.html.ftl or chseet-compact-html.ftl and PCGen would pick up that it was a template to be processed by FreeMarker template that would produce output of a html file.

## Index : FreeMarker Output Support

Starting from version 6.03.00, PCGen has introduced support for the FreeMarker template engine. FreeMarker is a tool to allow the generation of text files based on templates. FreeMarker brings a powerful, rich language for the creation of output sheets to PCGen. It has far greater capabilities than were provided by PCGen’s venerable output sheet language. These include the ability to define macros and methods to include repeated content as well as understandable looping and logic commands.

## Introduction to FreeMarker

FreeMarker is a template engine that has now been incorporated into PCGen’s export system as an alternative to our venerable export syntax. The FreeMarker engine brings some important benefits: Industry standard syntax Support for macros to output parameterised blocks Improved flow-control and logic instructions Support for including other files, e.g. macro libraries or common blocks Calculations and state within the output template Built-in syntax support in many text editors Here’s

## PCGen Functions

To provide output of PCGen characters we need to be able to access the character data and the output tags. In the FreeMarker documentation they talk about the data model, plus directives and functions. At this time, PCGen does not provide a data model, but instead provides a number of directives and functions that allow access to the character data. Current work is examining the provision of a data model to access characters.

Documentation built with Hugo using the Material theme.