This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-website".
The branch, master has been updated
via 19e987198e71b0dccbf7152207ae6e4c3549d2de (commit)
from 7d6e918080c0e9b155435c2537f8566aa352f11d (commit)
Summary of changes:
templates/docs/tutorials/heist.md | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 19e987198e71b0dccbf7152207ae6e4c3549d2de
Author: Mighty Byte <[email protected]>
Date: Mon May 31 17:36:21 2010 -0400
Added description of attribute substitution to the heist tutorial.
diff --git a/templates/docs/tutorials/heist.md
b/templates/docs/tutorials/heist.md
index 700f395..862485c 100644
--- a/templates/docs/tutorials/heist.md
+++ b/templates/docs/tutorials/heist.md
@@ -62,6 +62,28 @@ The full company name will be substituted at every
occurrance of the
`<longname/>` tag. This eliminates repetition and makes it easier to
make changes.
+#### Attribute Substitution
+
+Heist also provides attribute string substitution using the same mechanism as
+tag substitution. The syntax is different for attributes since the angle
+bracket tag syntax is not allowed. Within the value of an attribute, use the
+delimiter `$(...)` for variable substitution.
+
+~~~~~~~~~~~~~~~ {.html}
+ <bind tag="foo">dynamic_name</bind>
+ <p name="$(foo)">A paragraph</p>
+~~~~~~~~~~~~~~~
+
+The foo identifier is substituted into the name attribute of the paragraph
+tag. The output looks like this:
+
+~~~~~~~~~~~~~~~ {.html}
+ <p name="dynamic_name">A paragraph</p>
+~~~~~~~~~~~~~~~
+
+This only works if the bind tag's first child is a text node. If the first
+child is not a text node, then the empty string will be substituted.
+
### The `<apply ...>` tag
The `apply` tag loads one of your application templates and inserts it
@@ -347,6 +369,10 @@ This returns a new `TemplateState` with factSplice bound
to the
`<fact>` tag. Now, in any of your templates the XML snippet
`<fact>5</fact>` will render as `120`.
+The contents of splices can also be used in attributes using the `$()` syntax
+mentioned above. As above, the first element of the returned list must be a
+text node. This works because a `<bind>` tag is really just a splice that
+returns a constant node list.
### Hooks
-----------------------------------------------------------------------
hooks/post-receive
--
snap-website
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap