Make the second pcrs job of the img-reorder filter greedy again
authorFabian Keil <fk@fabiankeil.de>
Sat, 20 Feb 2021 04:30:08 +0000 (05:30 +0100)
committerFabian Keil <fk@fabiankeil.de>
Sun, 21 Feb 2021 15:09:20 +0000 (16:09 +0100)
The ungreedy version caused breakage like:
-<img width=888 height=573 src=socket.png>
+<img src=s width=888 height=573ocket.png>
on http://bulk.fefe.de/scalability/.

default.filter

index 72c7dcd..e19f6cf 100644 (file)
@@ -218,7 +218,7 @@ FILTER: img-reorder Reorder attributes in <img> tags to make the banners-by-* fi
 # and banners-by-link to preserve the original image URL in the title attribute.
 
 s|<img\s+?([^>]*)\ssrc\s*=\s*(['"])([^>'" ]+)\2|<img src=$2$3$2 $1|siUg
-s|<img\s+?([^>]*)\ssrc\s*=\s*([^'">\\\s]+)|<img src=$2 $1|siUg
+s|<img\s+?([^>]*)\ssrc\s*=\s*([^'">\\\s]+)|<img src=$2 $1|sig
 s|(<img[^>]+height)\s*=\s*|$1=|siUg
 
 s|<img (src=(?:(['"])[^>'" ]*\2\|[^'">\\\s]+?))([^>]*)\s+width\s*=\s*((["']?)\d+?\5)(?=[\s>])|<img $1 width=$4$3|siUg