/* General element handlers */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifndef _GNU_SOURCE #define _GNU_SOURCE /* strcasestr() */ #endif #include #include #include #include #include "elinks.h" #include "config/options.h" #include "document/css/apply.h" #include "document/document.h" #include "document/html/frames.h" #include "document/html/parser/general.h" #include "document/html/parser/link.h" #include "document/html/parser/stack.h" #include "document/html/parser/parse.h" #include "document/html/parser.h" #include "document/html/renderer.h" #include "document/html/tables.h" #include "document/options.h" #include "ecmascript/ecmascript.h" #include "intl/charsets.h" #include "protocol/uri.h" #include "terminal/draw.h" #include "util/align.h" #include "util/box.h" #include "util/color.h" #include "util/conv.h" #include "util/error.h" #include "util/memdebug.h" #include "util/memory.h" #include "util/string.h" #include "viewer/text/vs.h" /* Unsafe macros */ #include "document/html/internal.h" void html_span(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { } void html_bold(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { format.style.attr |= AT_BOLD; } void html_italic(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { format.style.attr |= AT_ITALIC; } void html_underline(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { format.style.attr |= AT_UNDERLINE; } void html_fixed(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { format.style.attr |= AT_FIXED; } void html_subscript(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { format.style.attr |= AT_SUBSCRIPT | AT_UPDATE_SUB; } void html_superscript(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { format.style.attr |= AT_SUPERSCRIPT | AT_UPDATE_SUP; } void html_font(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { unsigned char *al = get_attr_val(a, "size", html_context->options); if (al) { int p = 0; unsigned s; unsigned char *nn = al; unsigned char *end; if (*al == '+') p = 1, nn++; else if (*al == '-') p = -1, nn++; errno = 0; s = strtoul(nn, (char **) &end, 10); if (!errno && *nn && !*end) { if (s > 7) s = 7; if (!p) format.fontsize = s; else format.fontsize += p * s; if (format.fontsize < 1) format.fontsize = 1; else if (format.fontsize > 7) format.fontsize = 7; } mem_free(al); } get_color(html_context, a, "color", &format.style.fg); } void html_body(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { get_color(html_context, a, "text", &format.style.fg); get_color(html_context, a, "link", &format.clink); get_color(html_context, a, "vlink", &format.vlink); if (get_bgcolor(html_context, a, &format.style.bg) != -1) html_context->was_body_background = 1; html_context->was_body = 1; /* this will be used by "meta inside body" */ html_apply_canvas_bgcolor(html_context); } void html_apply_canvas_bgcolor(struct html_context *html_context) { #ifdef CONFIG_CSS /* If there are any CSS twaks regarding bgcolor, make sure we will get * it _and_ prefer it over bgcolor attribute. */ if (html_context->options->css_enable) css_apply(html_context, html_top, &html_context->css_styles, &html_context->stack); #endif if (par_format.bgcolor != format.style.bg) { /* Modify the root HTML element - format_html_part() will take * this from there. */ struct html_element *e = html_bottom; html_context->was_body_background = 1; e->parattr.bgcolor = e->attr.style.bg = par_format.bgcolor = format.style.bg; } if (html_context->has_link_lines && par_format.bgcolor != html_context->options->default_bg && !search_html_stack(html_context, "BODY")) { html_context->special_f(html_context, SP_COLOR_LINK_LINES); } } void html_script(struct html_context *html_context, unsigned char *a, unsigned char *html, unsigned char *eof, unsigned char **end) { #ifdef CONFIG_ECMASCRIPT /* TODO: