aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-08-20 17:47:23 -0700
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-08-21 15:43:55 -0700
commit1a3e24b50ff38fadb7d1e364493341b4f8c9bafa (patch)
treeebb317a0f60b50b09159bf534345d478b78aac3e
parente4bf56829d8e46d3f962f5915eaf310d8a67f4fa (diff)
downloadpatchfoo-1a3e24b50ff38fadb7d1e364493341b4f8c9bafa.tar.gz
patchfoo-1a3e24b50ff38fadb7d1e364493341b4f8c9bafa.zip
Fix linkifying "sequence" JSON property
-rw-r--r--lib/render-msg.js5
1 files changed, 4 insertions, 1 deletions
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
}