diff --git a/src/line-by-line-printer.js b/src/line-by-line-printer.js index 6086bec..ae12ebd 100644 --- a/src/line-by-line-printer.js +++ b/src/line-by-line-printer.js @@ -23,17 +23,20 @@ LineByLinePrinter.prototype.makeFileDiffHtml = function(file, diffs) { var fileDiffTemplate = hoganUtils.template(baseTemplatesPath, 'file-diff'); + var filePathTemplate = hoganUtils.template(baseTemplatesPath, 'file-path'); var fileIconTemplate = hoganUtils.template(iconsBaseTemplatesPath, 'file'); var fileTagTemplate = hoganUtils.template(tagsBaseTemplatesPath, printerUtils.getFileTypeIcon(file)); return fileDiffTemplate.render({ file: file, - fileDiffName: printerUtils.getDiffName(file), fileHtmlId: printerUtils.getHtmlId(file), - diffs: diffs - }, { - fileIcon: fileIconTemplate, - fileTag: fileTagTemplate + diffs: diffs, + filePath: filePathTemplate.render({ + fileDiffName: printerUtils.getDiffName(file) + }, { + fileIcon: fileIconTemplate, + fileTag: fileTagTemplate + }) }) }; diff --git a/src/templates/diff2html-templates.js b/src/templates/diff2html-templates.js index 0dd9b78..1ed0580 100644 --- a/src/templates/diff2html-templates.js +++ b/src/templates/diff2html-templates.js @@ -9,7 +9,8 @@ global.browserTemplates["icon-file-renamed"] = new Hogan.Template({code: functio global.browserTemplates["icon-file"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["line-by-line-column-line-number"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b(t.t(t.f("blockHeader",c,p,0)));t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["line-by-line-empty-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" File without changes");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); -global.browserTemplates["line-by-line-file-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.rp("");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("fileDiffName",c,p,0)));t.b("");t.b("\n" + i);t.b(t.rp("");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");return t.fl(); },partials: {"");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); +global.browserTemplates["line-by-line-file-path"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b(t.rp("");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("fileDiffName",c,p,0)));t.b("");t.b("\n" + i);t.b(t.rp("");return t.fl(); },partials: {"");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b(t.v(t.f("oldNumber",c,p,0)));t.b("
");t.b("\n" + i);t.b("
");t.b(t.v(t.f("newNumber",c,p,0)));t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);if(t.s(t.f("prefix",c,p,1),c,p,0,253,329,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("prefix",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}if(t.s(t.f("content",c,p,1),c,p,0,361,435,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["line-by-line-wrapper"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("\n" + i);t.b("
");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["tag-file-added"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("ADDED");return t.fl(); },partials: {}, subs: { }}); diff --git a/src/templates/line-by-line-file-diff.mustache b/src/templates/line-by-line-file-diff.mustache index 23efff8..8af1ccd 100644 --- a/src/templates/line-by-line-file-diff.mustache +++ b/src/templates/line-by-line-file-diff.mustache @@ -1,10 +1,6 @@
- - {{>fileIcon}} - {{fileDiffName}} - {{>fileTag}} - + {{{filePath}}}
diff --git a/src/templates/line-by-line-file-path.mustache b/src/templates/line-by-line-file-path.mustache new file mode 100644 index 0000000..cc71b18 --- /dev/null +++ b/src/templates/line-by-line-file-path.mustache @@ -0,0 +1,5 @@ + + {{>fileIcon}} + {{fileDiffName}} + {{>fileTag}} +