mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Changes to default template to support index page [submitted by reklis (Steven Fusco)].
This commit is contained in:
parent
7d97a17421
commit
2cdb27fd6d
@ -12,8 +12,10 @@
|
|||||||
@param {Tutorial} tutorials
|
@param {Tutorial} tutorials
|
||||||
*/
|
*/
|
||||||
publish = function(data, opts, tutorials) {
|
publish = function(data, opts, tutorials) {
|
||||||
|
var defaultTemplatePath = 'templates/default';
|
||||||
|
var templatePath = (opts.template) ? opts.template : defaultTemplate;
|
||||||
var out = '',
|
var out = '',
|
||||||
view = new template.Template(__dirname + '/templates/default/tmpl');
|
view = new template.Template(__dirname + '/' + templatePath + '/tmpl');
|
||||||
|
|
||||||
// set up templating
|
// set up templating
|
||||||
view.layout = 'layout.tmpl';
|
view.layout = 'layout.tmpl';
|
||||||
@ -174,7 +176,7 @@
|
|||||||
fs.mkPath(outdir);
|
fs.mkPath(outdir);
|
||||||
|
|
||||||
// copy static files to outdir
|
// copy static files to outdir
|
||||||
var fromDir = __dirname + '/templates/default/static',
|
var fromDir = __dirname + '/' + templatePath + '/static',
|
||||||
staticFiles = fs.ls(fromDir, 3);
|
staticFiles = fs.ls(fromDir, 3);
|
||||||
|
|
||||||
staticFiles.forEach(function(fileName) {
|
staticFiles.forEach(function(fileName) {
|
||||||
@ -358,7 +360,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (globals.length) generate('Global', [{kind: 'globalobj'}], 'global.html');
|
if (globals.length) generate('Global', [{kind: 'globalobj'}], 'global.html');
|
||||||
generate('Index', [], 'index.html');
|
|
||||||
|
generate('Index',
|
||||||
|
[{kind: 'mainpage', longname: (opts.mainpagetitle) ? opts.mainpagetitle : "Main Page"}]
|
||||||
|
, 'index.html');
|
||||||
|
|
||||||
|
|
||||||
function generate(title, docs, filename) {
|
function generate(title, docs, filename) {
|
||||||
|
|||||||
@ -3,6 +3,12 @@
|
|||||||
docs.forEach(function(doc, i) {
|
docs.forEach(function(doc, i) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?js if (doc.kind === 'mainpage') { ?>
|
||||||
|
|
||||||
|
<?js= self.partial('mainpage.tmpl', doc) ?>
|
||||||
|
|
||||||
|
<?js } else { ?>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
@ -134,4 +140,6 @@
|
|||||||
</article>
|
</article>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
<?js }); ?>
|
<?js }); ?>
|
||||||
|
|||||||
6
templates/default/tmpl/mainpage.tmpl
Normal file
6
templates/default/tmpl/mainpage.tmpl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?js
|
||||||
|
var self = this;
|
||||||
|
?>
|
||||||
|
<div class="mainpage">
|
||||||
|
<h1>Welcome page</h1>
|
||||||
|
</div>
|
||||||
Loading…
x
Reference in New Issue
Block a user