diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-05-04 08:43:34 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-05-04 08:43:34 -1000 |
commit | e777f7293ea8d8d076203d8281a31daa3a084a8c (patch) | |
tree | 586d6ba14f7b111b4d07192f45032056bd386fe1 | |
parent | a3e592f2f227c01576d82795c9ca58a25c24bc87 (diff) | |
download | patchfoo-e777f7293ea8d8d076203d8281a31daa3a084a8c.tar.gz patchfoo-e777f7293ea8d8d076203d8281a31daa3a084a8c.zip |
Render micro messages
-rw-r--r-- | lib/render-msg.js | 12 |
1 files changed, 12 insertions, 0 deletions
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>(.*)<\/p>\s*$/, function ($0, $1) { + return $1 + }) +} + +RenderMsg.prototype.micro = function (cb) { + var el = h('span', {innerHTML: unwrapP(this.markdown())}) + this.wrapMini(el, cb) +} |