Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Zegnat
Copy link
Member

@Zegnat Zegnat commented Oct 29, 2023

Fixes #278.

Checklist

  • Added tests covering the parsing behaviour changes.
  • Linked to any relevant issues this will close.
  • Tested the output using the demo.

Changes to parsing behaviour

It will now return nested microformats within dt-* properties. The step “parse a child element for microformats (recurse) ” should always happen for all. And then:

if that child element itself has a microformat ("h-*" or backcompat roots) and is a property element, add it into the array of values for that property

The only thing not specifically designed for dt- is whether we can imply any value. So instead we set value to “the parsed property value per p-*,u-*,dt-* parsing”.

Example input covered by new behaviour

<div class="h-card">
  <div class="dt-bday h-event">
    <time class="dt-start dt-end" datetime="2010-05-02">2nd May</time>
  </div>
</div>

Example output from new behaviour

{
  "rels": {},
  "rel-urls": {},
  "items": [
    {
      "type": [
        "h-card"
      ],
      "properties": {
        "bday": [
          {
            "type": [
              "h-event"
            ],
            "properties": {
              "start": [
                "2010-05-02"
              ],
              "end": [
                "2010-05-02"
              ],
              "name": [
                "2nd May"
              ]
            },
            "value": "2nd May"
          }
        ]
      }
    }
  ]
}

@Zegnat Zegnat force-pushed the fix/nested-within-dt branch from bce9c95 to 6b0222f Compare October 29, 2023 14:06
@aimee-gm
Copy link
Member

@Zegnat thank you so much for taking the time to make this change!

Also: sorry for respinding earlier!

@aimee-gm aimee-gm enabled auto-merge (squash) November 13, 2023 08:58
@aimee-gm aimee-gm disabled auto-merge November 13, 2023 08:58
@aimee-gm aimee-gm enabled auto-merge (squash) November 13, 2023 08:58
@aimee-gm aimee-gm merged commit 8a925a2 into microformats:main Nov 13, 2023
@Zegnat Zegnat deleted the fix/nested-within-dt branch November 14, 2023 23:52
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.

Not parsing nested microformats within dt-* properties
2 participants