Html tags helper - aadlani/nanoc-toolbox GitHub Wiki

Simple HTML Tag generator

http://rubydoc.info/github/aadlani/nanoc-toolbox/Nanoc/Toolbox/Helpers/HtmlTag

Setup

In the folder lib/helpers_.rb add the Helper inclusion as following:

# Helpers of the nanoc-toolbox
include Nanoc::Toolbox::Helpers::HtmlTag

Usage

Tag

Self closing Tag

tag("br")
<br />

Non closed Tag with attribute

tag("hr", class => "thin", true)
<hr class="thin">

Self closing Tag with attribute

tag("input", :type => 'text')
<input type="text" />

Content Tag

content_tag(:p, "Hello world!")
<p>Hello world!</p>
content_tag(:div, content_tag(:p, "Hello world!"), :class => "strong")
<div class="strong">
  <p>Hello world!</p>
</div>
⚠️ **GitHub.com Fallback** ⚠️