Authored-By: Codex (GPT-5) <noreply@openai.com>
This commit is contained in:
@@ -16,29 +16,72 @@ HEAD="${HEAD_SHA:-}"
|
||||
VISIBLE_BODY=$(printf '%s\n' "${BODY}" | awk '
|
||||
{
|
||||
line=$0
|
||||
while (line != "") {
|
||||
fence_pos=1
|
||||
while (fence_pos <= 4 && substr(line, fence_pos, 1) == " ") fence_pos++
|
||||
fence_char=substr(line, fence_pos, 1)
|
||||
fence_run=0
|
||||
if (fence_char == "`" || fence_char == "~") {
|
||||
while (substr(line, fence_pos + fence_run, 1) == fence_char) fence_run++
|
||||
}
|
||||
if (in_fence) {
|
||||
print line
|
||||
if (fence_char == active_fence_char && fence_run >= active_fence_run) in_fence=0
|
||||
next
|
||||
}
|
||||
if (fence_run >= 3) {
|
||||
in_fence=1
|
||||
active_fence_char=fence_char
|
||||
active_fence_run=fence_run
|
||||
print line
|
||||
next
|
||||
}
|
||||
|
||||
visible=""
|
||||
pos=1
|
||||
while (pos <= length(line)) {
|
||||
if (in_comment) {
|
||||
end=index(line, "-->")
|
||||
if (end == 0) {
|
||||
line=""
|
||||
rest=substr(line, pos)
|
||||
comment_end=index(rest, "-->")
|
||||
if (comment_end == 0) {
|
||||
pos=length(line) + 1
|
||||
break
|
||||
}
|
||||
line=substr(line, end + 3)
|
||||
visible=visible " "
|
||||
pos += comment_end + 2
|
||||
in_comment=0
|
||||
continue
|
||||
}
|
||||
start=index(line, "<!--")
|
||||
if (start == 0) break
|
||||
before=substr(line, 1, start - 1)
|
||||
rest=substr(line, start + 4)
|
||||
end=index(rest, "-->")
|
||||
if (end == 0) {
|
||||
line=before
|
||||
|
||||
if (substr(line, pos, 1) == "`") {
|
||||
ticks=1
|
||||
while (substr(line, pos + ticks, 1) == "`") ticks++
|
||||
close_pos=pos + ticks
|
||||
found_close=0
|
||||
while (close_pos <= length(line)) {
|
||||
if (substr(line, close_pos, ticks) == substr(line, pos, ticks) &&
|
||||
substr(line, close_pos + ticks, 1) != "`") {
|
||||
found_close=1
|
||||
break
|
||||
}
|
||||
close_pos++
|
||||
}
|
||||
if (found_close) {
|
||||
visible=visible substr(line, pos, close_pos + ticks - pos)
|
||||
pos=close_pos + ticks
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (substr(line, pos, 4) == "<!--") {
|
||||
visible=visible " "
|
||||
in_comment=1
|
||||
break
|
||||
pos += 4
|
||||
continue
|
||||
}
|
||||
line=before substr(rest, end + 3)
|
||||
visible=visible substr(line, pos, 1)
|
||||
pos++
|
||||
}
|
||||
print line
|
||||
print visible
|
||||
}
|
||||
')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user