<commit_before>Crafty – handcrafted HTML in pure Ruby
======================================

Crafty allows you to easily and flexibly craft HTML output with pure Ruby
code. It is inspired by Builder and Markaby, but is simpler and more flexible.
Its goal is to provide simple helpers that allow you to build HTML markup in
any class.

Crafty can be used in builder classes that construct complex HTML markup, such
as form builders or pagination builders. Whenever you need to programmatically
construct HTML, consider including a Crafty helper module.


Features
--------

* Crafty is simple and fast.

* HTML element sets are predefined and provided as mix-ins.

* Automatic HTML output escaping, 100% compatible with Rails.

* No `instance_eval` or `method_missing` tricks, just helper methods.


Synopsis
--------

    require "crafty"

    class Widget
      include Crafty::HTML::Basic

      def initialize(target)
        @target = target
      end

      def render
        html do
          head do
            title "Hello"
          end
          body do
            render_content
          end
        end
      end

      def render_content
        div class: "main" do
          p "Hello, #{@target}!"
        end
      end
    end

    Widget.new("world").render
    #=> "<html><head><title>Hello</title></head><body><div class=\"main\"><p>Hello, world!</p></div></body></html>"


Helper modules
--------------

You can choose from one of the following helper modules:

* `Crafty::HTML::Basic`: A simple subset of all HTML elements, enough
  for most HTML layouts.

* `Crafty::HTML::Forms`: All HTML elements that are related to forms. If you
  use Rails, note that the names of some of these elements conflict with Rails
  helpers (such as `label` and `input`).

* `Crafty::HTML::Semantic`: Juicy new HTML5 elements such as `header`,
  `footer`, `nav`, etc.

* `Crafty::HTML::All`: All HTML5 elements that are defined in the HTML5 draft
  spec. If you use Rails, note that some elements might conflict with Rails
  helpers.

You can also choose to use `Crafty::HTML4::Basic`, `Crafty::HTML4::Forms` and
`Crafty::HTML4::All` instead. These modules provide helpers for HTML4/XHTML
elements.

<commit_msg>Update readme.<commit_after>Crafty – handcrafted HTML in pure Ruby
======================================

Crafty allows you to easily and flexibly craft HTML output with pure Ruby
code. It is inspired by Builder and Markaby, but is simpler and more flexible.
Its goal is to provide simple helpers that allow you to build HTML markup in
any class.

Crafty can be used in builder classes that construct complex HTML markup, such
as form builders or pagination builders. Whenever you need to programmatically
construct HTML, consider including a Crafty helper module.


Features
--------

* Crafty is simple and fast.

* HTML element sets are predefined and provided as mix-ins.

* Automatic HTML output escaping, 100% compatible with Rails.

* No `instance_eval` or `method_missing` tricks, just helper methods.


Synopsis
--------

A very simple example:

    require "crafty"

    include Crafty::HTML::Basic

    div class: "green" do
      h1 "Crafty crafts HTML"
    end
    #=> "<div class=\"green\"><h1>Crafty crafts HTML</h1></div>"


Another example:

    require "crafty"

    class Widget
      include Crafty::HTML::Basic

      def initialize(target)
        @target = target
      end

      def render
        # The first helper method that is called will collect all HTML.
        html do
          head do
            title "Hello"
          end
          body do
            # Continue building in another method.
            render_content
          end
        end
      end

      def render_content
        div class: ["main", "content"] do
          p "Hello, #{@target}!"
        end
      end
    end

    Widget.new("world").render
    #=> "<html><head><title>Hello</title></head><body><div class=\"main content\"><p>Hello, world!</p></div></body></html>"


Helper modules
--------------

You can choose from one of the following helper modules:

* `Crafty::HTML::Basic`: A simple subset of all HTML elements, enough
  for most HTML layouts.

* `Crafty::HTML::Forms`: All HTML elements that are related to forms. If you
  use Rails, note that the names of some of these elements conflict with Rails
  helpers (such as `label` and `input`).

* `Crafty::HTML::Semantic`: Juicy new HTML5 elements such as `header`,
  `footer`, `nav`, etc.

* `Crafty::HTML::All`: All HTML5 elements that are defined in the HTML5 draft
  spec. If you use Rails, note that some elements might conflict with Rails
  helpers.

You can also choose to use `Crafty::HTML4::Basic`, `Crafty::HTML4::Forms` and
`Crafty::HTML4::All` instead. These modules provide helpers for HTML4/XHTML
elements.


{'fraction_non_alphanumeric': 0.11115728236027425, 'fraction_numerical': 0.0047787242883856225, 'mean_word_length': 2.9752270850536746, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3762220', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1275, 'n_words': 576}