https://github.com/socketry/xrb
https://github.com/socketry/xrb
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/socketry/xrb
- Owner: socketry
- License: mit
- Created: 2024-04-25T06:37:40.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-13T00:03:00.000Z (about 1 year ago)
- Last Synced: 2025-04-03T01:03:22.683Z (10 months ago)
- Language: Ruby
- Size: 917 KB
- Stars: 109
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# 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.
[](https://github.com/socketry/xrb/actions?workflow=Test)
``` xrb
XRB Examples
- XRB uses normal string interpolation syntax: #{"Hello World"}
- XRB also adopts standard #{""} script tags
- XRB uses normal string interpolation syntax: Hello World
- XRB also adopts standard <?r ... ?> script tags
```
Generates the following output using `XRB::Template.load_file(path).to_string`:
``` xml
XRB Examples
```
## 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](https://socketry.github.io/xrb/) for more details.
- [Getting Started](https://socketry.github.io/xrb/guides/getting-started/index) - This guide gives a brief overview of the XRB templating system and how to use it.
- [Capturing Output](https://socketry.github.io/xrb/guides/capturing-output/index) - This guide explains how to capture intermediate output during template rendering.
- [Markup Parser](https://socketry.github.io/xrb/guides/markup-parser/index) - This guide explains how to parse and manipulate Markup using the XRB templating system.
## See Also
- [xrb-rails](https://github.com/socketry/xrb-rails) - A Rails ActionView integration for rendering XRB templates.
- [xrb-sanitize](https://github.com/socketry/xrb-sanitize) - A stream-based HTML sanitizer for XRB, based on the XRB Markup parser.
- [xrb-vscode](https://github.com/socketry/xrb-vscode) - A syntax highlighting package for Visual Studio Code.
- [trenni](https://github.com/ioquatix/trenni) - The original templating system which XRB is based on.
## Contributing
We welcome contributions to this project.
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. Push to the branch (`git push origin my-new-feature`).
5. 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](https://developercertificate.org/). 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.