diff --git a/src/lib.rs b/src/lib.rs index ea91feb..70d6c8a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -97,13 +97,16 @@ To access the values in lisp you can use the following functions: - `st+num` the value as a number, and - `st+has` true if value is present else false. -You need to quote the symbol to pass to the functions (e.g. (st+num 'total). +You need to quote the symbol to pass to the functions (e.g. (st+num +'total) or (st+num "total"). Else, you can just write the variables in braces like normal as well. there are two use cases. -- Standalone use case: in the format of `=()` that'll be replaced with the results. -- Inside the `{}` that can be used as alternative to a variable, or with a transformer. +- Standalone use case: in the format of `=()` that'll be replaced with + the results. +- Inside the `{}` that can be used as alternative to a variable, or + with a transformer. ```rust # use std::error::Error; @@ -112,7 +115,7 @@ there are two use cases. # use string_template_plus::{Render, RenderOptions, Template}; # # fn main() -> Result<(), Box> { -let templ = Template::parse_template("hello {nickname?name}. You've done =(/ (st+num 'task_done) (st+num 'task_total)) work. {=(- 1 (/ (st+num 'task_done) (st+num 'task_total))):calc(*100):f(1)}% remains.").unwrap(); +let templ = Template::parse_template("hello {nickname?name}. You've done =(/ (st+num 'task_done) (st+num 'task_total)) work. {=(- 1 (/ (st+num \"task_done\") (st+num 'task_total))):calc(*100):f(1)}% remains.").unwrap(); let mut vars: HashMap = HashMap::new(); vars.insert("name".into(), "world".into()); vars.insert("task_done".into(), "1".into());