aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index dd35b06..78b3570 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -839,6 +839,11 @@ RenderMsg.prototype.object = function (cb) {
done(cb)
}
+function linkName(link) {
+ if (link.link[0] === '@' && link.name[0] !== '@') return '@' + link.name
+ return link.name
+}
+
RenderMsg.prototype.valueTable = function (val, depth, cb) {
var isContent = depth === 1
var self = this
@@ -846,11 +851,14 @@ RenderMsg.prototype.valueTable = function (val, depth, cb) {
case 'object':
if (val === null) return cb(), ''
var done = multicb({pluck: 1, spread: true})
+ var keys
var el = Array.isArray(val)
? h('ul', val.map(function (item) {
return h('li', self.valueTable(item, depth + 1, done()))
}))
- : h('table.ssb-object', Object.keys(val).map(function (key) {
+ : (keys = Object.keys(val)).sort().join() === 'link,name' && val.link && val.name
+ ? h('a', {href: self.toUrl(val.link)}, linkName(val))
+ : h('table.ssb-object', keys.map(function (key) {
if (key === 'text') {
return h('tr',
h('td', h('strong', 'text')),