[microformats][0] are the simplest way to openly publish contacts, events,
reviews, recipes, and other structured information on the web.
>>> import mf
>>> url = "https://alice.example"
>>> doc = f'''
... <p class=h-card><a href={url}>Alice</a></p>
... <ul class=h-feed>
... <li class=h-entry>foo
... <li class=h-entry>bar
... </ul>
... '''
>>> page = mf.parse(doc=doc, url=url)
# TODO >>> dict(page)
# TODO >>> page.json
>>> card = page["items"][0]
>>> card["type"]
['h-card']
>>> card["properties"]
{'name': ['Alice'], 'url': ['https://alice.example']}
>>> feed = page["items"][1]
>>> feed["children"][0]["properties"]["name"]
['foo']
>>> mf.util.representative_card(page, url)
{'name': ['Alice'], 'url': ['https://alice.example']}
>>> mf.util.representative_feed(page, url)["items"][0]["name"]
['foo']
# TODO >>> page.representative_card
# TODO {'name': ['Alice'], 'url': ['https://alice.example']}
# TODO >>> page.representative_feed["items"][0]["name"]
# TODO ['foo']
Based upon [`mf2py`][1] and [`mf2util`][2].
[0]: https://microformats.org/wiki/microformats
[1]: https://github.com/microformats/mf2py
[2]: https://github.com/kylewm/mf2util
Raw data
{
"_id": null,
"home_page": "https://ragt.ag/code/python-microformats",
"name": "microformats",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<3.11",
"maintainer_email": "",
"keywords": "IndieWeb,microformats",
"author": "Angelo Gladding",
"author_email": "angelo@ragt.ag",
"download_url": "https://files.pythonhosted.org/packages/c6/ac/e6f64591e3d96cf1113dbaca831fef3025d7312f276c0ff860f3812de3cc/microformats-0.5.0.tar.gz",
"platform": null,
"description": "[microformats][0] are the simplest way to openly publish contacts, events,\nreviews, recipes, and other structured information on the web.\n\n >>> import mf\n >>> url = \"https://alice.example\"\n >>> doc = f'''\n ... <p class=h-card><a href={url}>Alice</a></p>\n ... <ul class=h-feed>\n ... <li class=h-entry>foo\n ... <li class=h-entry>bar\n ... </ul>\n ... '''\n >>> page = mf.parse(doc=doc, url=url)\n\n # TODO >>> dict(page)\n # TODO >>> page.json\n\n >>> card = page[\"items\"][0]\n >>> card[\"type\"]\n ['h-card']\n >>> card[\"properties\"]\n {'name': ['Alice'], 'url': ['https://alice.example']}\n >>> feed = page[\"items\"][1]\n >>> feed[\"children\"][0][\"properties\"][\"name\"]\n ['foo']\n\n >>> mf.util.representative_card(page, url)\n {'name': ['Alice'], 'url': ['https://alice.example']}\n >>> mf.util.representative_feed(page, url)[\"items\"][0][\"name\"]\n ['foo']\n\n # TODO >>> page.representative_card\n # TODO {'name': ['Alice'], 'url': ['https://alice.example']}\n # TODO >>> page.representative_feed[\"items\"][0][\"name\"]\n # TODO ['foo']\n\nBased upon [`mf2py`][1] and [`mf2util`][2].\n\n[0]: https://microformats.org/wiki/microformats\n[1]: https://github.com/microformats/mf2py\n[2]: https://github.com/kylewm/mf2util\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "tools for microformats production, consumption and analysis",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://ragt.ag/code/python-microformats"
},
"split_keywords": [
"indieweb",
"microformats"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5c5ca95e21245b157fffa6aa1145c0d6abb908197c9e3d858f80272bc353af32",
"md5": "dad49f0119330c122bb8b59c0fc16682",
"sha256": "32783b2c5572698034c09bd02b301299281cb853bf05b916946f070eb88e1ddc"
},
"downloads": -1,
"filename": "microformats-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dad49f0119330c122bb8b59c0fc16682",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<3.11",
"size": 13301,
"upload_time": "2023-12-13T21:49:32",
"upload_time_iso_8601": "2023-12-13T21:49:32.968590Z",
"url": "https://files.pythonhosted.org/packages/5c/5c/a95e21245b157fffa6aa1145c0d6abb908197c9e3d858f80272bc353af32/microformats-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c6ace6f64591e3d96cf1113dbaca831fef3025d7312f276c0ff860f3812de3cc",
"md5": "1d5e3ae7f2e6df529e2986d9154edb0f",
"sha256": "7eaddd88502bc7720dc057d18587566778cf5ef85c2973cdefa3639e6c07c434"
},
"downloads": -1,
"filename": "microformats-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "1d5e3ae7f2e6df529e2986d9154edb0f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<3.11",
"size": 13530,
"upload_time": "2023-12-13T21:49:35",
"upload_time_iso_8601": "2023-12-13T21:49:35.476456Z",
"url": "https://files.pythonhosted.org/packages/c6/ac/e6f64591e3d96cf1113dbaca831fef3025d7312f276c0ff860f3812de3cc/microformats-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-13 21:49:35",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "microformats"
}