diff options
| author | Mike Buland <mike@xagasoft.com> | 2026-06-08 22:04:37 -0700 |
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2026-06-08 22:04:37 -0700 |
| commit | 9c5da7c258a49d911b20629be6b4ef426d4f431e (patch) | |
| tree | 6370c7beed428b131f52de54c52dbf44bd74d89c /src/lib.rs | |
| parent | 0f2bd09d269862105e603a9865201f521f49490b (diff) | |
| download | crimtag-9c5da7c258a49d911b20629be6b4ef426d4f431e.tar.gz crimtag-9c5da7c258a49d911b20629be6b4ef426d4f431e.tar.bz2 crimtag-9c5da7c258a49d911b20629be6b4ef426d4f431e.tar.xz crimtag-9c5da7c258a49d911b20629be6b4ef426d4f431e.zip | |
Renamed the view functions to render.
Diffstat (limited to 'src/lib.rs')
| -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([ |
