From e777f7293ea8d8d076203d8281a31daa3a084a8c Mon Sep 17 00:00:00 2001 From: cel Date: Thu, 4 May 2017 08:43:34 -1000 Subject: Render micro messages --- lib/render-msg.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/render-msg.js b/lib/render-msg.js index 7911765..c1c388c 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -211,6 +211,7 @@ RenderMsg.prototype.message = function (cb) { case 'music-release-cc': return this.musicRelease(cb) case 'ssb-dns': return this.dns(cb) case 'gathering': return this.gathering(cb) + case 'micro': return this.micro(cb) case 'ferment/audio': case 'robeson/audio': return this.audio(cb) @@ -780,3 +781,14 @@ RenderMsg.prototype.mutualAccount = function (cb) { RenderMsg.prototype.gathering = function (cb) { this.wrapMini('gathering', cb) } + +function unwrapP(html) { + return String(html).replace(/^

(.*)<\/p>\s*$/, function ($0, $1) { + return $1 + }) +} + +RenderMsg.prototype.micro = function (cb) { + var el = h('span', {innerHTML: unwrapP(this.markdown())}) + this.wrapMini(el, cb) +} -- cgit v1.2.3