aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-11-13 02:20:21 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-11-13 02:27:14 -0500
commit3652f333b559c988ab93f1454a240588b47a598f (patch)
tree73f89aa464dc3973018dae22f6d0ccb69c7d118a /lib
parent0d5cd1c1fc8d38f233aae799d50290f2b54ca7a1 (diff)
downloadpatchfoo-3652f333b559c988ab93f1454a240588b47a598f.tar.gz
patchfoo-3652f333b559c988ab93f1454a240588b47a598f.zip
Render more hashtag values
Diffstat (limited to 'lib')
-rw-r--r--lib/render-msg.js16
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)
})