Skip to content
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

No author on Grapefruit #69

Open
Zegnat opened this issue May 2, 2018 · 1 comment
Open

No author on Grapefruit #69

Zegnat opened this issue May 2, 2018 · 1 comment

Comments

@Zegnat
Copy link
Contributor

Zegnat commented May 2, 2018

Grapefruit has some posts. XRay seems capable of parsing these posts (although I am still unsure of where in the code it decides to look at the entries within the feed).

What it does not seem to correctly do is find my author info. It should, at step 4 of the algorithm, go check the author property of the h-feed the h-entry is in. This should return https://vanderven.se/martijn/.

I might find time to debug this. Or might not. So filing it here either way.

@Zegnat
Copy link
Contributor Author

Zegnat commented May 3, 2018

This may require a lot more refactoring than I initially thought. It looks like, whenever a fragment URL is provided, XRay is only going to parse that little piece of HTML:

// If the URL has a fragment ID, find the DOM starting at that node and parse it instead
$fragment = parse_url($url, PHP_URL_FRAGMENT);
if($fragment) {
$fragElement = self::xPathGetElementById($xpath, $fragment);
if($fragElement) {
$html = $doc->saveHTML($fragElement);
$foundFragment = true;
} else {
$foundFragment = false;
}
}

From that point in the code forward, it doesn’t even know the h-entry was part of an h-feed.

I also noticed there that PHP’s default DOMDocument is used to parse and then save the HTML. This could potentially mess up some HTML. As php-mf2 supports taking a DOMDocument as input, it definitely shouldn’t get saved to HTML first. (And it should possibly use the userland HTML parser.)

Not sure if a simply solution is available here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant