Package: elinks
Version: 0.12~pre6-4
Severity: normal
Tags: patch

Dear Maintainer,

HTML5 has a source element, to provide content for audio and video elements.

Elinks currently ignores it. With my patch though, it looks nice, like this:
<http://daten.dieweltistgarnichtso.net/pics/screenshots/web/elinks-source-element.png>

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.13-1-686-pae (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages elinks depends on:
ii  elinks-data       0.12~pre6-4
ii  libbz2-1.0        1.0.6-5
ii  libc6             2.18-5
ii  libcomerr2        1.42.9-3
ii  libexpat1         2.1.0-4
ii  libfsplib0        0.11-2
ii  libgnutls26       2.12.23-15
ii  libgpm2           1.20.4-6.1
ii  libgssapi-krb5-2  1.12.1+dfsg-1
ii  libidn11          1.28-2
ii  libk5crypto3      1.12.1+dfsg-1
ii  libkrb5-3         1.12.1+dfsg-1
ii  libperl5.18       5.18.2-3
ii  libtre5           0.8.0-4
ii  zlib1g            1:1.2.8.dfsg-1

elinks recommends no packages.

Versions of packages elinks suggests:
pn  elinks-doc  <none>

-- no debconf information
>From 028caca7954e58ea6d15e0f27a6bace73f6f03f0 Mon Sep 17 00:00:00 2001
From: Nils Dagsson Moskopp <n...@dieweltistgarnichtso.net>
Date: Sun, 10 Aug 2014 02:10:16 +0200
Subject: [PATCH] + rendering for html source element

---
 src/document/html/parser/link.c  | 31 +++++++++++++++++++++++++++++++
 src/document/html/parser/link.h  |  1 +
 src/document/html/parser/parse.c |  1 +
 3 files changed, 33 insertions(+)

diff --git a/src/document/html/parser/link.c b/src/document/html/parser/link.c
index b1816cd..4ecc426 100644
--- a/src/document/html/parser/link.c
+++ b/src/document/html/parser/link.c
@@ -356,6 +356,37 @@ 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)
+			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,
diff --git a/src/document/html/parser/link.h b/src/document/html/parser/link.h
index 5b4d720..4f9990c 100644
--- a/src/document/html/parser/link.h
+++ b/src/document/html/parser/link.h
@@ -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_embed;
 
 #endif
diff --git a/src/document/html/parser/parse.c b/src/document/html/parser/parse.c
index 87d3b59..d461f4c 100644
--- a/src/document/html/parser/parse.c
+++ b/src/document/html/parser/parse.c
@@ -479,6 +479,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    },
-- 
2.0.0.rc2

Reply via email to