Authored-By: Codex (GPT-5) <noreply@openai.com>
This commit is contained in:
@@ -42,7 +42,8 @@ elif ! RENDERED_BODY=$(printf '%s' "${BODY}" |
|
||||
fi
|
||||
|
||||
# A collapsed disclosure is valid supporting content, but provenance inside one
|
||||
# is not visible by default. Remove details subtrees before locating sections.
|
||||
# is not visible by default. Remove only collapsed details subtrees; an open
|
||||
# disclosure remains visible unless one of its ancestors is collapsed.
|
||||
VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
|
||||
awk '
|
||||
{
|
||||
@@ -53,11 +54,18 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
|
||||
tag=tag char
|
||||
if (char == ">") {
|
||||
lower=tolower(tag)
|
||||
if (lower ~ /^<details([[:space:]>])/) details_depth++
|
||||
else if (lower ~ /^<\/details([[:space:]>])/) {
|
||||
if (details_depth > 0) details_depth--
|
||||
if (lower ~ /^<details([[:space:]>])/) {
|
||||
parent_hidden=(details_depth > 0 && hidden[details_depth])
|
||||
details_depth++
|
||||
hidden[details_depth]=(parent_hidden || lower !~ /[[:space:]]open([[:space:]=>]|$)/)
|
||||
}
|
||||
else if (details_depth == 0) printf "%s", tag
|
||||
else if (lower ~ /^<\/details([[:space:]>])/) {
|
||||
if (details_depth > 0) {
|
||||
delete hidden[details_depth]
|
||||
details_depth--
|
||||
}
|
||||
}
|
||||
else if (!hidden[details_depth]) printf "%s", tag
|
||||
in_tag=0
|
||||
tag=""
|
||||
}
|
||||
@@ -66,7 +74,7 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
|
||||
in_tag=1
|
||||
tag=char
|
||||
}
|
||||
else if (details_depth == 0) printf "%s", char
|
||||
else if (!hidden[details_depth]) printf "%s", char
|
||||
}
|
||||
}
|
||||
')
|
||||
|
||||
Reference in New Issue
Block a user