-
Notifications
You must be signed in to change notification settings - Fork 6
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
Parser output for elements with property class and root class names? #51
Comments
I think the current behavior listed above results in a more consistent result for consumers, with |
So, it turns out that because this isn't included in the test suite, I managed to skip that line in the specification. I don't want to get too involved in what the values should be (I would like to know though!), but a couple of comments:
Take the markup: <div class="h-entry">
<img class="u-photo h-card" alt="My name" src="/photo.jpg">
</div> Looking at the specification:
The photo above doesn't have a
As it has no nested
Which means it should be: Expected output
Here, the PHP parse at microformats.io doesn't parse the Again, the contents of The way I've decided to interpret this is to take the |
I'm not sure I understand this part. What do you mean by root element? I would expect the parsed In the common <div class="h-entry">
<div class="e-content"><p>This is the content</p></div>
</div> The parsed result is: "items": [
{
"type": [
"h-entry"
],
"properties": {
"content": [
{
"html": "<p>This is the content</p>",
"value": "This is the content"
}
]
}
}
] Adding a nested h-card: <div class="h-entry">
<div class="e-content h-card"><p>This is the content</p></div>
</div> I would expect the parse to be: "items": [
{
"type": [
"h-entry"
],
"properties": {
"content": [
{
"type": [
"h-card"
],
"properties": {
"name": [
"This is the content"
]
},
"html": "<p>This is the content</p>",
"value": "This is the content"
}
]
}
}
] Images are a special case where if there's an alt, the parsed result will be an object, otherwise a string. ( |
Following up on a conversation I started in chat today, I'd like to clarify a section in the parsing spec related to generating output for parsed elements containing both property class and root class names.
The wording from section 1.2 of the parsing spec (emphasis added):
The test suite includes test cases for
p-*
andu-*
(see microformats-v2/h-entry/impliedvalue-nested.html, for instance) properties, but I couldn't find a test case against ane-*
property whose element also had a root class name.I interpret "re-use its
{ }
structure with existingvalue:
to mean that the nested item'svalue
should be set to the hash structure. That would result in something like:Current Behavior
Using a contrived markup example like:
…parsers currently output results like:
Expected Behavior
Using the same markup example, and by my interpretation of the specification, I'd expect output like:
Proposals?
Which of the above is a correct interpretation of the spec? Existing evidence from parsers and the non-authoritative microformats2-json wiki page point to those being the correct interpretation despite the unclear wording in the spec.
Is that the consensus of the community? If so, we should find a way to re-word the spec. If not, we should find a way to re-word the spec.
Thanks for reading! Looking forward to feedback.
The text was updated successfully, but these errors were encountered: