diff options
| author | s-ol <s+removethis@s-ol.nu> | 2020-12-03 16:38:43 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2020-12-03 16:38:43 +0000 |
| commit | e0a0b25f6586cdf1b1284d97bedadfce5535ba96 (patch) | |
| tree | 50cf646dc673faeda648e7135d84e46f2dbd5262 /root/$mmm/plugins/youtube | |
| parent | fix typo break text/html+interactive (diff) | |
| download | mmm-e0a0b25f6586cdf1b1284d97bedadfce5535ba96.tar.gz mmm-e0a0b25f6586cdf1b1284d97bedadfce5535ba96.zip | |
move plugins into root
Diffstat (limited to 'root/$mmm/plugins/youtube')
| -rw-r--r-- | root/$mmm/plugins/youtube/converts: text$moonscript -> table.moon | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/root/$mmm/plugins/youtube/converts: text$moonscript -> table.moon b/root/$mmm/plugins/youtube/converts: text$moonscript -> table.moon new file mode 100644 index 0000000..8983730 --- /dev/null +++ b/root/$mmm/plugins/youtube/converts: text$moonscript -> table.moon @@ -0,0 +1,25 @@ +import iframe from require 'mmm.dom' + +{ + { + inp: 'URL -> youtube/video' + out: 'mmm/dom' + cost: -4 + transform: (link) => + id = link\match 'youtu%.be/([^/]+)' + id or= link\match 'youtube.com/watch.*[?&]v=([^&]+)' + id or= link\match 'youtube.com/[ev]/([^/]+)' + id or= link\match 'youtube.com/embed/([^/]+)' + + assert id, "couldn't parse youtube URL: '#{link}'" + + iframe { + width: 560 + height: 315 + border: 0 + frameborder: 0 + allowfullscreen: true + src: "//www.youtube.com/embed/#{id}" + } + } +} |
