Closed hacdias closed 10 months ago
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.
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.
@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:
post-type: "recipe"
post-type: "review"
post-type: "audio"
XRay seems to also have support for bookmark, checkin and follows:
I can add those if desired, and leave the other ones out.
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
3f6d1e0
) 100.00% compared to head (23e996c
) 98.28%. Report is 2 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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.
@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?I think just checking for existence is fine in both cases. If those properties are present, then I think the intent is clear.
@willnorris updated :) I think it should be ready.
Ping @willnorris
Sorry, still haven't fixed my mail filter for GitHub notifications 😱 Thanks for adding this!
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.