From 26d349b736ccdd697db379dcac5b3b138f4670a1 Mon Sep 17 00:00:00 2001 From: Mikko Rantanen Date: Wed, 28 Oct 2015 19:43:06 +0200 Subject: [PATCH] Align the file summary Use element to lay out the file summary. The summary is tabular data anyway so the use of
should be justified. First column contains lines added, justified to right and the second column contains lines removed, justified to the left. The last column has the file name. Fixes #27 --- css/diff2html.css | 8 ++++++++ src/file-list-printer.js | 20 +++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/css/diff2html.css b/css/diff2html.css index fc4b5f8..7b7e8b5 100644 --- a/css/diff2html.css +++ b/css/diff2html.css @@ -33,6 +33,10 @@ } .d2h-lines-added { + text-align: right; +} + +.d2h-lines-added > * { background-color: #ceffce; border: 1px solid #b4e2b4; color: #399839; @@ -42,6 +46,10 @@ } .d2h-lines-deleted { + text-align: left; +} + +.d2h-lines-deleted > * { background-color: #f7c8c8; border: 1px solid #e9aeae; color: #c33; diff --git a/src/file-list-printer.js b/src/file-list-printer.js index c93a922..8cb2f76 100644 --- a/src/file-list-printer.js +++ b/src/file-list-printer.js @@ -21,19 +21,21 @@ ' +\n' + ' -\n' + '
\n' + - '
\n' + + '
\n' + diffFiles.map(function (file) { - return '
\n' + - '
\n' + - ' +' + file.addedLines + '\n' + - ' -' + file.deletedLines + '\n' + - '
\n' + - ' \n' + - '
\n' + return ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' }).join('\n') + - '\n'; + '
\n' + + ' +' + file.addedLines + '\n' + + ' \n' + + ' -' + file.deletedLines + '\n' + + '  ' + printerUtils.getDiffName(file) + '
\n'; }; module.exports['FileListPrinter'] = new FileListPrinter();