<simplesect id="config-syntax-templates" xreflabel="Template Syntax">
  <?dbhtml filename="templates.html" dir="config"?>

  <title>Template Syntax</title>

  <para>
    The pekwm configuration parser supports the use of templates to
    reduce typing. Template support is currently available in
    autoproperties and theme configuration files. Template
    configuration is not fully compatible with the non-template syntax
    and thus requires activation to not break backwards
    compatibility. To enable template parsing start the configuration
    file with the following:
  </para>

  <screen>Require {
	Templates = "True"
}</screen>

  <para>
    Defining templates is just like creating an ordinary section, but
    uses the special name Define. Below is an example defining a
    template named NAME:
  </para>

  <screen>Define = "NAME" {
  Section = "Sub" {
    ValueSub = "Sub Value"
  }
  Value = "Value"
}</screen>

  <para>
    The above defined template can later be used by using the magic
    character @. The below example shows usage of the template NAME in
    a two sections named Name and NameOverride overriding one of the
    template values:
  </para>

  <screen>Section = "Name" {
  @NAME
}
Section = "NameOverride" {
  @NAME
  Value = "Overridden value"
}</screen>

  <para>
    The above example is equivalent of writing the following:
  </para>

  <screen>Section = "Name" {
  Section = "Sub" {
    ValueSub = "Sub Value"
  }
  Value = "Value"
}
Section = "Name" {
  Section = "Sub" {
    ValueSub = "Sub Value"
  }
  Value = "Overridden"
}</screen>

</simplesect>
