fix: inline html
This commit is contained in:
@@ -22,7 +22,7 @@ function mask_plain(s, t) {
|
||||
gsub(/\$/, "\034P8\034", t)
|
||||
return t
|
||||
}
|
||||
BEGIN { in_plain = 0 }
|
||||
BEGIN { in_plain = 0; in_script_style = 0 }
|
||||
{
|
||||
line = $0
|
||||
out = ""
|
||||
@@ -48,5 +48,41 @@ BEGIN { in_plain = 0 }
|
||||
in_plain = 0
|
||||
}
|
||||
}
|
||||
print out
|
||||
tmp_line = out
|
||||
out2 = ""
|
||||
while (1) {
|
||||
if (!in_script_style) {
|
||||
pos_script = match(tolower(tmp_line), /<script([ >]|$)/)
|
||||
script_start = RSTART; script_len = RLENGTH
|
||||
pos_style = match(tolower(tmp_line), /<style([ >]|$)/)
|
||||
style_start = RSTART; style_len = RLENGTH
|
||||
|
||||
if (pos_script == 0 && pos_style == 0) {
|
||||
out2 = out2 tmp_line
|
||||
break
|
||||
}
|
||||
if (pos_script > 0 && (pos_style == 0 || pos_script < pos_style)) {
|
||||
out2 = out2 substr(tmp_line, 1, script_start + script_len - 1)
|
||||
tmp_line = substr(tmp_line, script_start + script_len)
|
||||
in_script_style = 1
|
||||
end_tag = "</script>"
|
||||
} else {
|
||||
out2 = out2 substr(tmp_line, 1, style_start + style_len - 1)
|
||||
tmp_line = substr(tmp_line, style_start + style_len)
|
||||
in_script_style = 1
|
||||
end_tag = "</style>"
|
||||
}
|
||||
} else {
|
||||
pos_end = match(tolower(tmp_line), end_tag)
|
||||
if (pos_end == 0) {
|
||||
out2 = out2 mask_plain(tmp_line)
|
||||
tmp_line = ""
|
||||
break
|
||||
}
|
||||
out2 = out2 mask_plain(substr(tmp_line, 1, RSTART - 1)) substr(tmp_line, RSTART, RLENGTH)
|
||||
tmp_line = substr(tmp_line, RSTART + RLENGTH)
|
||||
in_script_style = 0
|
||||
}
|
||||
}
|
||||
print out2
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ BEGIN {
|
||||
}
|
||||
|
||||
{
|
||||
if ($0 ~ /^<pre>/) in_pre = 1
|
||||
if ($0 ~ /<pre>/) in_pre = 1
|
||||
|
||||
if (in_pre) {
|
||||
if (in_p) { print "</p>"; in_p = 0 }
|
||||
@@ -13,7 +13,16 @@ BEGIN {
|
||||
next
|
||||
}
|
||||
|
||||
if ($0 ~ /^<\/?(div|table|p|[ou]l|h[1-6]|[bh]r|blockquote|li|hr|section|article|nav|aside|header|footer|dl|dt|dd)/) {
|
||||
if ($0 ~ /^<\/?(div|table|p|[ou]l|h[1-6]|[bh]r|blockquote|li|hr|section|article|nav|aside|header|footer|dl|dt|dd|script|style|iframe|details|summary|figure|figcaption|audio|video|picture)/) {
|
||||
if (in_p) {
|
||||
print "</p>"
|
||||
in_p = 0
|
||||
}
|
||||
print
|
||||
next
|
||||
}
|
||||
|
||||
if ($0 ~ /^[\t ]*!([a-zA-Z])?\[[^\]]*\](\([^)]*\))?[\t ]*$/ || $0 ~ /^[\t ]*!!?\[[^\]]*\](\([^)]*\))?[\t ]*$/) {
|
||||
if (in_p) {
|
||||
print "</p>"
|
||||
in_p = 0
|
||||
|
||||
Reference in New Issue
Block a user