Pulling together the pieces of a document using include pragmas is fine, but BLUEPHRASE goes one further with its innovative enclosure templating.
Enclosures are a way to wrap a portion of your body matter with template-driven framing. This innovative approach to templates opens up new possibilities. Two of the most exciting are:
Allowing complex decorations to be applied to elements without cluttering up your main composition.
Wrapping the entire body of your composition with headers, footers, and menus.
The mechanism
The BLUEPHRASEenclosure pragma behaves similar to its cousin, the include pragma, but instead of injecting the contents of the template file into your composition, it wraps the template file's contents around a portion of your composition.
The enclosure notation is straightforward: it identifies an element or class of elements as its target, and it specifies where your target matter should be placed within its body.
Example
Here's an enclosure pragma that targets a single element of your composition with an identifier of #story:
!enclosure #story `./enclosures/story.blue`
Here's an enclosure pragma that targets every element in your composition that has a classname of .team-member:
A target-matter pragma is added somewhere within each template file, which becomes the point at which your composition's inner content is placed. Here's what a story.blue template file might look like:
And here's what a team-member.blue template file might look like:
Compiled results
To continue the example, consider a composition that contains this:
When compiled, the resulting HTML will be wrapped with the template content from the two enclosures and will look like this:
With enclosures, you can dramatically simplify your compositions and supercharge your templates!