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

Don't parse implicit properties with nested property microformats #399

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nex3
Copy link

@nex3 nex3 commented Oct 4, 2024

Checklist

  • Added tests covering the parsing behaviour changes.

Changes to parsing behaviour

Previously, this was checking the same array returned by findChildren(). However, findChildren() excludes children that are the values of properties themselves. Per spec, if there are any nested microformats implicit properties should not be parsed.

This now matches the behavior of https://php.microformats.io/.

Example input covered by new behaviour

<div class="h-entry">
  <a href="http://example.com/"></a>
  <div class="p-author h-card">
    <span class="p-name">microformats</span>
  </div>
</div>

Example output from new behaviour

{
  "properties": {
    "author": [
      {
        "properties": {
          "name": ["microformats"]
        },
        "type": ["h-card"],
        "value": "microformats"
      }
    ]
  },
  "type": ["h-entry"]
}

Previously, this was checking the same array returned by
`findChildren()`. However, `findChildren()` excludes children that are
the values of properties themselves. Per spec, if there are *any*
nested microformats implicit properties should not be parsed.

This now matches the behavior of https://php.microformats.io/.
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.

1 participant