bempline

Crates.iobempline
lib.rsbempline
version0.8.1
sourcesrc
created_at2020-02-11 21:45:59.129767
updated_at2022-10-15 01:56:01.19615
descriptionSimple template library
homepage
repositoryhttps://github.com/gennyble/bempline
max_upload_size
id207468
size27,299
(gennyble)

documentation

README

bempline

A simple template engine for simple things.

Syntax

Variables are alphanumeric strings (underscores, too) surrounded by braces. Here's an {example}.

You can prevent {word} from being seen as a variable by escaping the opening brace. Like \{this}.

Example

If you have this document in something like template.bpl

Dear {name},

Some generic email text here!

Sincerely,
Some Company

You can fill it out for the names Ferris and Rusty like so

use bempline::Document;

fn main() {
	let doc = Document::from_file("test/template.bpl").unwrap();
	let names = vec!["Ferris", "Rusty"];

	for name in names {
		let mut cloned = doc.clone();
		cloned.set("name", name);
		
		println!("{}", cloned.compile());
	}
}
Commit count: 57

cargo fmt