# Ribboncurls

Ribboncurls logo

[![Matrix Chat](https://img.shields.io/matrix/tinted-theming:matrix.org)](https://matrix.to/#/#tinted-theming:matrix.org) [![Crates.io](https://img.shields.io/crates/v/ribboncurls.svg)](https://crates.io/crates/ribboncurls) [![Tests](https://github.com/tinted-theming/ribboncurls/actions/workflows/ci.yml/badge.svg)](https://github.com/tinted-theming/ribboncurls/actions/workflows/ci.yml) Ribboncurls is a Rust library for rendering [Mustache] templates. Ribboncurls is passing all 136 of the [Mustache v1.4.2 spec] tests. **Note**: Ribboncurls library public API is subject to change, so use with caution. ## Usage ### Basic Usage ```rust let template = r#"Hello, {{name}}!"#; let data = r#"{"name": "world"}"#; let result = ribboncurls::render(template, data, None).unwrap(); assert_eq!(result, "Hello, world!"); ``` ### With Partials The following is to make use of [Mustache partials]: ```rust let partials = r#"header:
Some header partial
footer: "#; let template = r#"{{> header}} Hello, {{name}}! {{> footer}}"#; let data = r#"{"name": "world"}"#; let result = ribboncurls::render(template, data, Some(partials)).unwrap(); assert_eq!(result, r#"
Some header partial
Hello, world! "#); ``` ### Advanced usage Have a look at the [Mustache specification] for more detailed Mustache information. Ribboncurls support all required features mentioned there. ## Mustache spec tests Ribboncurls runs the [Mustache spec tests] against the Ribboncurls lib and Ribboncurls passes all required 136 of 136 tests.
Tests ✅ comments::indented_inline
✅ comments::indented_multiline_standalone
✅ comments::indented_standalone
✅ comments::inline
✅ comments::multiline
✅ comments::multiline_standalone
✅ comments::standalone
✅ comments::standalone_line_endings
✅ comments::standalone_without_newline
✅ comments::standalone_without_previous_line
✅ comments::surrounding_whitespace
✅ comments::variable_name_collision
✅ delimiters::indented_standalone_tag
✅ delimiters::inverted_sections
✅ delimiters::outlying_whitespace_inline
✅ delimiters::pair_behavior
✅ delimiters::pair_with_padding
✅ delimiters::partial_inheritence
✅ delimiters::post_partial_behavior
✅ delimiters::sections
✅ delimiters::special_characters
✅ delimiters::standalone_line_endings
✅ delimiters::standalone_tag
✅ delimiters::standalone_without_newline
✅ delimiters::standalone_without_previous_line
✅ delimiters::surrounding_whitespace
✅ interpolation::ampersand
✅ interpolation::ampersand_context_miss_interpolation
✅ interpolation::ampersand_decimal_interpolation
✅ interpolation::ampersand_integer_interpolation
✅ interpolation::ampersand_null_interpolation
✅ interpolation::ampersand_standalone
✅ interpolation::ampersand_surrounding_whitespace
✅ interpolation::ampersand_with_padding
✅ interpolation::basic_context_miss_interpolation
✅ interpolation::basic_decimal_interpolation
✅ interpolation::basic_integer_interpolation
✅ interpolation::basic_interpolation
✅ interpolation::basic_null_interpolation
✅ interpolation::dotted_names_ampersand_interpolation
✅ interpolation::dotted_names_arbitrary_depth
✅ interpolation::dotted_names_are_never_single_keys
✅ interpolation::dotted_names_basic_interpolation
✅ interpolation::dotted_names_broken_chain_resolution
✅ interpolation::dotted_names_broken_chains
✅ interpolation::dotted_names_context_precedence
✅ interpolation::dotted_names_initial_resolution
✅ interpolation::dotted_names_no_masking
✅ interpolation::dotted_names_triple_mustache_interpolation
✅ interpolation::html_escaping
✅ interpolation::implicit_iterators_ampersand
✅ interpolation::implicit_iterators_basic_integer_interpolation
✅ interpolation::implicit_iterators_basic_interpolation
✅ interpolation::implicit_iterators_html_escaping
✅ interpolation::implicit_iterators_triple_mustache
✅ interpolation::interpolation_standalone
✅ interpolation::interpolation_surrounding_whitespace
✅ interpolation::interpolation_with_padding
✅ interpolation::no_interpolation
✅ interpolation::no_re_interpolation
✅ interpolation::triple_mustache
✅ interpolation::triple_mustache_context_miss_interpolation
✅ interpolation::triple_mustache_decimal_interpolation
✅ interpolation::triple_mustache_integer_interpolation
✅ interpolation::triple_mustache_null_interpolation
✅ interpolation::triple_mustache_standalone
✅ interpolation::triple_mustache_surrounding_whitespace
✅ interpolation::triple_mustache_with_padding
✅ inverted::context
✅ inverted::context_misses
✅ inverted::dotted_names_broken_chains
✅ inverted::dotted_names_falsey
✅ inverted::dotted_names_truthy
✅ inverted::doubled
✅ inverted::empty_list
✅ inverted::falsey
✅ inverted::indented_inline_sections
✅ inverted::internal_whitespace
✅ inverted::list
✅ inverted::nested_falsey
✅ inverted::nested_truthy
✅ inverted::null_is_falsey
✅ inverted::padding
✅ inverted::standalone_indented_lines
✅ inverted::standalone_line_endings
✅ inverted::standalone_lines
✅ inverted::standalone_without_newline
✅ inverted::standalone_without_previous_line
✅ inverted::surrounding_whitespace
✅ inverted::truthy
✅ partials::basic_behavior
✅ partials::context
✅ partials::failed_lookup
✅ partials::inline_indentation
✅ partials::nested
✅ partials::padding_whitespace
✅ partials::recursion
✅ partials::standalone_indentation
✅ partials::standalone_line_endings
✅ partials::standalone_without_newline
✅ partials::standalone_without_previous_line
✅ partials::surrounding_whitespace
✅ sections::context
✅ sections::context_misses
✅ sections::deeply_nested_contexts
✅ sections::dotted_names_broken_chains
✅ sections::dotted_names_falsey
✅ sections::dotted_names_truthy
✅ sections::doubled
✅ sections::empty_list
✅ sections::falsey
✅ sections::implicit_iterator_ampersand
✅ sections::implicit_iterator_array
✅ sections::implicit_iterator_decimal
✅ sections::implicit_iterator_html_escaping
✅ sections::implicit_iterator_integer
✅ sections::implicit_iterator_root_level
✅ sections::implicit_iterator_string
✅ sections::implicit_iterator_triple_mustache
✅ sections::indented_inline_sections
✅ sections::indented_standalone_lines
✅ sections::internal_whitespace
✅ sections::list
✅ sections::list_contexts
✅ sections::nested_falsey
✅ sections::nested_truthy
✅ sections::null_is_falsey
✅ sections::padding
✅ sections::parent_contexts
✅ sections::standalone_line_endings
✅ sections::standalone_lines
✅ sections::standalone_without_newline
✅ sections::standalone_without_previous_line
✅ sections::surrounding_whitespace
✅ sections::truthy
✅ sections::variable_test
## License Ribboncurls is licensed under the [MPL-2.0] license. ### Third-Party Licenses This project includes third-party code licensed under the MPL-2.0 license. See the [THIRD_PARTY_LICENSES] file for details. [Mustache]: https://mustache.github.io [Mustache v1.4.2 spec]: https://github.com/mustache/spec/tree/v1.4.2 [Mustache partials]: https://mustache.github.io/mustache.5.html#Partials [Mustache spec tests]: https://github.com/mustache/spec [Mustache specification]: https://github.com/mustache/spec [MPL-2.0]: ../LICENSE [THIRD_PARTY_LICENSES]: ../THIRD_PARTY_LICENSES.md