1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Merge pull request #1 from aelmahmoudy/source_element

Add rendering for html source element
This commit is contained in:
rkd77 2017-11-22 11:38:57 +01:00 committed by GitHub
commit ef8a3ccddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 0 deletions

View File

@ -358,6 +358,39 @@ html_img(struct html_context *html_context, unsigned char *a,
html_img_do(a, NULL, html_context);
}
void
html_source(struct html_context *html_context, unsigned char *a,
unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
{
unsigned char *src, *title;
struct document_options *options = html_context->options;
int display_style = options->image_link.display_style;
src = get_url_val(a, "src", html_context->doc_cp);
if (!src) return;
title = get_attr_val(a, "title", html_context->doc_cp);
if (!title || !*title) {
if (display_style == 3) {
mem_free_if(title);
title = get_image_filename_from_src(options->image_link.filename_maxlen, src);
}
}
html_focusable(html_context, a);
if (title && *title) {
put_link_line("Source: ", title, src,
html_context->options->framename, html_context);
} else {
put_link_line("", "Source", src,
html_context->options->framename, html_context);
}
mem_free_if(title);
mem_free(src);
}
/* prefix can have entities in it, but linkname cannot. */
void
put_link_line(unsigned char *prefix, unsigned char *linkname,

View File

@ -14,6 +14,7 @@ element_handler_T html_iframe;
element_handler_T html_img;
element_handler_T html_link;
element_handler_T html_object;
element_handler_T html_source;
element_handler_T html_audio;
element_handler_T html_video;
element_handler_T html_embed;

View File

@ -482,6 +482,7 @@ static struct element_info elements[] = {
{"S", html_underline, NULL, 0, ET_NESTABLE },
{"SCRIPT", html_script, NULL, 0, ET_NESTABLE },
{"SELECT", html_select, NULL, 0, ET_NESTABLE },
{"SOURCE", html_source, NULL, 1, ET_NON_PAIRABLE},
{"SPAN", html_span, NULL, 0, ET_NESTABLE },
{"STRIKE", html_underline, NULL, 0, ET_NESTABLE },
{"STRONG", html_bold, NULL, 0, ET_NESTABLE },