mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[table] skip_script
This commit is contained in:
parent
81b89946e6
commit
78543c55ee
@ -44,8 +44,9 @@ add_table_bad_html_start(struct table *table, char *start)
|
|||||||
&& !table->bad_html[table->bad_html_size - 1].end)
|
&& !table->bad_html[table->bad_html_size - 1].end)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (realloc_bad_html(&table->bad_html, table->bad_html_size))
|
if (realloc_bad_html(&table->bad_html, table->bad_html_size)) {
|
||||||
table->bad_html[table->bad_html_size++].start = start;
|
table->bad_html[table->bad_html_size++].start = start;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -538,6 +539,42 @@ skip_table(char *html, char *eof)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
skip_script(char *html, char *eof)
|
||||||
|
{
|
||||||
|
int level = 1;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
char *name;
|
||||||
|
int namelen, closing_tag = 0;
|
||||||
|
|
||||||
|
while (html < eof
|
||||||
|
&& (*html != '<'
|
||||||
|
|| parse_element(html, eof, &name, &namelen, NULL,
|
||||||
|
&html)))
|
||||||
|
html++;
|
||||||
|
|
||||||
|
if (html >= eof) return eof;
|
||||||
|
|
||||||
|
if (!namelen) continue;
|
||||||
|
|
||||||
|
if (*name == '/') {
|
||||||
|
closing_tag = 1;
|
||||||
|
name++; namelen--;
|
||||||
|
if (!namelen) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!c_strlcasecmp(name, namelen, "SCRIPT", 6)) {
|
||||||
|
if (!closing_tag) {
|
||||||
|
level++;
|
||||||
|
} else {
|
||||||
|
level--;
|
||||||
|
if (!level) return html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct table *
|
struct table *
|
||||||
parse_table(char *html, char *eof, char **end,
|
parse_table(char *html, char *eof, char **end,
|
||||||
char *attr, int sh, struct html_context *html_context)
|
char *attr, int sh, struct html_context *html_context)
|
||||||
@ -608,6 +645,11 @@ see:
|
|||||||
closing_tag = 0;
|
closing_tag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!c_strlcasecmp(name, namelen, "SCRIPT", 6)) {
|
||||||
|
en = skip_script(en, eof);
|
||||||
|
goto see;
|
||||||
|
}
|
||||||
|
|
||||||
if (!c_strlcasecmp(name, namelen, "TABLE", 5)) {
|
if (!c_strlcasecmp(name, namelen, "TABLE", 5)) {
|
||||||
if (!closing_tag) {
|
if (!closing_tag) {
|
||||||
en = skip_table(en, eof);
|
en = skip_table(en, eof);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user