Skip to content

Latest commit

 

History

History
73 lines (58 loc) · 1.82 KB

README.md

File metadata and controls

73 lines (58 loc) · 1.82 KB

Biruda

Gem Version Dependency Status Build Status Maintainability Test Coverage

Biruda is a simple DSL to build HTML documents.

Installation

Add this line to your application's Gemfile:

gem 'biruda'

And then execute:

$ bundle

Or install it yourself as:

$ gem install biruda

Usage

page = Biruda.create_html do
    head do
        title 'This is a Biruda HTML DSL test'
        script src: 'mypage.com/mysuper.js'
    end
    body do
        h1 'HEADING', class: 'title'
        p [
            'This is part of my ',
            -> { b 'paragraph' },
            ', amazing.'
        ]
    end
end

puts page

This will print:

<!DOCTYPE html>
<html>
    <head>
        <title>This is a Biruda HTML DSL test</title>
        <script src="mypage.com/mysuper.js" />
    </head>
    <body>
        <h1 class="title">HEADING</h1>
        <p>
            This is part of my <b>paragraph</b>, amazing.
        </p>
    </body>
</html>'

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Run rubocop lint (rubocop -R lib spec --format simple)
  5. Run rspec tests (bundle exec rspec)
  6. Push your branch (git push origin my-new-feature)
  7. Create a new Pull Request