diff --git a/CHANGES.md b/CHANGES.md index bd88ae9..ee9d66a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,9 +1,11 @@ # mustache.js Changes ## 0.3.0 (??-??-????) +* Use sections to dereference subcontexts. * Added higher order sections. + ## 0.2.3 (28-03-2010) * Better error message for missing partials. diff --git a/README.md b/README.md index 7c1e8e0..cfca7be 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,40 @@ implement caching, filters (like syntax highlighting), etc. You can use `this.name` to access the attribute `name` from your view. +### Dereferencing Section + +If you have a nested object structure in your view, it can sometimes be easier +to use sections like this: + + var objects = { + a_object: { + title: 'this is an object', + description: 'one of its attributes is a list', + a_list: [{label: 'listitem1'}, {label: 'listitem2'}] + } + }; + +This is our template: + + {{#a_object}} +
{{description}}
+one of its attributes is a list
+