Browse Source

Add shortcode for Streamable videos (Electric Boogaloo) (#80)

Add shortcode for Streamable video
index-subcmd
William Yao Vincent Prouillet 7 years ago
parent
commit
4c9d1e3af7
6 changed files with 17 additions and 2 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +3
    -2
      README.md
  3. +3
    -0
      src/rendering/markdown.rs
  4. +7
    -0
      src/templates/builtins/shortcodes/streamable.html
  5. +1
    -0
      src/templates/mod.rs
  6. +2
    -0
      test_site/content/posts/simple.md

+ 1
- 0
CHANGELOG.md View File

@@ -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)



+ 3
- 2
README.md View File

@@ -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`.


+ 3
- 0
src/rendering/markdown.rs View File

@@ -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
- 0
src/templates/builtins/shortcodes/streamable.html View 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>

+ 1
- 0
src/templates/mod.rs View File

@@ -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();


+ 2
- 0
test_site/content/posts/simple.md View File

@@ -11,4 +11,6 @@ A simple page

{{ vimeo(id="210073083") }}

{{ streamable(id="c0ic") }}

{{ gist(url="https://gist.github.com/Keats/32d26f699dcc13ebd41b") }}

Loading…
Cancel
Save