|
75 | 75 | config.outputFormat = 'line-by-line'; |
76 | 76 | } |
77 | 77 |
|
78 | | - if (baseConfig.summary) { |
| 78 | + if (baseConfig.summary === 'hidden') { |
| 79 | + config.showFiles = false; |
| 80 | + } else { |
79 | 81 | config.showFiles = true; |
| 82 | + config.showFilesOpen = baseConfig.summary === 'open'; |
80 | 83 | } |
81 | 84 |
|
82 | 85 | var htmlContent = Diff2Html.getPrettyHtml(jsonContent, config); |
83 | | - return callback(null, that._prepareHTML(htmlContent)); |
| 86 | + return callback(null, that._prepareHTML(htmlContent, config.showFilesOpen)); |
84 | 87 | } else if (baseConfig.format === 'json') { |
85 | 88 | return callback(null, JSON.stringify(jsonContent)); |
86 | 89 | } |
87 | 90 |
|
88 | 91 | return callback(new Error('Wrong output format `' + baseConfig.format + '`!')); |
89 | 92 | }; |
90 | 93 |
|
91 | | - Diff2HtmlInterface.prototype._prepareHTML = function(content) { |
| 94 | + Diff2HtmlInterface.prototype._prepareHTML = function(content, showFilesOpen) { |
92 | 95 | var templatePath = path.resolve(__dirname, '..', 'dist', 'template.html'); |
93 | 96 | var template = utils.readFileSync(templatePath); |
94 | 97 |
|
|
101 | 104 | return template |
102 | 105 | .replace('<!--diff2html-css-->', '<style>\n' + cssContent + '\n</style>') |
103 | 106 | .replace('<!--diff2html-js-ui-->', '<script>\n' + jsUiContent + '\n</script>') |
| 107 | + .replace('//diff2html-fileListCloseable', 'diff2htmlUi.fileListCloseable("#diff", ' + showFilesOpen + ');') |
104 | 108 | .replace('<!--diff2html-diff-->', content); |
105 | 109 | }; |
106 | 110 |
|
|
0 commit comments