mf2util
Advanced tools
| Metadata-Version: 1.1 | ||
| Name: mf2util | ||
| Version: 0.3.1.1 | ||
| Version: 0.3.2 | ||
| Summary: Python Microformats2 utilities, a companion to mf2py | ||
@@ -5,0 +5,0 @@ Home-page: http://indiewebcamp.com/mf2util |
+30
-12
@@ -453,3 +453,3 @@ """Utilities for interpreting mf2 data. | ||
| def _interpret_common_properties(parsed, source_url, base_href, hentry, want_json): | ||
| def _interpret_common_properties(parsed, source_url, base_href, hentry, use_rel_syndication, want_json): | ||
| result = {} | ||
@@ -506,5 +506,8 @@ for prop in ('url', 'uid', 'photo'): | ||
| result['syndication'] = list( | ||
| set((parsed['rels'].get('syndication', []) + | ||
| hentry['properties'].get('syndication', [])))) | ||
| if use_rel_syndication: | ||
| result['syndication'] = list(set( | ||
| parsed['rels'].get('syndication', []) + | ||
| hentry['properties'].get('syndication', []))) | ||
| else: | ||
| result['syndication'] = hentry['properties'].get('syndication', []) | ||
@@ -514,3 +517,3 @@ return result | ||
| def interpret_event(parsed, source_url, base_href=None, hevent=None, want_json=False): | ||
| def interpret_event(parsed, source_url, base_href=None, hevent=None, use_rel_syndication=True, want_json=False): | ||
| """Given a document containing an h-event, return a dictionary:: | ||
@@ -533,2 +536,6 @@ | ||
| find_first_entry | ||
| :param boolean use_rel_syndication: (optional, default True) Whether | ||
| to include rel=syndication in the list of syndication sources. Sometimes | ||
| useful to set this to False when parsing h-feeds that erroneously include | ||
| rel=syndication on each entry. | ||
| :param boolean want_json: (optional, default false) if true, the result | ||
@@ -545,3 +552,3 @@ will be pure json with datetimes as strings instead of python objects | ||
| result = _interpret_common_properties( | ||
| parsed, source_url, base_href, hevent, want_json) | ||
| parsed, source_url, base_href, hevent, use_rel_syndication, want_json) | ||
| result['type'] = 'event' | ||
@@ -556,3 +563,3 @@ | ||
| def interpret_entry(parsed, source_url, base_href=None, hentry=None, want_json=False): | ||
| def interpret_entry(parsed, source_url, base_href=None, hentry=None, use_rel_syndication=True, want_json=False): | ||
| """Given a document containing an h-entry, return a dictionary:: | ||
@@ -588,2 +595,6 @@ | ||
| call to find_first_entry | ||
| :param boolean use_rel_syndication: (optional, default True) Whether | ||
| to include rel=syndication in the list of syndication sources. Sometimes | ||
| useful to set this to False when parsing h-feeds that erroneously include | ||
| rel=syndication on each entry. | ||
| :param boolean want_json: (optional, default False) if true, the result | ||
@@ -601,3 +612,3 @@ will be pure json with datetimes as strings instead of python objects | ||
| result = _interpret_common_properties( | ||
| parsed, source_url, base_href, hentry, want_json) | ||
| parsed, source_url, base_href, hentry, use_rel_syndication, want_json) | ||
| if 'h-cite' in hentry.get('type', []): | ||
@@ -657,3 +668,5 @@ result['type'] = 'cite' | ||
| for child in children: | ||
| entry = interpret(parsed, source_url, base_href, item=child) | ||
| entry = interpret( | ||
| parsed, source_url, base_href, item=child, | ||
| use_rel_syndication=False) | ||
| if entry: | ||
@@ -665,3 +678,4 @@ entries.append(entry) | ||
| def interpret(parsed, source_url, base_href=None, item=None, want_json=False): | ||
| def interpret(parsed, source_url, base_href=None, item=None, | ||
| use_rel_syndication=True, want_json=False): | ||
| """Interpret a permalink of unknown type. Finds the first interesting | ||
@@ -677,2 +691,6 @@ h-* element, and delegates to :func:`interpret_entry` if it is an | ||
| this will be used instead of the first element on the page. | ||
| :param boolean use_rel_syndication: (optional, default True) Whether | ||
| to include rel=syndication in the list of syndication sources. Sometimes | ||
| useful to set this to False when parsing h-feeds that erroneously include | ||
| rel=syndication on each entry. | ||
| :param boolean want_json: (optional, default False) If true, the result | ||
@@ -688,6 +706,6 @@ will be pure json with datetimes as strings instead of python objects | ||
| return interpret_event( | ||
| parsed, source_url, base_href=base_href, hevent=item, want_json=want_json) | ||
| parsed, source_url, base_href=base_href, hevent=item, use_rel_syndication=use_rel_syndication, want_json=want_json) | ||
| elif 'h-entry' in item.get('type', []) or 'h-cite' in item.get('type', []): | ||
| return interpret_entry( | ||
| parsed, source_url, base_href=base_href, hentry=item, want_json=want_json) | ||
| parsed, source_url, base_href=base_href, hentry=item, use_rel_syndication=use_rel_syndication, want_json=want_json) | ||
@@ -694,0 +712,0 @@ |
+1
-1
| Metadata-Version: 1.1 | ||
| Name: mf2util | ||
| Version: 0.3.1.1 | ||
| Version: 0.3.2 | ||
| Summary: Python Microformats2 utilities, a companion to mf2py | ||
@@ -5,0 +5,0 @@ Home-page: http://indiewebcamp.com/mf2util |
+1
-1
@@ -27,3 +27,3 @@ #!/usr/bin/env python | ||
| setup(name='mf2util', | ||
| version='0.3.1.1', | ||
| version='0.3.2', | ||
| description='Python Microformats2 utilities, a companion to mf2py', | ||
@@ -30,0 +30,0 @@ long_description=""" |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
31860
3.94%657
2.82%