Skip to content

Commit

Permalink
Add source=metaformats to any meta item found
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelo Gladding committed Dec 8, 2023
1 parent 685fa86 commit 952750a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mf2py/metaformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def parse(soup, url=None):
if filter_classes(soup.get("class", []))["h"]:
return None

parsed = {"properties": {}}
parsed = {"properties": {}, "source": "metaformats"}
props = parsed["properties"]

# Properties
Expand Down
4 changes: 4 additions & 0 deletions test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,7 @@ def test_metaformats_title_only():
"properties": {
"name": ["Hello World"],
},
"source": "metaformats",
}
]

Expand All @@ -1171,6 +1172,7 @@ def test_metaformats_ogp():
"published": ["2023-01-02T03:04Z"],
"updated": ["2023-01-02T05:06Z"],
},
"source": "metaformats",
}
]

Expand All @@ -1185,6 +1187,7 @@ def test_metaformats_twitter():
"summary": ["Descrypshun bar"],
"photo": ["http://tantek.com/baz.jpg"],
},
"source": "metaformats",
}
]

Expand All @@ -1198,6 +1201,7 @@ def test_metaformats_html_meta():
"name": ["Hello World"],
"summary": ["Descrypshun bar"],
},
"source": "metaformats",
}
]

Expand Down

0 comments on commit 952750a

Please sign in to comment.