Htmless - Fast extensible html5 builder in pure Ruby
Htmless is actually not a new gem. It was renamed from a gem named hammer_builder.
Quick syntax example
Htmless::Formatted.new.go_in do
html5
html do
head { title 'my_page' }
body do
div.content! do
p.centered "my page's content"
end
end
end
end.to_html
returns
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>my_page</title>
</head>
<body>
<div id="content">
<p class="centered">my page's content</p>
</div>
</body>
</html>
What's new
There is not much new, only the name and that it's no longer dependent on ActiveSupport. This is a maintenance release.
For those unfamiliar with the gem
Main features of Htmless are:
- It's as fast as template-engines (erb) and much faster then other Ruby HTML builders.
- You can use inheritance (impossible with templates) and other properties of Ruby.
- You can write html in pure Ruby.
Do you wish to know more?
- Documentation: http://blog.pitr.ch/htmless
- Source: https://github.com/pitr-ch/htmless
- Blog: http://blog.pitr.ch/blog/categories/htmless/