class JekyllBookshop::Tag
Public Instance Methods
parse_params(context)
click to toggle source
Support the bind syntax, spreading an object into params
Calls superclass method
# File lib/jekyll-bookshop.rb, line 16 def parse_params(context) params = super params.each do |key, value| if key == 'bind' valueHash = {}.merge(value) params = valueHash.merge(params) next end end params.delete('bind') params end
render(context)
click to toggle source
Map component names to the .jekyll.html files found in bookshop
# File lib/jekyll-bookshop.rb, line 33 def render(context) site = context.registers[:site] file = render_variable(context) || @file cname = file.strip.split("/").last file = "#{file}/#{cname}.jekyll.html" validate_file_name(file) path = locate_include_file(context, file, site.safe) return unless path add_include_to_dependency(site, path, context) partial = load_cached_partial(path, context) context.stack do context["include"] = parse_params(context) if @params begin partial.render!(context) rescue Liquid::Error => e e.template_name = path e.markup_context = "included " if e.markup_context.nil? raise e end end end
tag_includes_dirs(context)
click to toggle source
Look for includes in the built bookshop directory
# File lib/jekyll-bookshop.rb, line 8 def tag_includes_dirs(context) Array([ Pathname.new(context['site']['bookshop_theme_path'] + '/components').cleanpath.to_s, Pathname.new(context['site']['bookshop_site_path'] + '/components').cleanpath.to_s ]).freeze end