Skip to content

Commit

Permalink
Improved handling of img elements
Browse files Browse the repository at this point in the history
  • Loading branch information
splorp committed Jan 11, 2023
1 parent f59c8b9 commit d016e67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ return [

## Release Notes

### 2.0.6
+ Improved handling of pages containing `<img>` elements

### 2.0.5
+ Added option to specify inclusion of the datestamp

Expand Down
2 changes: 1 addition & 1 deletion snippets/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Remove line breaks following <br> tags
$buffer = str_replace(array("<br>" . PHP_EOL . PHP_EOL, "<br />" . PHP_EOL . PHP_EOL), PHP_EOL, $buffer);
// Remove line breaks preceeding <img> tags
$buffer = preg_replace('/\n\n<p><img .+><\/p>/', '', $buffer);
$buffer = preg_replace('/\n\n(<p>)?<img .+>(<\/p>)?/', '', $buffer);
// Remove all remaining tags
$buffer = html_entity_decode(strip_tags($buffer));
echo $buffer . PHP_EOL . PHP_EOL;
Expand Down

0 comments on commit d016e67

Please sign in to comment.