Generate a unique Id for each section

This commit is contained in:
Aaron O'Mullan
2014-03-31 15:03:04 -07:00
parent 6261d42b95
commit a8e0de86e9
+5
View File
@@ -56,6 +56,9 @@ function parsePage(src) {
return section;
})
.map(function(section) {
// Generate a uniqueId to identify this section in our code
var id = _.uniqueId('gitbook_');
// Transform given type
if(section.type === 'exercise') {
var nonCodeNodes = _.reject(section, {
@@ -67,6 +70,7 @@ function parsePage(src) {
});
return {
id: id,
type: section.type,
content: render(nonCodeNodes),
code: {
@@ -79,6 +83,7 @@ function parsePage(src) {
// Render normal pages
return {
id: id,
type: section.type,
content: render(section)
};