module Locomotive::Steam::Liquid::Filters::Html
Public Instance Methods
Return a link tag that browsers and news readers can use to auto-detect an RSS or ATOM feed. input: url of the feed example:
{{ '/foo/bar' | auto_discovery_link_tag: 'rel:alternate', 'type:application/atom+xml', 'title:A title' }}
# File lib/locomotive/steam/liquid/filters/html.rb, line 11 def auto_discovery_link_tag(input, *args) options = args_to_options(args) rel = options[:rel] || 'alternate' type = options[:type] || 'application/rss+xml' title = options[:title] || 'RSS' %{<link rel="#{rel}" type="#{type}" title="#{title}" href="#{input}" />} end
Embed a flash movie into a page input: url of the flash movie OR asset drop width: width (in pixel or in %) of the embedded movie height: height (in pixel or in %) of the embedded movie
# File lib/locomotive/steam/liquid/filters/html.rb, line 88 def flash_tag(input, *args) path = get_url_from_asset(input) embed_options = inline_options(args_to_options(args)) html = <<-EOF <object #{embed_options}> <param name="movie" value="#{path}"> <embed src="#{path}" #{embed_options}> </embed> </object> EOF html.gsub(/ >/, '>').strip end
Write an image tag input: url of the image OR asset drop
# File lib/locomotive/steam/liquid/filters/html.rb, line 78 def image_tag(input, *args) image_options = inline_options(args_to_options(args)) %{<img src="#{get_url_from_asset(input)}" #{image_options}>} end
Write the link to javascript resource input: url of the javascript file
# File lib/locomotive/steam/liquid/filters/html.rb, line 50 def javascript_tag(input, *args) return '' if input.nil? javascript_options = inline_options(args_to_options(args)) input = javascript_url(input) %{<script src="#{input}" type="text/javascript" #{javascript_options}></script>} end
Write the url to javascript resource input: name of the javascript file
# File lib/locomotive/steam/liquid/filters/html.rb, line 44 def javascript_url(input) any_asset_url(input, '.js', 'javascripts') end
Write the link tag of a theme stylesheet input: url of the css file
# File lib/locomotive/steam/liquid/filters/html.rb, line 34 def stylesheet_tag(input, media = 'screen') return '' if input.nil? input = stylesheet_url(input) %{<link href="#{input}" media="#{media}" rel="stylesheet" type="text/css" />} end
Write the url of a theme stylesheet input: name of the css file
# File lib/locomotive/steam/liquid/filters/html.rb, line 28 def stylesheet_url(input) any_asset_url(input, '.css', 'stylesheets') end
Write the url of any theme file
# File lib/locomotive/steam/liquid/filters/html.rb, line 22 def theme_asset_url(input) any_asset_url(input) end
Write a theme image tag input: name of file including folder example: 'about/myphoto.jpg' | theme_image # <img src=“images/about/myphoto.jpg”>
# File lib/locomotive/steam/liquid/filters/html.rb, line 70 def theme_image_tag(input, *args) image_options = inline_options(args_to_options(args)) %{<img src="#{theme_image_url(input)}" #{image_options}>} end
# File lib/locomotive/steam/liquid/filters/html.rb, line 59 def theme_image_url(input) return '' if input.nil? input = "images/#{input}" unless input.starts_with?('/') asset_url(input) end