Add shortcode for Streamable videos (Electric Boogaloo) (#80)
Add shortcode for Streamable video
This commit is contained in:
parent
5b777cf587
commit
4c9d1e3af7
|
@ -3,6 +3,7 @@
|
|||
## 0.0.7 (unreleased)
|
||||
|
||||
- Sort individual tag/category pages by date
|
||||
- Add extra builtin shortcode for Streamable videos
|
||||
|
||||
## 0.0.6 (2017-05-24)
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ You can also choose, at the section level, whether to automatically insert an an
|
|||
but can be turned on by setting `insert_anchor = "left"` or `insert_anchor = "right"` in the `_index.md` file. `left` will insert
|
||||
the anchor link before the title text and right will insert it after.
|
||||
|
||||
The default template is very basic and will need CSS tweaks in your projet to look decent.
|
||||
The default template is very basic and will need CSS tweaks in your project to look decent.
|
||||
It can easily be overwritten by creating a `anchor-link.html` file in the `templates` directory.
|
||||
|
||||
### Shortcodes
|
||||
|
@ -212,7 +212,8 @@ Gutenberg comes with a few built-in shortcodes:
|
|||
- YouTube: embeds a YouTube player for the given YouTube `id`. Also takes an optional `autoplay` argument that can be set to `true`
|
||||
if wanted
|
||||
- Vimeo: embeds a Vimeo player for the given Vimeo `id`
|
||||
- Gist: embeds a Github gist from the `url` given. Also takes an optional `file` argument if you only want to show one of the files.
|
||||
- Streamable: embeds a Streamable player for the given Streamable `id`
|
||||
- Gist: embeds a Github gist from the `url` given. Also takes an optional `file` argument if you only want to show one of the files
|
||||
|
||||
#### Defining a shortcode
|
||||
All shortcodes need to be in the `templates/shortcodes` folder and their files to end with `.html`.
|
||||
|
|
|
@ -373,6 +373,8 @@ Hello
|
|||
{{ youtube(id="ub36ffWAqgQ", autoplay=true) }}
|
||||
|
||||
{{ vimeo(id="210073083") }}
|
||||
|
||||
{{ streamable(id="c0ic") }}
|
||||
|
||||
{{ gist(url="https://gist.github.com/Keats/32d26f699dcc13ebd41b") }}
|
||||
|
||||
|
@ -380,6 +382,7 @@ Hello
|
|||
assert!(res.contains("<p>Hello</p>\n<div >"));
|
||||
assert!(res.contains(r#"<iframe src="https://www.youtube.com/embed/ub36ffWAqgQ""#));
|
||||
assert!(res.contains(r#"<iframe src="https://www.youtube.com/embed/ub36ffWAqgQ?autoplay=1""#));
|
||||
assert!(res.contains(r#"<iframe src="https://www.streamable.com/e/c0ic""#));
|
||||
assert!(res.contains(r#"//player.vimeo.com/video/210073083""#));
|
||||
}
|
||||
|
||||
|
|
7
src/templates/builtins/shortcodes/streamable.html
Normal file
7
src/templates/builtins/shortcodes/streamable.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<div {% if class %}class="{{class}}"{% endif %}>
|
||||
<iframe src="https://www.streamable.com/e/{{id}}"
|
||||
scrolling="no"
|
||||
frameborder="0"
|
||||
allowfullscreen mozallowfullscreen webkitallowfullscreen>
|
||||
</iframe>
|
||||
</div>
|
|
@ -17,6 +17,7 @@ lazy_static! {
|
|||
("shortcodes/youtube.html", include_str!("builtins/shortcodes/youtube.html")),
|
||||
("shortcodes/vimeo.html", include_str!("builtins/shortcodes/vimeo.html")),
|
||||
("shortcodes/gist.html", include_str!("builtins/shortcodes/gist.html")),
|
||||
("shortcodes/streamable.html", include_str!("builtins/shortcodes/streamable.html")),
|
||||
|
||||
("internal/alias.html", include_str!("builtins/internal/alias.html")),
|
||||
]).unwrap();
|
||||
|
|
|
@ -11,4 +11,6 @@ A simple page
|
|||
|
||||
{{ vimeo(id="210073083") }}
|
||||
|
||||
{{ streamable(id="c0ic") }}
|
||||
|
||||
{{ gist(url="https://gist.github.com/Keats/32d26f699dcc13ebd41b") }}
|
||||
|
|
Loading…
Reference in a new issue