beatonma / django-wm

Automatic Webmention functionality for Django models
https://beatonma.org/webmentions_tester/
GNU General Public License v3.0
12 stars 2 forks source link

Should HCards be found within h-entry's? #34

Closed philgyford closed 1 year ago

philgyford commented 2 years ago

The HCard parser currently uses mf2py to get a list of "items" and only looks for an h-card item at the top level of that, i.e. alongside the h-entry item.

I think it's also OK to have a p-author h-card within an h-entry to indicate its author. For example, from the Microformats h-entry wiki page:

<article class="h-entry">
  <h1 class="p-name">Microformats are amazing</h1>
  <p>Published by <a class="p-author h-card" href="http://example.com">W. Developer</a>
     on <time class="dt-published" datetime="2013-06-13 12:00:00">13<sup>th</sup> June 2013</time></p>

  <p class="p-summary">In which I extoll the virtues of using microformats.</p>

  <div class="e-content">
    <p>Blah blah blah</p>
  </div>
</article>

I guess this would require adding to the _parse_hcard() method, so that if the item is an h-card, to look for an author item within it (or more than one?) and see if it has an 'h-card'?

I guess any author h-card should take precedence over an h-card at the same level as the h-entry...?

It all gets a bit complicated!