Web Oriented Object Framework

User Guide (Version 0.5b4)

Woof!
User Guide (Version 0.5b4)

Configuring template processors

The template processor that is selected for a page section is based on the file extension of the corresponding file. This mapping between file extensions and template processors is configured in the configuration file by setting the template_processors variable.

To add our Markdown template processor, we add the following to the config/application.cfg configuration file.

init template_processors {
  .wtf  ::woof::wtf
  .md   ::woof::hoedown
}

Files whose extensions .md will now be processed with the ::woof::hoedown command implemented in the previous section. Note it is important to include the WTF entry as well; otherwise, WTF files, including the default layout, will not be processed.

The order of entries in the above list is important. When Woof! looks for a template for a page section, it will look for files with the extensions in the order specified. Generally though, a situation where there are two template files that differ only in their extension is a bug as only the one whose extension comes first in the list will ever be used.

Note that the template search mechanism described in Locating templates which prefers more specific templates over inherited ones still takes precedence over the order of file extensions. For example, the file CONTROLLER-ACTION-SECTION.md template will be selected in preference to CONTROLLER-SECTION.wtf.