summaryrefslogtreecommitdiffstats
path: root/lib/parse/page.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-04-06 14:53:33 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-04-06 14:53:33 -0700
commit696cbdc3b13905498e2832d43790567ac48799d0 (patch)
treee5ef567121a4d2052f82d1e3711279b8bf86b817 /lib/parse/page.js
parent2f8543d7102d0b55b043563ee03e72d38d40cab5 (diff)
downloadgitbook-696cbdc3b13905498e2832d43790567ac48799d0.zip
gitbook-696cbdc3b13905498e2832d43790567ac48799d0.tar.gz
gitbook-696cbdc3b13905498e2832d43790567ac48799d0.tar.bz2
Generate section.id in lexer
This allows generating correct URLs for our search index
Diffstat (limited to 'lib/parse/page.js')
-rw-r--r--lib/parse/page.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/parse/page.js b/lib/parse/page.js
index 559be91..56a9e60 100644
--- a/lib/parse/page.js
+++ b/lib/parse/page.js
@@ -42,9 +42,6 @@ function parsePage(src, options) {
// Lex if not already lexed
return (_.isArray(src) ? src : lex(src))
.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,7 +64,7 @@ function parsePage(src, options) {
var lang = validLangs ? langs[0] : null;
return {
- id: id,
+ id: section.id,
type: section.type,
content: render(nonCodeNodes),
lang: lang,
@@ -81,7 +78,7 @@ function parsePage(src, options) {
// Render normal pages
return {
- id: id,
+ id: section.id,
type: section.type,
content: render(section, options)
};