Skip to content

Commit 6fa5f26

Browse files
committed
Update doc tests to use gtmpl_ng
1 parent 39164f3 commit 6fa5f26

3 files changed

Lines changed: 26 additions & 26 deletions

File tree

src/funcs.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ macro_rules! gn {
142142
///
143143
/// # Example
144144
/// ```
145-
/// use gtmpl::template;
145+
/// use gtmpl_ng::template;
146146
/// let equal = template("{{ or 1 2.0 false . }}", "foo");
147147
/// assert_eq!(&equal.unwrap(), "1");
148148
/// ```
@@ -165,7 +165,7 @@ pub fn or(args: &[Value]) -> Result<Value, FuncError> {
165165
///
166166
/// # Example
167167
/// ```
168-
/// use gtmpl::template;
168+
/// use gtmpl_ng::template;
169169
/// let equal = template("{{ and 1 2.0 true . }}", "foo");
170170
/// assert_eq!(&equal.unwrap(), "foo");
171171
/// ```
@@ -185,7 +185,7 @@ pub fn and(args: &[Value]) -> Result<Value, FuncError> {
185185
///
186186
/// # Example
187187
/// ```
188-
/// use gtmpl::template;
188+
/// use gtmpl_ng::template;
189189
/// let equal = template("{{ not 0 }}", "");
190190
/// assert_eq!(&equal.unwrap(), "true");
191191
/// ```
@@ -201,7 +201,7 @@ pub fn not(args: &[Value]) -> Result<Value, FuncError> {
201201
///
202202
/// # Example
203203
/// ```
204-
/// use gtmpl::template;
204+
/// use gtmpl_ng::template;
205205
/// let equal = template("{{ len . }}", "foo");
206206
/// assert_eq!(&equal.unwrap(), "3");
207207
/// ```
@@ -227,7 +227,7 @@ pub fn len(args: &[Value]) -> Result<Value, FuncError> {
227227
///
228228
/// # Example
229229
/// ```
230-
/// use gtmpl::{gtmpl_fn, template, Value};
230+
/// use gtmpl_ng::{gtmpl_fn, template, Value};
231231
/// use gtmpl_value::{FuncError, Function};
232232
///
233233
/// gtmpl_fn!(
@@ -256,7 +256,7 @@ pub fn call(args: &[Value]) -> Result<Value, FuncError> {
256256
///
257257
/// # Example
258258
/// ```
259-
/// use gtmpl::template;
259+
/// use gtmpl_ng::template;
260260
/// let equal = template(r#"{{ print "Hello " . "!" }}"#, "world");
261261
/// assert_eq!(&equal.unwrap(), "Hello world!");
262262
/// ```
@@ -286,7 +286,7 @@ pub fn print(args: &[Value]) -> Result<Value, FuncError> {
286286
///
287287
/// # Example
288288
/// ```
289-
/// use gtmpl::template;
289+
/// use gtmpl_ng::template;
290290
/// let equal = template(r#"{{ println "Hello" . "!" }}"#, "world");
291291
/// assert_eq!(&equal.unwrap(), "Hello world !\n");
292292
/// ```
@@ -325,7 +325,7 @@ pub fn println(args: &[Value]) -> Result<Value, FuncError> {
325325
///
326326
/// # Example
327327
/// ```
328-
/// use gtmpl::template;
328+
/// use gtmpl_ng::template;
329329
/// let equal = template(r#"{{ printf "%v %s %v" "Hello" . "!" }}"#, "world");
330330
/// assert_eq!(&equal.unwrap(), "Hello world !");
331331
/// ```
@@ -347,7 +347,7 @@ pub fn printf(args: &[Value]) -> Result<Value, FuncError> {
347347
///
348348
/// # Example
349349
/// ```
350-
/// use gtmpl::template;
350+
/// use gtmpl_ng::template;
351351
/// let ctx = vec![23, 42, 7];
352352
/// let index = template("{{ index . 1 }}", ctx);
353353
/// assert_eq!(&index.unwrap(), "42");
@@ -390,7 +390,7 @@ fn get_item<'a>(col: &'a Value, key: &Value) -> Result<&'a Value, FuncError> {
390390
///
391391
/// # Example
392392
/// ```
393-
/// use gtmpl::template;
393+
/// use gtmpl_ng::template;
394394
/// let url = template(r#"{{ urlquery "foo bar?" }}"#, 0);
395395
/// assert_eq!(&url.unwrap(), "foo%20bar%3F");
396396
/// ```
@@ -411,7 +411,7 @@ pub fn urlquery(args: &[Value]) -> Result<Value, FuncError> {
411411
///
412412
/// # Example
413413
/// ```
414-
/// use gtmpl::template;
414+
/// use gtmpl_ng::template;
415415
/// let equal = template("{{ eq 1 1 . }}", 1);
416416
/// assert_eq!(&equal.unwrap(), "true");
417417
/// ```
@@ -429,7 +429,7 @@ Returns the boolean truth of arg1 != arg2
429429
430430
# Example
431431
```
432-
use gtmpl::template;
432+
use gtmpl_ng::template;
433433
let not_equal = template(\"{{ ne 2 . }}\", 1);
434434
assert_eq!(&not_equal.unwrap(), \"true\");
435435
```
@@ -444,7 +444,7 @@ Returns the boolean truth of arg1 < arg2
444444
445445
# Example
446446
```
447-
use gtmpl::template;
447+
use gtmpl_ng::template;
448448
let less_than = template(\"{{ lt 0 . }}\", 1);
449449
assert_eq!(&less_than.unwrap(), \"true\");
450450
```
@@ -464,7 +464,7 @@ Returns the boolean truth of arg1 <= arg2
464464
465465
# Example
466466
```
467-
use gtmpl::template;
467+
use gtmpl_ng::template;
468468
let less_or_equal = template(\"{{ le 1.4 . }}\", 1.4);
469469
assert_eq!(less_or_equal.unwrap(), \"true\");
470470
@@ -487,7 +487,7 @@ Returns the boolean truth of arg1 > arg2
487487
488488
# Example
489489
```
490-
use gtmpl::template;
490+
use gtmpl_ng::template;
491491
let greater_than = template(\"{{ gt 1.4 . }}\", 1.2);
492492
assert_eq!(&greater_than.unwrap(), \"true\");
493493
```
@@ -507,7 +507,7 @@ Returns the boolean truth of arg1 >= arg2
507507
508508
# Example
509509
```
510-
use gtmpl::template;
510+
use gtmpl_ng::template;
511511
let greater_or_equal = template(\"{{ ge 1.4 1.3 }}\", 1.2);
512512
assert_eq!(greater_or_equal.unwrap(), \"true\");
513513

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//!
33
//! ## Example
44
//! ```rust
5-
//! use gtmpl;
5+
//! use gtmpl_ng;
66
//!
7-
//! let output = gtmpl::template("Finally! Some {{ . }} for Rust", "gtmpl");
7+
//! let output = gtmpl_ng::template("Finally! Some {{ . }} for Rust", "gtmpl");
88
//! assert_eq!(&output.unwrap(), "Finally! Some gtmpl for Rust");
99
//! ```
1010
@@ -50,7 +50,7 @@ pub use gtmpl_value::Value;
5050
///
5151
/// ## Example
5252
/// ```rust
53-
/// let output = gtmpl::template("Finally! Some {{ . }} for Rust", "gtmpl");
53+
/// let output = gtmpl_ng::template("Finally! Some {{ . }} for Rust", "gtmpl");
5454
/// assert_eq!(&output.unwrap(), "Finally! Some gtmpl for Rust");
5555
/// ```
5656
pub fn template<T: Into<Value>>(template_str: &str, context: T) -> Result<String, TemplateError> {

src/template.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ impl Template {
3939
/// ## Example
4040
///
4141
/// ```rust
42-
/// use gtmpl::{Context, Func, FuncError, Value};
42+
/// use gtmpl_ng::{Context, Func, FuncError, Value};
4343
///
4444
/// fn hello_world(_args: &[Value]) -> Result<Value, FuncError> {
4545
/// Ok(Value::from("Hello World!"))
4646
/// }
4747
///
48-
/// let mut tmpl = gtmpl::Template::default();
48+
/// let mut tmpl = gtmpl_ng::Template::default();
4949
/// tmpl.add_func("helloWorld", hello_world);
5050
/// tmpl.parse("{{ helloWorld }}").unwrap();
5151
/// let output = tmpl.render(&Context::empty());
@@ -62,14 +62,14 @@ impl Template {
6262
/// ```rust
6363
/// use std::collections::HashMap;
6464
///
65-
/// use gtmpl::{Context, Func, FuncError, Value};
65+
/// use gtmpl_ng::{Context, Func, FuncError, Value};
6666
///
6767
/// fn hello_world(_args: &[Value]) -> Result<Value, FuncError> {
6868
/// Ok(Value::from("Hello World!"))
6969
/// }
7070
///
7171
/// let funcs = vec![("helloWorld", hello_world as Func)];
72-
/// let mut tmpl = gtmpl::Template::default();
72+
/// let mut tmpl = gtmpl_ng::Template::default();
7373
/// tmpl.add_funcs(&funcs);
7474
/// tmpl.parse("{{ helloWorld }}").unwrap();
7575
/// let output = tmpl.render(&Context::empty());
@@ -85,7 +85,7 @@ impl Template {
8585
/// ## Example
8686
///
8787
/// ```rust
88-
/// let mut tmpl = gtmpl::Template::default();
88+
/// let mut tmpl = gtmpl_ng::Template::default();
8989
/// tmpl.parse("Hello World!").unwrap();
9090
/// ```
9191
pub fn parse<T: Into<String>>(&mut self, text: T) -> Result<(), ParseError> {
@@ -103,9 +103,9 @@ impl Template {
103103
/// ## Example
104104
///
105105
/// ```rust
106-
/// use gtmpl::Context;
106+
/// use gtmpl_ng::Context;
107107
///
108-
/// let mut tmpl = gtmpl::Template::default();
108+
/// let mut tmpl = gtmpl_ng::Template::default();
109109
/// tmpl.add_template("fancy", "{{ . }}");
110110
/// tmpl.parse(r#"{{ template "fancy" . }}!"#).unwrap();
111111
/// let output = tmpl.render(&Context::from("Hello World"));

0 commit comments

Comments
 (0)