Class: Jekyll::ReactPlayer::ReactPlayerTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll/react-player/reactplayer_tag.rb

Overview

Implements a Liquid tag for embedding Asciicasts.

Instance Method Summary collapse

Instance Method Details

#render(_context) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jekyll/react-player/reactplayer_tag.rb', line 10

def render(_context)
  if (tag_contents = parse_tag(@markup.strip))
    url = tag_contents
    uri = URI.parse(url)
    id = uri.path.gsub("/","_")
    render_tag(id, url)
  else
    raise ArgumentError, <<-ERR_MSG.gsub(/^ {12}/, '')
      Syntax error in tag 'reactplayer' while parsing the following markup:

        #{@markup}

      Valid syntax:
        {% reactplayer https://example.com/asset %}
    ERR_MSG
  end
end