Skip to content

Releases: maciejhirsz/ramhorns

1.0.0

24 Mar 17:25
a6d020e
Compare
Choose a tag to compare
  • Ramhorns is now using the MPL-2.0 license (#66, #73)
  • [BREAKING] Ramhorns::get now takes &str as an argument (see #70, #69, thanks to @lcnr for reporting)
  • Added a method to manually insert a template parsed from source by @grego (#67)
  • Added rename_all attribute similar to serde and optional index-based sections by @tiagolobocastro (#63)
  • Implemented Debug for Ramhorns & Template (#72, thanks to @dsaghliani for reporting)
  • Updated dependencies (#64, #68, #71)

Full Changelog: v0.14.0...v1.0.0

0.14.0

07 Jun 09:08
dc7751d
Compare
Choose a tag to compare

This patch adds great work from @grego:

  • You can now nest sections in fields such that instead of writing {{#section}}{{field}}{{/section}} you can just write {{section field}}. You can also use this nesting for opening and closing of sections (#59).
  • The main Ramhorns struct can now take a custom hasher as a generic param for its internal partials HashMap (also #59).
  • Updated dependencies, pulldown_cmark is now an optional dependency (enabled by default).

0.13.0

14 Dec 10:28
bd34292
Compare
Choose a tag to compare
  • Breaking: #[md] has been replaced with #[ramhorns(md)] for consistency. (#56)
  • Adds the #[ramhorns(callback = path::to::fn)] attribute which can execute arbitrary code for inserting values into template, see tests/main.rs for an example. (#56, #58)
  • Adds functions extend_from_folder and extend_from_folder_with_extension to include templates from another folder in the collection. (#57)

0.12.0

14 Jul 07:34
Compare
Choose a tag to compare
  • Added a new error variant: Error::NotFound(Box<str>) which contains the name of a partial for which a template file couldn't be found.

0.11.0

16 Jun 11:16
9f2ed4d
Compare
Choose a tag to compare
  • Content is now implemented for arrays and ArrayVec from the arrayvec crate (#49, by @grego).
  • Added Ramhorns::from_folder_with_extension to which allows to use custom file extensions for templates (#46, by @halvko).
  • Updated dependencies.

0.10.2

14 Oct 14:59
Compare
Choose a tag to compare
  • The #[derive(Content)] macro no longer errors if the Result type has been aliased in current scope (#37).

0.10.1

13 Oct 09:14
Compare
Choose a tag to compare

Fixes an issue with inverse sections {{^...}} missing parent variables (#36).

0.10.0

08 Oct 12:31
Compare
Choose a tag to compare
  • Fixes the way missing sections are handled to be consistent with Mustache specification, this is a breaking change (#34).

0.9.4

08 Jun 09:56
Compare
Choose a tag to compare
  • This is a minor patch that reduces compile times for nested data structures (#33).

0.9.3

02 May 19:30
Compare
Choose a tag to compare
  • Added [ramhorns(flatten)] that works similar to #[serde(flatten)], allowing composed structs to act as a single mapping inside templates. This is best illustrated with an example:
    #[derive(Content)]
    pub struct Parent<'a> {
        title: &'a str,
        #[ramhorns(flatten)]
        child: Child<'a>,
    }
    
    #[derive(Content)]
    pub struct Child<'a> {
        body: &'a str,
    }
    
    let tpl = Template::new("<h1>{{title}}</h1><head>{{body}}</head>").unwrap();
    
    let html = tpl.render(&Parent {
        title: "This is the title",
        child: Child {
            body: "This is the body",
        }
    });
    
    assert_eq!(html, "<h1>This is the title</h1><head>This is the body</head>");