aboutsummaryrefslogtreecommitdiffstats
path: root/root/$mmm/plugins/twitter/converts: text$moonscript -> table.moon
blob: 4821823c7ed55231340fe3e0534ccb0474a30fcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import div, blockquote, a from require 'mmm.dom'
import iframe from require 'mmm.dom'

{
  {
    inp: 'URL -> twitter/tweet'
    out: 'mmm/dom'
    cost: -4
    transform: (href) =>
      user, id = assert (href\match 'twitter.com/([^/]-)/status/(%d*)'), "couldn't parse twitter/tweet URL: '#{href}'"

      iframe {
        width: 550
        height: 560
        border: 0
        frameBorder: 0
        allowfullscreen: true
        src: "//twitframe.com/show?url=https%3A%2F%2Ftwitter.com%2F#{user}%2F#{id}"
      }
  }
}