Releases: microformats/php-mf2
v0.5.0
Breaking changes:
- Bumped minimum PHP version from 5.4 to 5.6 (#220)
- #214 parse an img element for src and alt — i.e. all property values parsed as image URLs where the img element has an
alt
attribute will now be a{'value': 'url', 'alt': 'the alt value'}
structure rather than a single URL string - Renamed
master
branch tomain
. Anyone who had been installing the latest development version withdev-master
will need to change their requirements todev-main
Other changes:
0.4.6
Bugfixes:
- Don't include img src attribute in implied p-name (#180)
- Normalize ordinal dates in VCP values (#167)
- Fix for accidental array access of stdClass in deeply nested structures (#196)
- Reduce instances where u-url is implied according to a spec update (#183 and parsing issue #36)
- Fix for wrongly implied photo property (#190)
Other Updates:
Bugfix
Whitespace Updates and Bugfixes
Bugfixes:
- Ensure empty
properties
is an object{}
rather than array[]
(#171) - Ensure the parser does not mutate the DOMDOcument passed in (#174)
- Fix for multiple class names in backcompat parsing (#156)
Microformats Parsing Updates:
- New algorithm for plaintext values (#168 and parsing issue #15)
- Always resolve URLs from
u-
properties even when not from a link element (Parsing issue #10)
Other Updates:
- Improved test coverage
Optional HTML5 Support
This release includes support for using an alternative HTML parser that understands HTML5 tags.
The built-in HTML parser does not understand some HTML5 tags such as <article>
, which causes issues when those tags are adjacent to elements that can be automatically closed, such as <p>
. A simple example that is incorrectly parsed with a non-HTML5 parser is below.
<div class="h-entry">
<p class="p-name">Hello World
<article class="e-content">The content of the blog post</article>
</div>
Without proper knowledge of HTML5 tags such as <article>
, the contents of that tag ends up inside the p-name
in this example. Using an HTML5 parser will properly close the <p>
tag and return the expected result.
The php-mf2
library does not automatically install the HTML5 parser, since it does not want to impose additional dependencies on your code base. If you wish to use the HTML5 parser, you can include it in your project explicitly, either by loading it manually or using composer:
composer require masterminds/html5
If this library is present, then the php-mf2
parser will use it when parsing HTML.
Bugfixes
Fixes:
- #165 - Prevents inadvertently adding whitespace to the html value
- #158 - Allows numbers in vendor prefixed names
- #160 - Ignores class names with consecutive dashes
- #159 - Remove duplicate values from type and rels arrays
- #162 - Improved rel attribute parsing
Backcompat:
- #157 - Parse
rel=tag
asp-category
for hEntry and hReview
Bugfixes
Improved implied name parsing, bugfixes, and improved backcompat parsing
Breaking changes
- #125 - Add
rel-urls
to parsed result. Removesalternates
by default but still available behind a feature flag. - #142 - Reduce instances of implied
p-name
. See Microformats issue #6. This means it is now possible for the parsed result to not have aname
property, whereas before there was always aname
property on an object. Make sure consuming code can handle an object without a name now.
Fixes
- #124 - Fix for experimental lang parsing
- #127 - Fix for parsing
h-*
class names containing invalid characters. - #131 - Improved
dt-
parsing. Issues #126 and #115. - #130 - Fix for implied properties with empty attributes.
- #135 - Trim leading and tailing whitespace from HTML value as well as text value.
- #137 - Fix backcompat hfeed parsing.
- #134 - Fix
rel=bookmark
backcompat parsing. - #116 - Fix backcompat parsing for
summary
property inhreview
- #149 - Fix for datetime parsing, no longer tries to interpret the value and passes through instead
Thanks to @gRegorLove and @jkphl for all their hard work in this release!
Bugfixes, improved backcompat parsing, and experimental language parsing
This release includes the following fixes:
- #89 - Fixed parsing empty
img alt=""
attributes - #91 - Ignore rel values from HTML tags that don't allow rel values
- #57 - Implement hAtom rel=bookmark backcompat
- #94 - Fixed HTML output when parsing e-* properties
- #88 - Fix for implied photo parsing
- #102 - Ignore classes with numbers or capital letters
- #111 - Improved backcompat parsing
- #106 - Send
Accept: text/html
header when using thefetch
method - #114 - Parse
poster
attribute forvideo
tags - #118 - Fixes parsing elements with missing attributes
- #97 - Experimental language parsing
- #121 - Fixed language detection to support HTML fragments
- #123 - Moved language parsing behind feature flag
- Tests now use microformats/tests repo
Bugfixes and improved backcompat parsing
This release contained an error in the composer.json
file causing installations via composer to fail. Release notes have been moved to v0.3.2