14 Skeletons

Skeletons look a lot like macros (e.g. {{foo}}) and they behave very much like included documents (using the #INC command), but they are expanded before actually parsing the input, i.e. they provide some kind of pre-processor macro expansion facility.

I order to use a skeleton you have to create a file

  • deplate.rc/lib/NAME

or (this one will be preferred if it exists)

  • deplate.rc/lib/FORMATTER/NAME

and enable the skeleton on the command line by using the --skeleton command line option.

Some skeletons (currently only one) are “special”, i.e. not file based but are processed by Deplate::SkeletonExpander#skeleton_#{SPECIAL}(args), where args is a hash:

{{id: NAME}}
This skeleton inserts hopefully unique ID strings that can be used in templates for defining regions.

Skeleton are expanded in place. I.e. the first line of the expansion text is inserted right where the skeleton marker appears in the text. If the expansion begins with an element(a command, a region etc.), the first character in the file should be a newline.

Skeletons are handled like templates (see 5.5.2). This means:

  • All macros and commands available in templates can be used.
  • In certain situations, commands and regions that are valid within templates thus have to be preceded with a backslash in certain conditions in order to avoid premature expansion.

Example 14.1: Skeletons (1)


{arg: which} foo is {arg: @body}.


Bla bla. {{foo which=This: bar}} Bla bla.


Bla bla. This foo is bar. Bla bla.

Example 14.2: Skeletons (2)


\#Native <<{{id: bar.form}}
<form action="" method="get">
<input name="name" type="text" size="30" maxlength="30" value="{arg: name}"/>
<button name="submit" value="1" type="submit">Send</button>
{{id: bar.form}}


    Name :: {arg: name}


Bla bla.
{{bar name=Io mio}}
Bla bla.


Bla bla.


Bla bla.

Prev Home Next
1 Introduction
2 Getting deplate
3 Installation
4 Usage
5 Configuration
6 Input Formats
7 Output Formats
8 Themes
9 Modules
10 Markup
11 Regions
12 Commands
13 Macros
14 Skeletons
15 Variables and options
16 Internals
17 Extending deplate
18 Bibliography
19 Index
About this page