Awesome
XRB
XRB is a templating system built loosely on top of XHTML markup. It uses efficient native parsers where possible and compiles templates into efficient Ruby. It also includes a markup builder to assist with the generation of pleasantly formatted markup which is compatible with the included parsers.
<h1>XRB Examples</h1>
<ul>
<li>XRB uses normal string interpolation syntax: #{"Hello World"}</li>
<?r if true ?>
<li>XRB also adopts standard #{"<?r ... ?>"} script tags</li>
<?r end ?>
<!-- That's all of the syntax! -->
<ul>
Generates the following output using XRB::Template.load_file(path).to_string
:
<h1>XRB Examples</h1>
<ul>
<li>XRB uses normal string interpolation syntax: Hello World</li>
<li>XRB also adopts standard <?r ... ?> script tags</li>
<!-- That's all of the syntax! -->
<ul>
Is it fast?
Yes. XRB is designed to be fast. It uses a combination of efficient native parsers and Ruby code generation to ensure that templates are compiled into efficient Ruby code. This means that XRB is suitable for use in high performance applications. In comparison to ERB
, it is generally about 10x faster.
Usage
Please see the project documentation for more details.
-
Getting Started - This guide gives a brief overview of the XRB templating system and how to use it.
-
Capturing Output - This guide explains how to capture intermediate output during template rendering.
-
Markup Parser - This guide explains how to parse and manipulate Markup using the XRB templating system.
See Also
- xrb-rails - A Rails ActionView integration for rendering XRB templates.
- xrb-sanitize - A stream-based HTML sanitizer for XRB, based on the XRB Markup parser.
- xrb-vscode - A syntax highlighting package for Visual Studio Code.
- trenni - The original templating system which XRB is based on.
Contributing
We welcome contributions to this project.
- Fork it.
- Create your feature branch (
git checkout -b my-new-feature
). - Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin my-new-feature
). - Create new Pull Request.
Developer Certificate of Origin
In order to protect users of this project, we require all contributors to comply with the Developer Certificate of Origin. This ensures that all contributions are properly licensed and attributed.
Community Guidelines
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.