Blog Archive for June, 2017

Improving the php-mf2 parser

During the past year, the popular php-mf2 microformats parser has received quite a few improvements. My site runs ProcessWire and one of the plugins for it uses php-mf2, so I have been spending some time on it.

My own experience with microformats started when I discovered the hCard microformat. I was impressed with the novelty of adding some simple HTML classes around contact information and having a browser extension parse it into an address book. Years later, when I started to get involved in the IndieWeb community, I learned a lot more about microformats2 and they became a key building block of my personal site.

php-mf2 is now much better at backwards-compatible parsing of microformats1. This is important because software should be able to consistently consume content whether it’s marked up with microformats1, microformats2, or a combination. An experimental feature for parsing language attributes has also been added. Finally, it’s now using the microformats test suite. Several other parsers use this test suite as well. This will make it easier to catch bugs and improve all of the different parsers.

php-mf2 is a stable library that’s ready to be installed in your software to start consuming microformats. It is currently used in Known, WordPress plugins, and ProcessWire plugins for richer social interactions. It’s also used in tools like XRay and microformats.io. I’m looking forward to more improvements to php-mf2 in the coming year as well as more software using it!

Original published at: https://gregorlove.com/2017/06/improving-the-php-mf2-parser/

Evolving for 12 Years

For the 12th birthday of microformats.org (congratulations!) Tantek asked the community if any of us would like to highlight whatever we liked in a guest post. I am taking this opportunity to talk about my favourite feature of microformats: its constant evolvement.

Sometimes it feels like a standard is done. Sometimes it feels like a standard is abandoned before its time. In a few special cases a standard keeps evolving. I think we can agree that microformats goes in the latter category. This is hugely thanks to the fact that anyone can help it grow.

As you read this, work is being done to upgrade h-event from a Draft to a full Specification. This prompted a few of us to have a look at what people are doing with the format. As it turns out: it has departed from the Draft!

The IndieWeb community is putting events in their feeds, interleaving them with other items (like blog posts) that use h-entry. To make the events fit within this context properties are being copied over from h-entry, properties completely new to h-event. Somehow these separate implementations introduced the same properties, showing how h-event is evolving quicker than its Draft Specification without splintering it in lots of different versions. Naturally evolving the format forwards!

Then there are the small, fringe changes. Work on pronouns in h-cards has been mostly dormant since 2015. I spent time with it during IndieWebCamp Nuremberg and came to a completely different conclusion on how to mark-up my pronouns. The beauty there is that anyone can do the same! All it takes is to put something on your site, like the IndieWeb community did with h-event, and tell the world about this piece of extra information they now have access to.

Here is to one more year of constantly tinkering with our HTML and giving more meaning to the information we publish 🥂