microformats-ruby icon indicating copy to clipboard operation
microformats-ruby copied to clipboard

No author URL in 4.0.9 (Breaking change)

Open Gargron opened this issue 7 years ago • 2 comments

undefined method `url' for #<Microformats::ParserResult:0x00005556e27ddaa0>

when accessing mf2.entry.comment.author.url in 4.0.9. This is a breaking change from 4.0.7 where it worked fine.

Gargron avatar Oct 11 '18 17:10 Gargron

I was able to reproduce this issue with a random post from your account, and it looks to be caused by the microformats spec having changed the implied u-url rules. Since u-photo exists, it no longer implies a u-url. I realize now that should have been a version bump as that is actually a breaking change.

dissolve avatar Oct 11 '18 19:10 dissolve

Example html to reproduce.

` <div class="h-entry"> <div class="h-cite p-comment"> <a class="status__display-name p-author h-card" rel="noopener" href="https://site.example/@AwesomeUser"> <img width="48" height="48" alt="" class="u-photo account__avatar" src="https://site.example/user-photo.png" /> <strong class="display-name__html p-name emojify">AwesomeUser</strong> </a> </div> </div>

`

Not sure if we should roll back the version at this point @jgarber623 thoughts?

Going forward, I would recommend specifying the u-url as no new parser will get this url value. If you wrap move the classes out of the A tag to a containing tag it will work.

<div class="h-entry"> <div class="h-cite p-comment"> <div class="p-author h-card"> <a class="status__display-name u-url" rel="noopener" href="https://site.example/@AwesomeUser"> <img width="48" height="48" alt="" class="u-photo account__avatar" src="https://site.example/user-photo.png" /> <strong class="display-name__html p-name emojify">AwesomeUser</strong> </a> </div> </div> </div>`

dissolve avatar Oct 11 '18 19:10 dissolve