From 5bf0575b46e924890e65001225ddbcacaa365e0a Mon Sep 17 00:00:00 2001 From: Koki Oyatsu Date: Sun, 7 Jul 2019 02:39:50 +0900 Subject: [PATCH] Replace space to   for HTML Rendering. Reason: Some javascript frameworks(ex. vue.js) manipulate HTML tags when drawing. At that time, if there is a space-only DOM element, the space in the DOM element is deleted. Before: `` ` `` ` After (space deleted) `` ` `` ` In order to avoid this, it has been modified to render with   only when there is no diff. --- src/line-by-line-printer.js | 4 ++++ src/side-by-side-printer.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/line-by-line-printer.js b/src/line-by-line-printer.js index 33722b6..49f183f 100644 --- a/src/line-by-line-printer.js +++ b/src/line-by-line-printer.js @@ -211,6 +211,10 @@ lineWithoutPrefix = lineWithPrefix.line; } + if (prefix === ' ') { + prefix = ' '; + } + return hoganUtils.render(genericTemplatesPath, 'line', { type: type, diff --git a/src/side-by-side-printer.js b/src/side-by-side-printer.js index 6a739e5..f11572c 100644 --- a/src/side-by-side-printer.js +++ b/src/side-by-side-printer.js @@ -244,6 +244,10 @@ lineWithoutPrefix = lineWithPrefix.line; } + if (prefix === ' ') { + prefix = ' '; + } + return hoganUtils.render(genericTemplatesPath, 'line', { type: type,