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

wrongly implied photo #190

Closed
sknebel opened this issue Aug 6, 2018 · 1 comment
Closed

wrongly implied photo #190

sknebel opened this issue Aug 6, 2018 · 1 comment
Milestone

Comments

@sknebel
Copy link
Member

sknebel commented Aug 6, 2018

Given

<span class="h-card">
  <a href="http://example.com">
    <img src="https://example.com">
  </a> 
  <span class="p-name"><a href="/User:Example.com">Max Mustermann</a></span>
</span>

php-mf2 resolves the <img src="" as an implied photo, but there is no rule allowing so: Per http://microformats.org/wiki/microformats2-parsing#parsing_for_implied_properties, rules for implied photo from img src:

if img.h-x[src], then use src for photo

Clearly doesn't apply, img is not root

else if .h-x>img[src]:only-of-type:not[.h-*] then use that img src for photo

imgis not a direct child of root

else if .h-x>:only-child:not[.h-*]>img[src]:only-of-type:not[.h-*], then use that img’s src for photo

parent of img is not the only child of root

(discovered via indieweb.org/chat-names page, where default avatars where parsed as photo)

@gRegorLove gRegorLove added this to the 0.4.6 milestone Aug 6, 2018
@Zegnat
Copy link
Member

Zegnat commented Aug 6, 2018

The problem seems to be that our rule matching .h-x>:only-child:not[.h-*]>img[src]:only-of-type:not[.h-*] doesn’t actually test the :only-child part and only the :not[.h-*] part.

'./*[not(contains(concat(" ", @class), " h-"))]/img[count(preceding-sibling::img)+count(following-sibling::img)=0]',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants