2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-11 18:02:28 +03:00

give pages custom titles based on names

This commit is contained in:
Jacob Thornton
2012-03-08 11:09:33 -08:00
parent 203d75770c
commit 426feeef6a
13 changed files with 489 additions and 211 deletions
+11
View File
@@ -2,6 +2,7 @@
var hogan = require('hogan.js')
, fs = require('fs')
, prod = process.argv[2] == 'production'
, title = 'Bootstrap'
var layout, pages
@@ -23,6 +24,16 @@ pages.forEach(function (name) {
context[name.replace(/\.mustache$/, '')] = 'active'
context._i = true
context.production = prod
context.title = name
.replace(/\.mustache/, '')
.replace(/\-.*/, '')
.replace(/(.)/, function ($1) { return $1.toUpperCase() })
if (context.title == 'Index') {
context.title = title
} else {
context.title += ' · ' + title
}
page = hogan.compile(page, { sectionTags: [{o:'_i', c:'i'}] })
page = layout.render(context, {