<commit_before># Fortitude for Erector Users

This file is intended as a quick introduction to Fortitude for users of Erector. Eventually it will be replaced by
more complete documentation, but, in the mean time, it should be sufficient to get you started. :)

## What is Fortitude?

Fortitude is a Ruby templating engine that works using the same principles as Erector (_i.e._, views are expressed as
classes containing Ruby code, using a DSL that mimics HTML); from a developer's point of view, the two are very
similar. However, Fortitude is a complete, ground-up reimagining and reimplementation, and, as such, has many
advantages:

* Dramatically faster: 40-60x faster (no, that's not a typo) than Erector at rendering real-world Web pages (in fact,
Fortitude appears to be the fastest general-purpose Rails rendering engine, running 10%-40% faster than even ERb/
Erubis);
* Dramatically less garbage generation: produces ≤10% as much garbage when rendering a page (and about 50% as much
garbage as ERb/Erubis);
* Full, complete native HTML5 support (with selectable X/HTML4.01 Strict/Transitional/Frameset doctypes);
* Enforces HTML element-nesting and attribute-name rules, and enforce ID uniqueness across a page (configurable, and off by default);
* In development, beautiful HTML comments around each widget, showing what class is being rendered, the values of all variables supplied to that class, and the nesting depth of that widget;
* Fully compatible with Ruby 1.8.7-2.1.x, JRuby 1.7.11, and Rails 3.0.x-4.1.x;
* Full Tilt support, and can be used with or without Rails;
* Much more thorough Rails support &mdash; all known Rails integration points have been resolved, and it should work
as smoothly with Rails as does (_e.g._) ERb/Erubis;
* Much cleaner, totally transparent support for helpers (both inside and outside of Rails);
* Great internationalization support, iincluding Rails' translation mechanism and per-widget language variants;
* "Staticization" support for incredibly fast rendering of HTML that doesn't depend on input variables;
* Customizable tags (define your own, modify behavior of existing tags, like whether they start a newline in formatted-output mode);
* Configure all options on a per-class basis with inheritance (zero "across-the-board" global settings);
* A much-more-robust `html2fortitude` tool for converting ERb views to Fortitude code;
* ...and much more!

Above all, the primary point of Fortitude is to allow you to _factor your views_, as only Erector (and now Fortitude)
can do, by allowing you to express them as Ruby code. This is by far the largest advantage of using a rendering engine
like Fortitude or Erector. But the rest of the bullet points above are pretty nice, too. :)

## Current Status

Currently, Fortitude is feature-complete and extremely well-tested (548 examples and counting!). However, it is
largely yet-undocumented, which is why current users of Erector are the best candidates for its very first beta users.

Further, Fortitude has not yet been used "in anger" in the real world yet. As such, bugs are likely to crop up,
including perhaps some obvious ones, but they will be fixed extremely quickly. You can help Fortitude get ready for
prime time as quickly as possible by using it, and reporting any issues that crop up!

Fortitude _is_ API-stable, however: at this point, backwards-incompatible changes to its API are heavily discouraged,
and, ideally, will not be made. You should feel confident starting to build a codebase of Fortitude code without worry
that you'll have to make big changes later.

Fortitude supports and is tested against:

* Ruby 1.8.7, 1.9.3, 2.0.0, and 2.1.2;
* JRuby 1.7.11;
* Rails 3.0.20, 3.1.12, 3.2.18, 4.0.5, and 4.1.1.

Other Rails and Ruby versions not on this list will most likely work just fine, too; this is simply the testing
matrix we've chose

## Getting Help

* For general information and discussion, join the [`fortitude-ruby`](https://groups.google.com/forum/#!forum/fortitude-ruby) Google group.
* To report bugs, please file a [GitHub issue](https://github.com/ageweke/fortitude/issues).
* To contact the author directly, please [send an email](mailto:<EMAIL>).

## What Doesn't It Support?

The only major feature of Erector that Fortitude doesn't support (and likely will never support) is Erector's special
syntax for assigning classes or IDs to HTML tags. For example, in Erector, you can write:

    p.foo  # => '<p class="foo"/>'
    p.foo! # => '<p id="foo"/>'
<commit_msg>Small typo fixes.<commit_after># Fortitude for Erector Users

This file is intended as a quick introduction to Fortitude for users of Erector. Eventually it will be replaced by
more complete documentation, but, in the mean time, it should be sufficient to get you started. :)

## What is Fortitude?

Fortitude is a Ruby templating engine that works using the same principles as Erector (_i.e._, views are expressed as
classes containing Ruby code, using a DSL that mimics HTML); from a developer's point of view, the two are very
similar. However, Fortitude is a complete, ground-up reimagining and reimplementation, and, as such, has many
advantages:

* Dramatically faster: 40-60x faster (no, that's not a typo) than Erector at rendering real-world Web pages (in fact,
Fortitude appears to be the fastest general-purpose Rails rendering engine, running 10%-40% faster than even
ERb/Erubis);
* Dramatically less garbage generation: produces ≤10% as much garbage when rendering a page (and about 50% as much
garbage as ERb/Erubis);
* Full, complete native HTML5 support (with selectable X/HTML4.01 Strict/Transitional/Frameset doctypes);
* Enforces HTML element-nesting and attribute-name rules, and enforce ID uniqueness across a page (configurable, and off by default);
* In development, beautiful HTML comments around each widget, showing what class is being rendered, the values of all variables supplied to that class, and the nesting depth of that widget;
* Fully compatible with Ruby 1.8.7-2.1.x, JRuby 1.7.11, and Rails 3.0.x-4.1.x;
* Full Tilt support, and can be used with or without Rails;
* Much more thorough Rails support &mdash; all known Rails integration points have been resolved, and it should work
as smoothly with Rails as does (_e.g._) ERb/Erubis;
* Much cleaner, totally transparent support for helpers (both inside and outside of Rails);
* Great internationalization support, including Rails' translation mechanism and per-widget language variants;
* "Staticization" support for incredibly fast rendering of HTML that doesn't depend on input variables;
* Customizable tags (define your own, modify behavior of existing tags, like whether they start a newline in formatted-output mode);
* Configure all options on a per-class basis with inheritance (zero "across-the-board" global settings);
* A much-more-robust `html2fortitude` tool for converting ERb views to Fortitude code;
* ...and much more!

Above all, the primary point of Fortitude is to allow you to _factor your views_, as only Erector (and now Fortitude)
can do, by allowing you to express them as Ruby code. This is by far the largest advantage of using a rendering engine
like Fortitude or Erector. But the rest of the bullet points above are pretty nice, too. :)

## Current Status

Currently, Fortitude is feature-complete and extremely well-tested (548 examples and counting!). However, it is
largely yet-undocumented, which is why current users of Erector are the best candidates for its very first beta users.

Further, Fortitude has not yet been used "in anger" in the real world yet. As such, bugs are likely to crop up,
including perhaps some obvious ones, but they will be fixed extremely quickly. You can help Fortitude get ready for
prime time as quickly as possible by using it, and reporting any issues that crop up!

Fortitude _is_ API-stable, however: at this point, backwards-incompatible changes to its API are heavily discouraged,
and, ideally, will not be made. You should feel confident starting to build a codebase of Fortitude code without worry
that you'll have to make big changes later.

Fortitude supports and is tested against:

* Ruby 1.8.7, 1.9.3, 2.0.0, and 2.1.2;
* JRuby 1.7.11;
* Rails 3.0.20, 3.1.12, 3.2.18, 4.0.5, and 4.1.1.

Other Rails and Ruby versions not on this list will most likely work just fine, too; this is simply the testing
matrix we've chosen.

## Getting Help

* For general information and discussion, join the [`fortitude-ruby`](https://groups.google.com/forum/#!forum/fortitude-ruby) Google group.
* To report bugs, please file a [GitHub issue](https://github.com/ageweke/fortitude/issues).
* To contact the author directly, please [send an email](mailto:<EMAIL>).

## What Doesn't It Support?

The only major feature of Erector that Fortitude doesn't support (and likely will never support) is Erector's special
syntax for assigning classes or IDs to HTML tags. For example, in Erector, you can write:

    p.foo  # => '<p class="foo"/>'
    p.foo! # => '<p id="foo"/>'

{'fraction_non_alphanumeric': 0.07070035460992907, 'fraction_numerical': 0.014849290780141845, 'mean_word_length': 4.523255813953488, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 4, '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': '4179683', 'n_tokens_mistral': 2579, 'n_tokens_neox': 2393, 'n_words': 1315}