From 1a3e24b50ff38fadb7d1e364493341b4f8c9bafa Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 20 Aug 2018 17:47:23 -0700 Subject: Fix linkifying "sequence" JSON property --- lib/render-msg.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/render-msg.js') diff --git a/lib/render-msg.js b/lib/render-msg.js index 8251905..cff8f29 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -45,6 +45,7 @@ RenderMsg.prototype.raw = function (cb) { m.value = {} for (k in this.msg.value) m.value[k] = this.msg.value[k] var tokens = {} + var isTokenNotString = {} // link to feed starting from this message if (m.value.sequence) { @@ -52,6 +53,7 @@ RenderMsg.prototype.raw = function (cb) { tokens[tok] = h('a', {href: this.toUrl(m.value.author + '?gt=' + (m.value.sequence-1))}, m.value.sequence) + isTokenNotString[tok] = true m.value.sequence = tok } @@ -89,7 +91,8 @@ RenderMsg.prototype.raw = function (cb) { if (typeof els[i] === 'string') { for (var tok in tokens) { if (els[i].indexOf(tok) !== -1) { - var parts = els[i].split(tok) + var delim = isTokenNotString[tok] ? '"' + tok + '"' : tok + var parts = els[i].split(delim) els.splice(i, 1, parts[0], tokens[tok], parts[1]) continue } -- cgit v1.2.3