Added
Development
- Provide docstrings for all functions in the library that did not have a docstring.
- Fix docstring rendering issues with library documentation so that all docstrings show up on [Read the Docs](https://indieweb-utils.readthedocs.io/en/latest/).
- Add `:raises:` statements to docstrings to document existing
- Add code examples to docstrings and remove redundant examples from RS documentation.
- Add a [SECURITY.md](https://github.com/capjamesg/indieweb-utils/blob/main/SECURITY.md) policy.
- Split up documentation into more sections to enhance one's ability to navigate the documentation.
Functions
- `discover_h_feed()` function to discover the representative h-feed on a page.
- `get_valid_relmeauth_links()` function to find both one-way and bi-directional rel=me links on a web page.
- `get_representative_h_card()` function to get the [representative h-card](https://microformats.org/wiki/representative-h-card-parsing) associated with a web page.
- `get_url_summary()` function to generate a summary from a URL, based on the experimental [CASSIS auto_url_summary PHP function](https://indieweb.org/auto-url-summary#Open_Source).
- This function provides examples for GitHub, Twitter, Upcoming, Eventbrite (.com and .co.uk), Calagator, [IndieWeb Events](https://events.indieweb.org), and the [IndieWeb wiki](https://indieweb.org).
- `autolink_tags()` function to replace hashtags () with relevant tag pages and person tags () with the names and domains of people tagged.
- Create internal helper functions:
- `get_parsed_mf2_data()` to retrieve microformats2 data from a page given a parsed mf2py.Parse object, a HTML string, and a URL.
- `get_soup()` to retrieve a BeautifulSoup object from a provided HTML string and URL.
Tests
- Added test cases for:
- `discover_h_feed()`
- `get_representative_h_card()`
- `get_valid_relmeauth_links()`
- `get_url_summary()`
- `autolink_tags()`
Changed
- Support importing IndieAuth functions directly from `indieweb_utils` without having to use `indieweb_utils.indieauth.`.
- Simplify `get_h_app_item()` logic.
- Raise `HAppNotFound` exception when `get_h_app_item()` cannot identify a h-app microformat.
- Renamed `_discover_endpoints` to `discover_endpoints`.
- `discover_endpoints` can raise a `requests.exceptions.RequestException` if there was an error making a request to retrieve an endpoint.
- `discover_webmention_endpoint()` can now raise LocalhostEndpointFound, TargetNotProvided, UnacceptableIPAddress, and WebmentionEndpointNotFound exceptions when there is an issue validating a webmention.
- `send_webmention()` can now raise MissingSourceError, MissingTargetError, UnsupportedProtocolError, TargetIsNotApprovedDomain, GenericWebmentionError, and CouldNotConnectToWebmentionEndpoint if there was an issue sending a webmention.
- `send_webmention()` now returns the HTTP status code and headers of a successful webmention.
- `get_post_type()` raises an `PostTypeFormattingError` exception if an invalid `custom_properties` tuple is provided.
- `get_reply_context()` raises an `ReplyContextRetrievalError` if there was an error retrieving context for a URL. This function also raises an `UnsupportedScheme` error if a URL does not use either HTTP or HTTPS.
- `validate_webmention()` can raise WebmentionIsGone or WebmentionValidationError exceptions if there was an error validating a webmention.
- `canonicalize_url()` returns the exact URL passed in if the URL contains a protocol that is not HTTP or HTTPS.