-
-
Notifications
You must be signed in to change notification settings - Fork 30
Fix: Implement nickname fallback for mf2 parser #530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces fallback logic for the author’s name
property: if name
is empty it uses nickname
, or concatenates given-name
+ family-name
. It also adds new JSON and HTML fixtures to the test suite.
- Implement fallback for missing
name
inclass-mf2.php
- Add a basic JSON fixture with
author.name
- Add an HTML fixture containing
p-nickname
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/data/mf2/brid-gy-mastodon.json | Add minimal JSON fixture for author with name |
tests/data/mf2/brid-gy-mastodon.html | Add HTML fixture containing author metadata including nickname |
includes/Handler/class-mf2.php | Implement nickname and given-name/family-name fallback for missing name |
Comments suppressed due to low confidence (3)
includes/Handler/class-mf2.php:117
- Consider updating the method's docblock to document the new fallback behavior for the author name, improving maintainability and clarity for future contributors.
if ( empty( $author['name'] ) ) {
tests/data/mf2/brid-gy-mastodon.json:1
- It would be beneficial to add a test fixture where the
name
property is missing butnickname
and/orgiven-name
andfamily-name
are provided, verifying the fallback logic works as expected.
{
tests/data/mf2/brid-gy-mastodon.html:36
- Consider adding an HTML fixture where the
<span class="p-name">
element is absent butp-nickname
and/orp-given-name
andp-family-name
elements are present, to cover fallback parsing in HTML cases.
<span class="p-nickname">elena</span>
@snarfed fed.brid.gy is really breaking the complete classic webmention mf2 parsing!! |
@snarfed can you tell me the |
and improve regex to support `<a>` with nested HTML
Hey @pfefferle, sorry for the trouble! Looks like the target there probably should have been |
The current code seems to parse the
nickname
, but there is no fallback implemented. This PR tries to fall back tonickname
andgiven-name
+family-name
ifname
is empty.This fixes fed.brid.gy webmentions.