microformats / microformats-parser

A JavaScript microformats parser for the browser and node.js
https://microformats.github.io/microformats-parser/
MIT License
55 stars 11 forks source link

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

Open nex3 opened 1 month ago

nex3 commented 1 month ago

Checklist

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"]
}