From 39daa9ab23b15bee308a04cf52a73d2bc647f2b4 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sat, 1 Mar 2014 08:18:08 -0800 Subject: [PATCH] hide source location if outputSourceFiles is false (#571) revised fix to address the regression in #592 --- templates/default/publish.js | 10 +++++++--- templates/default/tmpl/details.tmpl | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/templates/default/publish.js b/templates/default/publish.js index ce01ee36..59731879 100644 --- a/templates/default/publish.js +++ b/templates/default/publish.js @@ -468,21 +468,25 @@ exports.publish = function(taffyData, opts, tutorials) { var members = helper.getMembers(data); members.tutorials = tutorials.children; + // output pretty-printed source files by default + var outputSourceFiles = conf['default'] && conf['default'].outputSourceFiles !== false ? true : + false; + // add template helpers view.find = find; view.linkto = linkto; view.resolveAuthorLinks = resolveAuthorLinks; view.tutoriallink = tutoriallink; view.htmlsafe = htmlsafe; + view.outputSourceFiles = outputSourceFiles; // once for all view.nav = buildNav(members); attachModuleSymbols( find({ kind: ['class', 'function'], longname: {left: 'module:'} }), members.modules ); - // output pretty-printed source files by default; do this before generating any other pages, so - // that the other pages can link to the source files - if (!conf['default'] || conf['default'].outputSourceFiles !== false) { + // generate the pretty-printed source files first so other pages can link to them + if (outputSourceFiles) { generateSourceFiles(sourceFiles, opts.encoding); } diff --git a/templates/default/tmpl/details.tmpl b/templates/default/tmpl/details.tmpl index 13233e4b..3669a234 100644 --- a/templates/default/tmpl/details.tmpl +++ b/templates/default/tmpl/details.tmpl @@ -71,7 +71,7 @@ if (data.defaultvalue && data.defaultvaluetype === 'object') { - +
Source: