2.9.1 收紧画廊区块识别:class 属性不在首位也能认

This commit is contained in:
XIGE
2026-12-03 22:21:29 +08:00
parent d10b16a425
commit c183c35c6d
2 changed files with 4 additions and 3 deletions

View File

@@ -23,7 +23,7 @@
## 2026-12-03 · 2.9.1 —— EXIF 显示与画廊 / 正文结构兼容
- `{flex}` 画廊整块跳过:同时识别 `{flex ...}...{/flex}` 与已渲染的 `<div class="flexphoto ...">`,两种激活顺序都不再往里注入包裹层
- `{flex}` 画廊整块跳过:同时识别 `{flex ...}...{/flex}` 与已渲染的 `<div class="flexphoto ...">`,两种激活顺序都不再往里注入包裹层(`class` 属性不在首位也能认出)
- EXIF 包裹层 `div` → `span`(容器、浮层、浮层内两行),消除 `<p><div>` 非法嵌套导致的空段落空隙;容器补 `line-height:0;vertical-align:top`
- `findExif` 改「`limit(20)` 多候选 + PHP 按 path 精确比对」:此前 `text LIKE '%path%'` 的 `_`/`%` 通配符可能先命中无关行,`limit(1)` 下直接静默丢 EXIF
- `catch` 补 `Throwable`,PHP 8 下 `Error` 不再让正文 500

View File

@@ -1488,7 +1488,7 @@ CSS;
// FlexPhoto 的横排样式按「figure 是 .flexphoto 的直接子项」写死,
// 中间插一层包裹元素会把 figure 顶到孙级,多图横排必坏,宁可不显示 EXIF。
$parts = preg_split(
'/(\{flex[^}]*\}.*?\{\/flex\}|<div\s+class="[^"]*flexphoto[^"]*"[^>]*>.*?<\/div>)/is',
'/(\{flex[^}]*\}.*?\{\/flex\}|<div\b(?=[^>]*\bclass="[^"]*flexphoto)[^>]*>.*?<\/div>)/is',
$content,
-1,
PREG_SPLIT_DELIM_CAPTURE
@@ -1499,7 +1499,8 @@ CSS;
}
foreach ($parts as $index => $part) {
if ('' === $part || preg_match('/^(?:\{flex[^}]*\}|<div\s+class="[^"]*flexphoto)/i', $part)) {
if ('' === $part
|| preg_match('/^(?:\{flex[^}]*\}|<div\b(?=[^>]*\bclass="[^"]*flexphoto))/i', $part)) {
continue;
}