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

feat(ptd): add support for new types #23

Merged
merged 1 commit into from
Dec 14, 2023
Merged

feat(ptd): add support for new types #23

merged 1 commit into from
Dec 14, 2023

Conversation

hacdias
Copy link
Contributor

@hacdias hacdias commented Nov 24, 2023

Adds the post type discovery algorithm to this package. I have it in my library, but I think that it might fit here better since its... Microformats. It is a slightly augmented version compared to the original, as it checks for other post types too.

--

Thanks @nekr0z for asking me I had thought about making a PR here.

@willnorris
Copy link
Owner

willnorris commented Nov 26, 2023

this is already implemented in the ptd package: https://pkg.go.dev/willnorris.com/go/microformats/ptd . If you want to add support for additional types, add them there? Though I'd also want to see how closely those additional types match what is used in the wild, and/or other microformat parsers.

@hacdias
Copy link
Contributor Author

hacdias commented Nov 26, 2023

Oh, I have no idea how I missed the sub-package. I will take a better look and update the PR.

Though I'd also want to see how closely those additional types match what is used in the wild, and/or other microformat parsers.

Regarding that, indeed I'm not sure how common we'll find them in the wild. The post types do exist, but are not considered for the algorithm. My personal case before, when I implemented this, was to not allow certain post types.

https://micropublish.net/ for example has support for most of the post types.

@hacdias
Copy link
Contributor Author

hacdias commented Nov 26, 2023

@willnorris I updated the PR to only add support for recipe, review and audio. The following I did not add: bookmark, follow, read, watch, listen, checkin, ate, drank, itinerary. They do exist in the wild, I would say bookmark and checkins being the most common.

XRay for example gives those post-types. Some posts you can try:

XRay seems to also have support for bookmark, checkin and follows:

https://github.com/aaronpk/XRay/blob/9c0a8ba48b3328a8bc290a4dbeaf9cfd0c891ef5/lib/XRay/PostType.php#L26-L33

I can add those if desired, and leave the other ones out.

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3f6d1e0) 100.00% compared to head (23e996c) 98.28%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main      #23      +/-   ##
===========================================
- Coverage   100.00%   98.28%   -1.72%     
===========================================
  Files            4        5       +1     
  Lines          843      935      +92     
===========================================
+ Hits           843      919      +76     
- Misses           0       11      +11     
- Partials         0        5       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@willnorris
Copy link
Owner

oops... looks like I had email notifications for this repo getting filtered so I didn't see your reply 😕

In any event, this looks great. And I'd be down with adding the other that XRay supports as well. Though interestingly, I don't think XRay has different methods for PostType and ReplyType, which is how the spec breaks it out. For things like bookmark-of and follow-of, I think those should be in ReplyType here in the go library.

@hacdias
Copy link
Contributor Author

hacdias commented Dec 4, 2023

@willnorris just pushed an addition for bookmark-of. I also wanted to add follow-of and checkin. But I have some thoughts:

  • follow-of might be just an URL or an h-card. XRay doesn't really check whether the URL is valid or not and limits itself to "is key present" philosophy. We could either just check for the URL and not support h-card, or keep it the way it is.
  • checkin is similar to above, but usually is an h-card: https://indieweb.org/checkin#How - should I just check for its existence?

@willnorris
Copy link
Owner

I think just checking for existence is fine in both cases. If those properties are present, then I think the intent is clear.

new supported types: recipe, review, audio,
bookmark, follow, and checkin.
@hacdias hacdias changed the title feat: post type discovery algorithm feat(ptd): add support for new types Dec 6, 2023
@hacdias
Copy link
Contributor Author

hacdias commented Dec 6, 2023

@willnorris updated :) I think it should be ready.

@hacdias
Copy link
Contributor Author

hacdias commented Dec 11, 2023

Ping @willnorris

@willnorris willnorris merged commit 07cd52d into willnorris:main Dec 14, 2023
4 of 6 checks passed
@willnorris
Copy link
Owner

Sorry, still haven't fixed my mail filter for GitHub notifications 😱 Thanks for adding this!

@hacdias hacdias deleted the post-type-discovery branch December 14, 2023 18:29
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

Successfully merging this pull request may close these issues.

3 participants