class Jekyll::Tags::Widgets

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/jekyll-widgets.rb, line 8
def initialize(tag_name, markup, tokens)
  super
  @widget = @file
  @file += ".html"
end

Public Instance Methods

locate_include_file(_context, file, _safe) click to toggle source
# File lib/jekyll-widgets.rb, line 23
def locate_include_file(_context, file, _safe)
  path = File.join(widget_path, file)
  return path if File.exist?(path)
  raise IOError, "Widget not found: '#{@widget}'. "\
    "For a full list of available widgets visit "\
    "https://github.com/abemedia/jekyll-widgets."
end
parse_params(context) click to toggle source
Calls superclass method
# File lib/jekyll-widgets.rb, line 14
def parse_params(context)
  params = super(context)
  if params.key?("params")
    p = params.delete("params")
    Jekyll::Utils.deep_merge_hashes!(params, p)
  end
  params
end
widget_path() click to toggle source
# File lib/jekyll-widgets.rb, line 31
def widget_path
  @widget_path ||= begin
    File.expand_path "./jekyll/widgets/html", File.dirname(__FILE__)
  end
end