diff options
Diffstat (limited to 'src/works')
| -rw-r--r-- | src/works/mod.rs | 2 | ||||
| -rw-r--r-- | src/works/stories.rs | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/works/mod.rs b/src/works/mod.rs index f399fdd..3dfd4a2 100644 --- a/src/works/mod.rs +++ b/src/works/mod.rs @@ -10,5 +10,5 @@ pub trait Works: for<'a> Deserialize<'a> { } } - fn create_tera_context(&self) -> Vec<tera::Context>; + fn create_tera_context(&self) -> tera::Context; } diff --git a/src/works/stories.rs b/src/works/stories.rs index 5d96ed8..450f3bc 100644 --- a/src/works/stories.rs +++ b/src/works/stories.rs @@ -14,12 +14,10 @@ pub struct Story { } impl super::Works for Stories { - fn create_tera_context(&self) -> Vec<tera::Context> { - let mut context = Vec::new(); + fn create_tera_context(&self) -> tera::Context { + let mut context = tera::Context::new(); for story in self.0.iter() { - context.push( - tera::Context::from_serialize(&story).expect("Trying to serialize to tera context"), - ); + context.insert(format!("story-{}", story.id), &story); } context } |
