-
Notifications
You must be signed in to change notification settings - Fork 865
img_unautop is greedy #95
Comments
Yeah, By the way, I think |
@swinggraphics Hm. Interesting. Thanks for reporting the error. Let me know if you figure out a solution. |
we also had to take it out because it removes all css classes from images inside the_content(). |
The best is to keep the wrap in that function out, then the function is really only doing what the name says and it keeps it simple. function img_unautop($pee) {
$pee = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '$1', $pee);
return $pee;
} Additionally I'd remove the regex-part perhaps for removing the p around linked images as links are inline-elements that should be wrapped usually. function img_unautop($pee) {
$pee = preg_replace('/<p>\\s*?(<img.*?>)?\\s*<\\/p>/s', '$1', $pee);
return $pee;
} |
The img_unautop function was removed in bcd2505#diff-1565ad18be73929a637f7cc08011590cL198 |
Had to comment out the
img_unautop
function in cleanup.php because it adds figure tags inappropriately, replacing a<p>
tag with<figure>
that is nowhere near an img, then closing it somewhere far down the page. My brain is too foggy to troubleshoot the regex right now, but I'll post again if I figure it out.The text was updated successfully, but these errors were encountered: