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:
`` `
<span> </span>
`` `

After (space deleted)
`` `
<span></span>
`` `

In order to avoid this, it has been modified to render with &nbsp; only when there is no diff.
This commit is contained in:
Koki Oyatsu 2019-07-07 02:39:50 +09:00
parent faeb7b7e80
commit 5bf0575b46
2 changed files with 8 additions and 0 deletions

View file

@ -211,6 +211,10 @@
lineWithoutPrefix = lineWithPrefix.line; lineWithoutPrefix = lineWithPrefix.line;
} }
if (prefix === ' ') {
prefix = '&nbsp;';
}
return hoganUtils.render(genericTemplatesPath, 'line', return hoganUtils.render(genericTemplatesPath, 'line',
{ {
type: type, type: type,

View file

@ -244,6 +244,10 @@
lineWithoutPrefix = lineWithPrefix.line; lineWithoutPrefix = lineWithPrefix.line;
} }
if (prefix === ' ') {
prefix = '&nbsp;';
}
return hoganUtils.render(genericTemplatesPath, 'line', return hoganUtils.render(genericTemplatesPath, 'line',
{ {
type: type, type: type,