Skip to content

Commit b9c26a2

Browse files
author
Richard Jones
committed
more doc
1 parent e134459 commit b9c26a2

File tree

1 file changed

+36
-16
lines changed

1 file changed

+36
-16
lines changed

doc/customizing.txt

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
===================
1+
icing
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.44 $
5+
:Version: $Revision: 1.45 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -634,10 +634,10 @@ the tracker **html** directory. There are several types of files in there:
634634
**page**
635635
This template usually defines the overall look of your tracker. When you
636636
view an issue, it appears inside this template. When you view an index, it
637-
also appears inside this template. This template defines a macro which is
638-
used by almost all other templates as a wrapper for their content, using its
639-
"content" slot. It will also define the "head_title" and "body_title" slots
640-
to allow setting of the page title.
637+
also appears inside this template. This template defines a macro called
638+
"icing" which is used by almost all other templates as a coating for their
639+
content, using its "content" slot. It will also define the "head_title"
640+
and "body_title" slots to allow setting of the page title.
641641
**home**
642642
the default page displayed when no other page is indicated by the user
643643
**home.classlist**
@@ -670,8 +670,11 @@ and it won't affect your users using the "issue.item" template.
670670
How the templates work
671671
----------------------
672672

673-
Roundup's templates consist of special attributes on your template tags. These
674-
attributes form the Template Attribute Language, or TAL. The basic tag
673+
Basic Templating Actions
674+
~~~~~~~~~~~~~~~~~~~~~~~~
675+
676+
Roundup's templates consist of special attributes on your template tags.
677+
These attributes form the Template Attribute Language, or TAL. The basic tag
675678
commands are:
676679

677680
**tal:define="variable expression; variable expression; ..."**
@@ -760,8 +763,12 @@ commands on it). This is useful for making arbitrary blocks of HTML
760763
conditional or repeatable (very handy for repeating multiple table rows,
761764
which would othewise require an illegal tag placement to effect the repeat).
762765

766+
767+
Templating Expressions
768+
~~~~~~~~~~~~~~~~~~~~~~
769+
763770
The expressions you may use in the attibute values may be one of the following
764-
three forms:
771+
forms:
765772

766773
**Path Expressions** - eg. ``item/status/checklist``
767774
These are object attribute / item accesses. Roughly speaking, the path
@@ -789,8 +796,17 @@ three forms:
789796
equivalent to ``item/status/checklist``, assuming that ``checklist`` is
790797
a method.
791798

792-
Tag macros, which are used in forming the basic structure of your pages,
793-
are handled with the following commands:
799+
Template Macros
800+
~~~~~~~~~~~~~~~
801+
802+
Macros are used in Roundup to save us from repeating the same common page
803+
stuctures over and over. The most common (and probably only) macro you'll use
804+
is the "icing" macro defined in the "page" template.
805+
806+
Macros are generated and used inside your templates using special attributes
807+
similar to the `basic templating actions`_. In this case though, the
808+
attributes belong to the Macro Expansion Template Attribute Language, or
809+
METAL. The macro commands are:
794810

795811
**metal:define-macro="macro name"**
796812
Define that the tag and its contents are now a macro that may be inserted
@@ -803,15 +819,15 @@ are handled with the following commands:
803819
defines a macro called "page" using the ``<html>`` tag and its contents.
804820
Once defined, macros are stored on the template they're defined on in the
805821
``macros`` attribute. You can access them later on through the ``templates``
806-
variable, eg. the most common ``templates/page/macros/page`` to access the
822+
variable, eg. the most common ``templates/page/macros/icing`` to access the
807823
"page" macro of the "page" template.
808824

809825
**metal:use-macro="path expression"**
810826
Use a macro, which is identified by the path expression (see above). This
811827
will replace the current tag with the identified macro contents. For
812828
example::
813829

814-
<tal:block metal:use-macro="templates/page/macros/page">
830+
<tal:block metal:use-macro="templates/page/macros/icing">
815831
...
816832
</tal:block>
817833

@@ -821,7 +837,7 @@ are handled with the following commands:
821837
**metal:define-slot="slot name"** and **metal:fill-slot="slot name"**
822838
To define *dynamic* parts of the macro, you define "slots" which may be
823839
filled when the macro is used with a *use-macro* command. For example, the
824-
``templates/page/macros/page`` macro defines a slot like so::
840+
``templates/page/macros/icing`` macro defines a slot like so::
825841

826842
<title metal:define-slot="head_title">title goes here</title>
827843

@@ -833,6 +849,10 @@ are handled with the following commands:
833849
where the tag that fills the slot completely replaces the one defined as
834850
the slot in the macro.
835851

852+
Note that you may not mix METAL and TAL commands on the same tag, but TAL
853+
commands may be used freely inside METAL-using tags (so your *fill-slots*
854+
tags may have all manner of TAL inside them).
855+
836856

837857
Information available to templates
838858
----------------------------------
@@ -1629,7 +1649,7 @@ from which files by looking for these comments::
16291649
Next we need to add in the METAL macro stuff so we get the normal page
16301650
trappings::
16311651

1632-
<tal:block metal:use-macro="templates/page/macros/page">
1652+
<tal:block metal:use-macro="templates/page/macros/icing">
16331653
<title metal:fill-slot="head_title">Category editing</title>
16341654
<td class="page-header-top" metal:fill-slot="body_title">
16351655
<h2>Category editing</h2>
@@ -1686,7 +1706,7 @@ Finally we finish off the tags we used at the start to do the METAL stuff::
16861706
So putting it all together, and closing the table and form we get::
16871707

16881708
<!-- category.item -->
1689-
<tal:block metal:use-macro="templates/page/macros/page">
1709+
<tal:block metal:use-macro="templates/page/macros/icing">
16901710
<title metal:fill-slot="head_title">Category editing</title>
16911711
<td class="page-header-top" metal:fill-slot="body_title">
16921712
<h2>Category editing</h2>

0 commit comments

Comments
 (0)