Exclude hidden media fallback provenance
test / test (pull_request) Successful in 8s

Authored-By: Codex (GPT-5) <noreply@openai.com>
This commit is contained in:
2026-08-27 18:01:03 +00:00
parent 29c34f1527
commit cb30e5d7a6
3 changed files with 19 additions and 4 deletions
+9 -4
View File
@@ -43,7 +43,8 @@ fi
# A collapsed disclosure is valid supporting content, but provenance inside one
# is not visible by default. Remove only collapsed details subtrees; an open
# disclosure remains visible unless one of its ancestors is collapsed.
# disclosure remains visible unless one of its ancestors is collapsed. Media
# fallback subtrees are likewise hidden when the browser supports the element.
VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
awk '
{
@@ -54,7 +55,11 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
tag=tag char
if (char == ">") {
lower=tolower(tag)
if (lower ~ /^<details([[:space:]>])/) {
if (lower ~ /^<(video|audio)([[:space:]>])/) media_depth++
else if (lower ~ /^<\/(video|audio)([[:space:]>])/) {
if (media_depth > 0) media_depth--
}
else if (lower ~ /^<details([[:space:]>])/) {
attributes=lower
gsub(/"[^"]*"/, "", attributes)
parent_hidden=(details_depth > 0 && hidden[details_depth])
@@ -67,7 +72,7 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
details_depth--
}
}
else if (!hidden[details_depth]) printf "%s", tag
else if (!hidden[details_depth] && media_depth == 0) printf "%s", tag
in_tag=0
tag=""
}
@@ -76,7 +81,7 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
in_tag=1
tag=char
}
else if (!hidden[details_depth]) printf "%s", char
else if (!hidden[details_depth] && media_depth == 0) printf "%s", char
}
}
')