Module: Locomotive::Steam::Liquid::Filters::Html
- Defined in:
- lib/locomotive/steam/liquid/filters/html.rb
Instance Method Summary collapse
-
#auto_discovery_link_tag(input, *args) ⇒ Object
Return a link tag that browsers and news readers can use to auto-detect an RSS or ATOM feed.
-
#flash_tag(input, *args) ⇒ Object
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.
-
#image_tag(input, *args) ⇒ Object
Write an image tag input: url of the image OR asset drop.
-
#javascript_tag(input, *args) ⇒ Object
Write the link to javascript resource input: url of the javascript file.
-
#javascript_url(input) ⇒ Object
Write the url to javascript resource input: name of the javascript file.
-
#stylesheet_tag(input, media = 'screen') ⇒ Object
Write the link tag of a theme stylesheet input: url of the css file.
-
#stylesheet_url(input) ⇒ Object
Write the url of a theme stylesheet input: name of the css file.
-
#theme_image_tag(input, *args) ⇒ Object
Write a theme image tag input: name of file including folder example: ‘about/myphoto.jpg’ | theme_image # <img src=“images/about/myphoto.jpg”>.
- #theme_image_url(input) ⇒ Object
Instance Method Details
#auto_discovery_link_tag(input, *args) ⇒ Object
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' }}
11 12 13 14 15 16 17 18 19 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 11 def auto_discovery_link_tag(input, *args) = (args) rel = [:rel] || 'alternate' type = [:type] || 'application/rss+xml' title = [:title] || 'RSS' %{<link rel="#{rel}" type="#{type}" title="#{title}" href="#{input}" />} end |
#flash_tag(input, *args) ⇒ Object
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
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 83 def flash_tag(input, *args) path = get_url_from_asset(input) = ((args)) html = <<-EOF <object #{}> <param name="movie" value="#{path}"> <embed src="#{path}" #{}> </embed> </object> EOF html.gsub(/ >/, '>').strip end |
#image_tag(input, *args) ⇒ Object
Write an image tag input: url of the image OR asset drop
73 74 75 76 77 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 73 def image_tag(input, *args) = ((args)) %{<img src="#{get_url_from_asset(input)}" #{}>} end |
#javascript_tag(input, *args) ⇒ Object
Write the link to javascript resource input: url of the javascript file
45 46 47 48 49 50 51 52 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 45 def javascript_tag(input, *args) return '' if input.nil? = ((args)) input = javascript_url(input) %{<script src="#{input}" type="text/javascript" #{}></script>} end |
#javascript_url(input) ⇒ Object
Write the url to javascript resource input: name of the javascript file
39 40 41 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 39 def javascript_url(input) css_js_asset_url(input, '.js', 'javascripts') end |
#stylesheet_tag(input, media = 'screen') ⇒ Object
Write the link tag of a theme stylesheet input: url of the css file
29 30 31 32 33 34 35 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 29 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) ⇒ Object
Write the url of a theme stylesheet input: name of the css file
23 24 25 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 23 def stylesheet_url(input) css_js_asset_url(input, '.css', 'stylesheets') end |
#theme_image_tag(input, *args) ⇒ Object
Write a theme image tag input: name of file including folder example: ‘about/myphoto.jpg’ | theme_image # <img src=“images/about/myphoto.jpg”>
65 66 67 68 69 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 65 def theme_image_tag(input, *args) = ((args)) %{<img src="#{theme_image_url(input)}" #{}>} end |
#theme_image_url(input) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 54 def theme_image_url(input) return '' if input.nil? input = "images/#{input}" unless input.starts_with?('/') asset_url(input) end |