0.0
No commit activity in last 3 years
No release in over 3 years
PageBuilder is a utility library to make building html5 pages easier. It has two parts. The first is some classes that provide an interface for dealing with common html element attributes. The second is a module, that can be mixed into your presenters, that provides helpers for generating html nodes with less code than using Nokogiri directly.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
> 1.8
> 12.0
~> 3.0
~> 0.9.3

Runtime

>= 1.8.0
 Project Readme

Pagebuilder

This gem provides helpers for building html pages. It uses the nokogiri gem to manage the page/DOM.

Installation

Add this line to your application's Gemfile:

gem 'pagebuilder'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pagebuilder

Usage

Include PageBuilder::TagHelpers in the class where you want to build out pages. It will add helper methods for most HTML 5 tags. As an example, you can then call a 'click here', href: 'http://www.example.com' to generate an anchor node that links to http://www.example.com with "click here" as the text.

For a list of currently supported tags see TagHelpers Docs

Available helpers

There are some helpers added with the tags that are not directly related to element nodes. These are generally prefixed with pagebuilder_ and are private except for the to_html method.

  • to_html (public method)
    • It calls to_html on the document to generate the output
  • pagebuilder_document and pagebuilder_document=
    • Read or set the Nokogiri HTML document that should be used for generating html nodes
    • If a document has not been set, an html5 doctyped Nokogiri Document will be created the first time it is called

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec, or just rspec, to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rdubya/pagebuilder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Pagebuilder project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.