Class: Jekyll::Asciinema::AsciicastTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll/asciinema/asciicast_tag.rb

Overview

Implements a Liquid tag for embedding Asciicasts.

Instance Method Summary collapse

Instance Method Details

#render(_context) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jekyll/asciinema/asciicast_tag.rb', line 9

def render(_context)
  if (tag_contents = parse_tag(@markup.strip))
    asciicast_id = tag_contents[0]
    render_tag(asciicast_id)
  else
    raise ArgumentError, <<-ERR_MSG.gsub(/^ {12}/, '')
      Syntax error in tag 'asciicast' while parsing the following markup:

        #{@markup}

      Valid syntax:
        {% asciicast 123456 %}
    ERR_MSG
  end
end