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_asset_url(input) ⇒ Object
Write the url of any theme 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
88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 88 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
78 79 80 81 82 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 78 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
50 51 52 53 54 55 56 57 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 50 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
44 45 46 |
# 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') ⇒ Object
Write the link tag of a theme stylesheet input: url of the css file
34 35 36 37 38 39 40 |
# 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) ⇒ Object
Write the url of a theme stylesheet input: name of the css file
28 29 30 |
# 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) ⇒ Object
Write the url of any theme file
22 23 24 |
# 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) ⇒ Object
Write a theme image tag input: name of file including folder example: ‘about/myphoto.jpg’ | theme_image # <img src=“images/about/myphoto.jpg”>
70 71 72 73 74 |
# File 'lib/locomotive/steam/liquid/filters/html.rb', line 70 def theme_image_tag(input, *args) = ((args)) %{<img src="#{theme_image_url(input)}" #{}>} end |
#theme_image_url(input) ⇒ Object
59 60 61 62 63 64 65 |
# 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 |