diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -195,7 +195,7 @@ impl Crimtag { | |||
| 195 | } | 195 | } |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | pub fn view_partial(&self, view: &str, input: &Value ) -> Result<Value,ParseError> { | 198 | pub fn render_partial(&self, view: &str, input: &Value ) -> Result<Value,ParseError> { |
| 199 | if let Some(view) = self.views.get(view) { | 199 | if let Some(view) = self.views.get(view) { |
| 200 | return view.process( input ) | 200 | return view.process( input ) |
| 201 | } else { | 201 | } else { |
| @@ -203,11 +203,11 @@ impl Crimtag { | |||
| 203 | } | 203 | } |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | pub fn view(&self, view: &str, input: &Value ) -> Result<String,ParseError> { | 206 | pub fn render(&self, view: &str, input: &Value ) -> Result<String,ParseError> { |
| 207 | if let Some(view) = self.views.get( view ) { | 207 | if let Some(view) = self.views.get( view ) { |
| 208 | let output = view.process( input )?; | 208 | let output = view.process( input )?; |
| 209 | if let Some(l) = &view.layout { | 209 | if let Some(l) = &view.layout { |
| 210 | self.view( l, &output ) | 210 | self.render( l, &output ) |
| 211 | } else { | 211 | } else { |
| 212 | if let Value::Dictionary(mut d) = output && | 212 | if let Value::Dictionary(mut d) = output && |
| 213 | let Some(content) = d.remove("content") && | 213 | let Some(content) = d.remove("content") && |
| @@ -315,7 +315,7 @@ Now with explicit outputs: | |||
| 315 | println!("Error: {:?}", e ); | 315 | println!("Error: {:?}", e ); |
| 316 | } else { | 316 | } else { |
| 317 | println!("It finished"); | 317 | println!("It finished"); |
| 318 | if let Ok(v) = ct.view( | 318 | if let Ok(v) = ct.render( |
| 319 | "index", | 319 | "index", |
| 320 | &Value::Dictionary( | 320 | &Value::Dictionary( |
| 321 | HashMap::from([ | 321 | HashMap::from([ |
