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}}
+
{{title}}
+ {{description}}
+
+ {{#a_list}}
+ - {{label}}
+ {{/a_list}}
+
+ {{/a_object}}
+
+Here is the result:
+
+ this is an object
+ one of its attributes is a list
+
+ - listitem1
+ - listitem2
+
+
### View Partials
diff --git a/examples/section_as_context.html b/examples/section_as_context.html
new file mode 100644
index 0000000..6a39a43
--- /dev/null
+++ b/examples/section_as_context.html
@@ -0,0 +1,9 @@
+{{#a_object}}
+ {{title}}
+ {{description}}
+
+ {{#a_list}}
+ - {{label}}
+ {{/a_list}}
+
+{{/a_object}}
diff --git a/examples/section_as_context.js b/examples/section_as_context.js
new file mode 100644
index 0000000..81ca1be
--- /dev/null
+++ b/examples/section_as_context.js
@@ -0,0 +1,7 @@
+var section_as_context = {
+ a_object: {
+ title: 'this is an object',
+ description: 'one of its attributes is a list',
+ a_list: [{label: 'listitem1'}, {label: 'listitem2'}]
+ }
+};
diff --git a/examples/section_as_context.txt b/examples/section_as_context.txt
new file mode 100644
index 0000000..55d4179
--- /dev/null
+++ b/examples/section_as_context.txt
@@ -0,0 +1,6 @@
+this is an object
+ one of its attributes is a list
+
+ - listitem1
+ - listitem2
+
diff --git a/mustache.js b/mustache.js
index 4a73e22..27fe6f2 100644
--- a/mustache.js
+++ b/mustache.js
@@ -109,6 +109,9 @@ var Mustache = function() {
return that.render(content, that.merge(context,
that.create_context(row)), partials, true);
}).join("");
+ } else if(that.is_object(value)) { // Object, Use it as subcontext!
+ return that.render(content,
+ that.merge(context, that.create_context(value)), partials, true);
} else if(typeof value === "function") {
// higher order section
return value.call(context, content, function(text) {