module Jekyll::Minibundle::AssetTagMarkup
Public Class Methods
make_attribute(name, value)
click to toggle source
# File lib/jekyll/minibundle/asset_tag_markup.rb 25 def self.make_attribute(name, value) 26 if value.nil? 27 %( #{name}) 28 else 29 %( #{name}="#{CGI.escape_html(value.to_s)}") 30 end 31 end
make_attributes(attributes)
click to toggle source
# File lib/jekyll/minibundle/asset_tag_markup.rb 21 def self.make_attributes(attributes) 22 attributes.map { |name, value| make_attribute(name, value) }.join('') 23 end
make_markup(type, url, attributes)
click to toggle source
# File lib/jekyll/minibundle/asset_tag_markup.rb 7 def self.make_markup(type, url, attributes) 8 url_str = CGI.escape_html(url) 9 attributes_str = make_attributes(attributes) 10 11 case type 12 when :js 13 %(<script type="text/javascript" src="#{url_str}"#{attributes_str}></script>) 14 when :css 15 %(<link rel="stylesheet" href="#{url_str}"#{attributes_str}>) 16 else 17 raise ArgumentError, "Unknown type for generating bundle markup: #{type}, #{url}" 18 end 19 end