Module: Jekyll::Minibundle::AssetTagMarkup
- Defined in:
- lib/jekyll/minibundle/asset_tag_markup.rb
Class Method Summary collapse
- .make_attribute(name, value) ⇒ Object
- .make_attributes(attributes) ⇒ Object
- .make_markup(type, path, attributes) ⇒ Object
Class Method Details
.make_attribute(name, value) ⇒ Object
21 22 23 |
# File 'lib/jekyll/minibundle/asset_tag_markup.rb', line 21 def make_attribute(name, value) %{ #{name}="#{CGI.escape_html(value)}"} end |
.make_attributes(attributes) ⇒ Object
17 18 19 |
# File 'lib/jekyll/minibundle/asset_tag_markup.rb', line 17 def make_attributes(attributes) attributes.map { |name, value| make_attribute(name, value) }.join('') end |
.make_markup(type, path, attributes) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/jekyll/minibundle/asset_tag_markup.rb', line 6 def make_markup(type, path, attributes) case type when :js %{<script type="text/javascript" src="#{path}"#{make_attributes(attributes)}></script>} when :css %{<link rel="stylesheet" href="#{path}"#{make_attributes(attributes)}>} else fail ArgumentError, "Unknown type for generating bundle markup: #{type}, #{path}" end end |