Lists, Items and Indents
These elements can be used to create lists, items and indented
sections. The html/list and html/item components are included for
completeness but in many cases it's overkill to use them unless you
plan to make your lists and items more fancy than regular <ul>
and <li> elements. The html/indent element is particularly
useful for creating an indented section and is implemented as a
right-aligned table, allowing background colour, internal alignment
and various other parameters to be specified.
Source #1:
[% WRAPPER html/list %]
[%- FOREACH item = [ 'One' 'Two' 'Three' ] -%]
<li>[% item %]</li>
[% END %]
[% END %]
|
HTML Output #1:
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
|
Output #1:
|
|
Source #2:
[% WRAPPER html/list
title = 'Test List Title'
%]
[% "<li>$item</li>\n"
FOREACH item = [ 'Foo' 'Bar' 'Baz' ] -%]
[% END %]
|
HTML Output #2:
<b>Test List Title</b>
<ul>
<li>Foo</li>
<li>Bar</li>
<li>Baz</li>
</ul>
|
Output #2:
Test List Title
|
Source #3:
[% WRAPPER html/list
title = 'Another Test List Title'
%]
[% INCLUDE html/item
title = "Item The First"
content = "This is the first item"
%]
[% INCLUDE html/item
title = "Item The Second"
content = "This is the second item"
%]
[% WRAPPER html/item
title = "Item The Third"
%]
This is the third item
[% END %]
[% END %]
|
Output #3:
Another Test List Title
- Item The First
This is the first item
- Item The Second
This is the second item
- Item The Third
This is the third item
|
|
Source #4:
[% WRAPPER html/list
title = 'Builder'
%]
[%- WRAPPER html/item title="Intent" %]
Separate the construction of a complex object
from its representation so that the same
construction process can create different
representations.
[%- END %]
[%- WRAPPER html/item title="Motivation" %]
A reader for the RTF (Rich Text Format)
document exchange format should be able
to convert RTF to many text formats. . .
[%- END %]
[%- WRAPPER html/item title="Applicability" %]
Use the Builder pattern when
[%- WRAPPER html/list %]
[%- WRAPPER html/item %]
the algorithm for creating a complex object
should be independant of the parts that make
up the object and how they're assembled.
[%- END %]
[%- WRAPPER html/item %]
the construction process must allow
different representations for the objects
that's constructed.
[%- END %]
[%- END %]
[%- END %]
[% END %]
|
Output #4:
Builder
- Intent
Separate the construction of a complex object
from its representation so that the same
construction process can create different
representations.
- Motivation
A reader for the RTF (Rich Text Format)
document exchange format should be able
to convert RTF to many text formats. . .
- Applicability
Use the Builder pattern when
-
the algorithm for creating a complex object
should be independant of the parts that make
up the object and how they're assembled.
-
the construction process must allow
different representations for the objects
that's constructed.
|
|
Source #5:
The cat sat on the mat.
[% INCLUDE html/indent
content='The dog sat on the log.'
%]
The fish lay on the dish.
|
Output #5:
The cat sat on the mat.
The fish lay on the dish.
|
|
Source #6:
[% WRAPPER html/indent %]
<p>
Anyone who has to work in noise, in offices with
people all around, needs to be able to pause and
refresh himself with quiet in a more natural
situation.
</p>
<div align="right">
<b>59: Quiet Backs</b>
<br>
A Pattern Language, Christopher Alexander et al.
<br>
1977, Oxford University Press, ISBN: 0-19-501919-9
</p>
[% END %]
|
Output #6:
Anyone who has to work in noise, in offices with
people all around, needs to be able to pause and
refresh himself with quiet in a more natural
situation.
59: Quiet Backs
A Pattern Language, Christopher Alexander et al.
1977, Oxford University Press, ISBN: 0-19-501919-9
|
|
|
Source #7:
[% WRAPPER html/indent width='50%' %]
The cat sat on the mat
[% END %]
[% WRAPPER html/indent width='50%' align='middle' %]
The dog sat on the log
[% END %]
[% WRAPPER html/indent width='50%' align='right' %]
The fish lay on the dish
[% END %]
|
Output #7:
|
|
Source #8:
[% WRAPPER html/indent
col = rgb.grey75
width = '50%'
pad = 10
%]
<p>
Encourage the formation of self-governing workshops
and offices of 5 to 20 workers. Make each group
autonomous - with respect to organization, style,
relation to other groups, hiring and firing, work
schedule. Where the work is complicated and requires
larger organizations, several of these work groups
can federate and cooperate to produce complex
artifacts and services.
</p>
<div align="right">
<b>80: Self-Governing Workshops and Offices</b>
<br>
A Pattern Language, Christopher Alexander et al.
<br>
1977, Oxford University Press, ISBN: 0-19-501919-9
</p>
[% END %]
|
Output #8:
Encourage the formation of self-governing workshops
and offices of 5 to 20 workers. Make each group
autonomous - with respect to organization, style,
relation to other groups, hiring and firing, work
schedule. Where the work is complicated and requires
larger organizations, several of these work groups
can federate and cooperate to produce complex
artifacts and services.
80: Self-Governing Workshops and Offices
A Pattern Language, Christopher Alexander et al.
1977, Oxford University Press, ISBN: 0-19-501919-9
|
|
|