Fix missing space after hyperlinked topics

If a topic contains a URL, the URL gets auto-hyperlinked in ptg.html.
However this code forgot to add a trailing space, so if there was a
word after the URL, the space in between them got swallowed.

So add a space after each word, and do it outside the if/else
conditional to avoid any else clauses which might be added in the
future making the same mistake.

Change-Id: I3b5789387ead52945ae599aa0b80768642388269
This commit is contained in:
Adam Spiers 2019-05-02 12:14:38 -06:00
parent b14ec32f05
commit bfbf795109
1 changed files with 3 additions and 2 deletions

View File

@ -10,13 +10,14 @@ Handlebars.registerHelper('trackContentLine', function(options) {
for (var i = 0; i < words.length; i++) {
if (words[i].startsWith("#")) {
sentence += '<span class="label label-info">'
+ words[i].substring(1) + '</span> ';
+ words[i].substring(1) + '</span>';
} else if (words[i].match(/^https?:\/\//)) {
sentence += '<a href="' + words[i] + '">'
+ words[i] + '</a>';
} else {
sentence += words[i] + " ";
sentence += words[i];
}
sentence += ' ';
}
return new Handlebars.SafeString(sentence);
});