module Locomotive::Steam::Liquid::Filters::Html

Public Instance Methods

flash_tag(input, *args) click to toggle source

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
image_tag(input, *args) click to toggle source

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
javascript_tag(input, *args) click to toggle source

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
javascript_url(input) click to toggle source

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
stylesheet_tag(input, media = 'screen') click to toggle source

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
stylesheet_url(input) click to toggle source

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
theme_asset_url(input) click to toggle source

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
theme_image_tag(input, *args) click to toggle source

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
theme_image_url(input) click to toggle source
# 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