Files: 8461f5116e38210324ed4dfd92a4b8fae57407d9 / modules_basic / post.js
627 bytesRaw
1 | var h = require('hyperscript') |
2 | |
3 | //render a message |
4 | |
5 | exports.needs = { |
6 | message_link: 'first', |
7 | markdown: 'first' |
8 | } |
9 | |
10 | exports.gives = { |
11 | message_content: true, |
12 | message_title: true |
13 | } |
14 | |
15 | exports.create = function (api) { |
16 | return { |
17 | message_content, |
18 | message_title |
19 | } |
20 | |
21 | function message_content (data) { |
22 | if(!data.value.content || !data.value.content.text) return |
23 | |
24 | return h('div', |
25 | api.markdown(data.value.content) |
26 | ) |
27 | } |
28 | |
29 | function message_title (data) { |
30 | var root = data.value.content && data.value.content.root |
31 | return !root ? null : h('span', 're: ', api.message_link(root)) |
32 | } |
33 | } |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 |
Built with git-ssb-web