Module: Nanoc::Toolbox::Helpers::HtmlTag
- Included in:
- Disqus, GithubGist, GoogleAnalytics, GoogleUA, Gravatar, Navigation
- Defined in:
- lib/nanoc/toolbox/helpers/html_tag.rb
Overview
NANOC Helper for HTML Tags
This module contains functions for generating simple tags with attribute
Instance Method Summary collapse
-
#content_tag(name, content, options = {}) ⇒ String
Content tag.
-
#tag(name, options = {}, open = false) ⇒ String
Simple tag.
- #tag_options(options) ⇒ Object protected
Instance Method Details
#content_tag(name, content, options = {}) ⇒ String
Content tag
37 38 39 |
# File 'lib/nanoc/toolbox/helpers/html_tag.rb', line 37 def content_tag(name, content, ={}) "<#{name}#{() if }>#{content}</#{name}>" end |
#tag(name, options = {}, open = false) ⇒ String
Simple tag
21 22 23 |
# File 'lib/nanoc/toolbox/helpers/html_tag.rb', line 21 def tag(name, ={}, open=false) "<#{name}#{() if }#{open ? ">" : " />"}" end |
#tag_options(options) ⇒ Object (protected)
42 43 44 45 46 47 48 49 50 |
# File 'lib/nanoc/toolbox/helpers/html_tag.rb', line 42 def () unless .empty? attributes = [] .each do |key, value| attributes << %(#{key}="#{value}") end ' ' + attributes.join(' ') end end |