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

Invalid h- prefix causes no matches #266

Open
gerbenjacobs opened this issue Nov 24, 2024 · 2 comments
Open

Invalid h- prefix causes no matches #266

gerbenjacobs opened this issue Nov 24, 2024 · 2 comments

Comments

@gerbenjacobs
Copy link

I was trying to parse my h-entry blog posts and I couldn't get any data. Only when I just copied the part of the article, it would work.

This meant the problem was somewhere else in the code. Long story short I'm using h-100 a class from Bootstrap and this is causing none of the other microformats to get parsed.

The problem is similar to #249 but the fix (#250) doesn't touch h- entries.

I have removed the h-100 classes from my code, doesn't actually seem to affect my layout at the moment. As such I'm not sure this is an urgent bug, but it is difficult to debug.

@gRegorLove
Copy link
Member

gRegorLove commented Nov 25, 2024

Thanks for reporting! Can you include a snippet of the HTML markup that caused this, or a link to a post with it?

Generally, the parser should not try to parse an mf2 root/property if the class name contains numbers (spec), so there might be a regression.

Here's a minimal example:

<div class="h-100 h-entry">
  <h1 class="p-name">testing</h1>
</div>
{
    "items": [
        {
            "type": [
                "h-entry"
            ],
            "properties": {
                "name": [
                    "testing"
                ]
            }
        }
    ],
    "rels": {},
    "rel-urls": {},
    "debug": {
        "package": "https://packagist.org/packages/mf2/mf2",
        "source": "https://github.com/indieweb/php-mf2",
        "version": "v0.5.0",
        "note": [
            "This output was generated from the php-mf2 library available at https://github.com/indieweb/php-mf2",
            "Please file any issues with the parser at https://github.com/indieweb/php-mf2/issues",
            "Using the Masterminds HTML5 parser"
        ]
    }
}

@gerbenjacobs
Copy link
Author

It's when the enclosing parent has the value.

See this example where h-100 is a CSS class for height: 100%

<main id="content" class="container h-100">

<div class="row justify-content-center">
    <div class="col-xl-6 col-lg-8 col-md-11">
        <article class="h-entry">
            <header>
                <h1 class="p-name">Thoughts on IndieWeb</h1>
            </header>
            <div class="e-content">
              <p>Content goes..</P>
            </div>
        </article>
    </div>
  </div>
</main>

Result

{
    "items": [],
    "rels": {},
    "rel-urls": {},
    "debug": {
        "package": "https://packagist.org/packages/mf2/mf2",
        "source": "https://github.com/indieweb/php-mf2",
        "version": "v0.5.0",
        "note": [
            "This output was generated from the php-mf2 library available at https://github.com/indieweb/php-mf2",
            "Please file any issues with the parser at https://github.com/indieweb/php-mf2/issues",
            "Using the Masterminds HTML5 parser"
        ]
    }
}

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

No branches or pull requests

2 participants