Template Engine

From PCGen Wiki
Revision as of 04:25, 28 September 2010 by James (talk | contribs) (Add Reasons for change)
Jump to: navigation, search

Template Engine Sub Project

The aim of the project is to examine the Freemarker library with a view to using it to replace our export engine. In particular it would cover functionality logic functions like looping and if tests. This would leave our code to deal with the important things like TO HIT values etc.

We would do this in three phases:

  1. Add support for Freemarker templates for output
  2. Once sufficient sheets have been converted/rewritten, deprecate support for olod sheet types
  3. Finally after a few releases, remove support for the old sheet types.

There are a few reasons for exploring this change

  • Add a richer set of logic commands to enable more customisable output
  • Simpler more consistent logic commands and more widely understood syntax
  • Remove one of the more complex and difficult to maintain sections of the PCGen code base.

Phase 1

The aim would be to utilise the already built output system and add a function that can be called from a template (output sheet) to allow the existing output tags to be called. This would give us a simple change-over and use our existing well tested output code base.

So for example we might have

<@pcgen tag="NAME"/> or <@pcgen tag="SPELLMEM.0.1.1.1.|NAME|"/>

We would need to ensure that freemarker templates can be used in html, and PDF output styles.