about summary refs log tree commit diff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/src/mf2.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/templates/src/mf2.rs b/templates/src/mf2.rs
index 076989c..550adfc 100644
--- a/templates/src/mf2.rs
+++ b/templates/src/mf2.rs
@@ -237,15 +237,15 @@ markup::define! {
                 }
                 @if post["properties"]["ate"].is_array() || post["properties"]["drank"].is_array() {
                     div {
-                        @if post["properties"]["ate"].is_array() {
+                        @if let Some(ate) = post["properties"]["ate"].as_array() {
                             span { ul {
                                 "Ate:"
-                                @for food in post["properties"]["ate"].as_array().unwrap() {
+                                @for food in ate {
                                     li {
-                                        @if food.is_string() {
+                                        @if let Some(food) = food.as_str() {
                                             // If this is a string, it's a URL.
-                                            a."u-ate"[href=food.as_str().unwrap()] {
-                                                @food.as_str().unwrap().truncate_ellipse(24).as_ref()
+                                            a."u-ate"[href=food] {
+                                                @food.truncate_ellipse(24).as_ref()
                                             }
                                         } else {
                                             // This is a rich food object (mm, sounds tasty! I wanna eat something tasty)
@@ -258,15 +258,15 @@ markup::define! {
                                 }
                             } }
                         }
-                        @if post["properties"]["drank"].is_array() {
+                        @if let Some(drank) = post["properties"]["drank"].as_array() {
                             span { ul {
                                 "Drank:"
-                                @for food in post["properties"]["drank"].as_array().unwrap() {
+                                @for food in drank {
                                     li {
-                                        @if food.is_string() {
+                                        @if let Some(food) = food.as_str() {
                                             // If this is a string, it's a URL.
-                                            a."u-drank"[href=food.as_str().unwrap()] {
-                                                @food.as_str().unwrap().truncate_ellipse(24).as_ref()
+                                            a."u-drank"[href=food] {
+                                                @food.truncate_ellipse(24).as_ref()
                                             }
                                         } else {
                                             // This is a rich food object (mm, sounds tasty! I wanna eat something tasty)