-
Notifications
You must be signed in to change notification settings - Fork 3
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
metaformats: should we distinguish the parsed output item more explicitly? #2
Comments
given that they as far as I see don't really participate in the nesting of objects (i.e. a metaformats-parsed object is not going to be a child or property-value of an mf2-parsed object, nor vice-versa) they could be sorted in a separate list, e.g. |
I wondered about this too in microformats/microformats-parser#229.
I'd prefer to not put them in a separate list so a consumer of the parsed output doesn't need to do anything extra. So far I haven't personally needed to know if if an output if from metaformats, but I could see a property identifying it being useful. |
I think adding a new property if parsed["meta-item"]: vs. eg. if parsed["items"] and parsed["items"][-1].get("source") == "metaformats": I believe |
As @aciccarello mentioned, the problem is that a separate list forces all consumers to have to be explicit. One of the benefits of the current metaformats spec is that it lets current mf2 consuming code (choose to) benefit from metaformats automatically, without any changes. New top-level field preserves that, separate list doesn't. |
I do like automatic fallback for entries. Now I better see what you guys are talking about.
>>> mf2json = mf2py.parse(url="https://zeldman.com", metaformats=True)
>>> homepage_feed = mf2util.interpret_feed(mf2json, "https://zeldman.com")
>>> homepage_feed["entries"][-1]["name"]
'Zeldman on Web and Interaction Design' The fix will look something like this which is perfectly fine: if feed["entries"][-1].get("source") == "metaformats":
feed["entries"].pop() And you'll never actually need to look up the meta item so I was optimizing for a non-existent case with: if parsed["meta-item"]: So keeping it in |
Right now, if https://microformats.org/wiki/metaformats finds eligible metaformats, it generates an
h-entry
and appends it to the returneditems
. There's no way to distinguish this item from real mf2 items, though, which is unfortunate. As an implementor, I could use one! Especially for interpreting home page metaformats as anh-card
, eg #3, but also for non-homepage pages. Should we include a new property? New type? (I assume not.) Something else? cc @tantekThe text was updated successfully, but these errors were encountered: