summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-21 00:28:59 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-21 00:28:59 +0100
commit98e9848c4a5260800376255e00c58bec029a1565 (patch)
treec13b7f3e616ab44f83eded10602db3a7294124ec /lib
parent42bb5fccb81ea9ce2b406b32502236d0f34e2e7b (diff)
downloadgitbook-98e9848c4a5260800376255e00c58bec029a1565.zip
gitbook-98e9848c4a5260800376255e00c58bec029a1565.tar.gz
gitbook-98e9848c4a5260800376255e00c58bec029a1565.tar.bz2
Add title to summary's parts
Diffstat (limited to 'lib')
-rw-r--r--lib/backbone/summary.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/backbone/summary.js b/lib/backbone/summary.js
index d9253a7..f3994ca 100644
--- a/lib/backbone/summary.js
+++ b/lib/backbone/summary.js
@@ -164,6 +164,7 @@ A part of a ToC is a composed of a tree of articles.
function TOCPart(part) {
if (!(this instanceof TOCPart)) return new TOCPart(part);
+ this.title = part.title;
this.articles = _.map(part.articles || part.chapters, function(article) {
return new TOCArticle(article, this);
}, this);
@@ -225,7 +226,7 @@ Summary.prototype.parse = function(content) {
// Create first part if none
if (that.parts.length == 0) {
- that.parts.push(new TOCPart([]));
+ that.parts.push(new TOCPart({}));
}
// Add README as first entry
@@ -259,6 +260,7 @@ Summary.prototype.getContext = function() {
summary: {
parts: _.map(this.parts, function(part) {
return {
+ title: part.title,
articles: part.map(onArticle)
};
})