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

Fix/nested within dt #279

Merged
merged 4 commits into from Nov 13, 2023
Merged

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

@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 enabled auto-merge (squash) November 13, 2023 08:58
@aimee-gm aimee-gm merged commit 8a925a2 into microformats:main Nov 13, 2023
5 checks passed
@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