Description: fix reference fetching of object
Author: Jacky Alciné <ayo@jacky.wtf>
Origin: upstream, https://gitlab.com/maxburon/microformats-parser/-/merge_requests/11/diffs?commit_id=27c1c79
Bug: https://gitlab.com/maxburon/microformats-parser/-/issues/25
Last-Update: 2025-04-07
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/library/src/jf2.rs
+++ b/library/src/jf2.rs
@@ -324,7 +324,7 @@
         let mut references = if let Some(Property::References(refs)) = self.0.remove("references") {
             refs
         } else {
-            return;
+            Default::default()
         };
 
         for (property_name, property_value) in self.0.iter_mut() {
--- a/library/src/jf2/test.rs
+++ b/library/src/jf2/test.rs
@@ -63,7 +63,6 @@
             }
             ],
             "properties": {
-                "url": ["https://indieweb.org/pages"],
                 "bookmark-of": [
                     {
                         "type": ["h-cite"],
@@ -78,7 +77,8 @@
                         "html": "<strong>HTML</strong>!",
                         "value": "HTML!"
                     }
-                ]
+                ],
+                "url": ["https://indieweb.org/pages"],
             }
         }
         ]
@@ -90,24 +90,24 @@
         "@context": super::JSON_LD_CONTEXT_URI,
         "children": [
         {
-            "text": "HTML!",
-            "html": "<strong>HTML</strong>!",
-            "type": "entry",
-            "url": "https://indieweb.org/pages",
             "bookmark-of": "https://indieweb.org/bookmark",
             "children": [
                 {
+                    "photo": "https://indieweb.org/child-photo.jpg",
                     "type": "cite",
                     "url": "https://indieweb.org/child",
-                    "photo": "https://indieweb.org/child-photo.jpg",
                 }
-            ]
+            ],
+            "html": "<strong>HTML</strong>!",
+            "text": "HTML!",
+            "type": "entry",
+            "url": "https://indieweb.org/pages",
         }
         ],
         "references": {
             "https://indieweb.org/bookmark": {
-                "type": "cite",
                 "photo": "https://indieweb.org/bookmark-photo.jpg",
+                "type": "cite",
                 "url": "https://indieweb.org/bookmark",
             }
         },
