Class: JekyllBookshop::Tag
- Defined in:
- lib/jekyll-bookshop/tags/bookshop-tag.rb
Instance Method Summary collapse
-
#render(context) ⇒ Object
Map component names to the .jekyll.html files found in bookshop.
-
#tag_includes_dirs(context) ⇒ Object
Look for includes in the built bookshop directory.
Methods inherited from CommonTag
#parse_params, #render_once_found
Instance Method Details
#render(context) ⇒ Object
Map component names to the .jekyll.html files found in bookshop
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll-bookshop/tags/bookshop-tag.rb', line 11 def render(context) file = render_variable(context) || @file cname = file.strip.split("/").last standard_file = "#{file}/#{cname}.jekyll.html"; flat_file = "#{file}.jekyll.html"; file = standard_file out = render_once_found(context, file) unless out file = flat_file out = render_once_found(context, file) unless out raise IOError, "Component #{cname} does not exist. Create this component by placing a file in your bookshop at #{standard_file} or #{flat_file} in your components directory" end end out end |
#tag_includes_dirs(context) ⇒ Object
Look for includes in the built bookshop directory
6 7 8 |
# File 'lib/jekyll-bookshop/tags/bookshop-tag.rb', line 6 def tag_includes_dirs(context) context["site"]["bookshop_component_locations"].freeze end |