diff options
-rw-r--r-- | lib/render-msg.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 509bc8f..6e61108 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -66,6 +66,15 @@ RenderMsg.prototype.raw = function (cb) { tokens[tok] = h('a', {href: this.toUrl('#' + c.channel)}, c.channel) c.channel = tok } + + // link to hashtags + // TODO: recurse + for (var k in c) { + if (!c[k] || c[k][0] !== '#') continue + tok = token() + tokens[tok] = h('a', {href: this.toUrl(c[k])}, c[k]) + c[k] = tok + } } // link refs @@ -759,6 +768,7 @@ RenderMsg.prototype.valueTable = function (val, depth, cb) { done(cb) return el case 'string': + if (val[0] === '#') return cb(null, h('a', {href: self.toUrl('/channel/' + val.substr(1))}, val)) if (u.isRef(val)) return self.link1(val, cb) return cb(), self.linkify(val) case 'boolean': @@ -935,11 +945,15 @@ RenderMsg.prototype.wifiNetwork = function (cb) { RenderMsg.prototype.mutualCredit = function (cb) { var self = this + var currency = String(self.c.currency) self.link(self.c.account, function (err, a) { if (err) return cb(err) self.wrapMini([ 'credits ', a || '?', ' ', - self.c.amount, ' ', self.c.currency, + h('code', self.c.amount), ' ', + currency[0] === '#' + ? h('a', {href: self.toUrl(currency)}, currency) + : h('ins', currency), self.c.memo ? [' for ', h('q', self.c.memo)] : '' ], cb) }) |