bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Patch for understanding srcset= on img tags.


From: Giuseppe Scrivano
Subject: Re: [Bug-wget] Patch for understanding srcset= on img tags.
Date: Tue, 01 Mar 2016 14:35:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi Maksim,

Maksim Orlovich <address@hidden> writes:

> Hi... wget currently doesn't understand HTML5's srcset= attribute on
> images. The attached adds support for it.
> This is under Google copyright, so should be covered by the company's
> copyright assignment with the FSF.
>
> If you might be interested in incorporating this in some form, please
> let me know if you want any changes (e.g. tests, etc.), ---
> not really familiar with how you folks do things.
>
> Hoping this may be of some use to someone else,
> Maks

thanks for your patch!  I have some comments.  Please amend this:

diff --git a/src/html-url.c b/src/html-url.c
index dff8d57..2f205c7 100644
--- a/src/html-url.c
+++ b/src/html-url.c
@@ -692,8 +692,8 @@ tag_handle_img (int tagid, struct taginfo *tag, struct 
map_context *ctx) {
   if (srcset)
     {
       /* These are relative to the input text. */
-      int base_ind = ATTR_POS(tag,attrind,ctx);
-      int size = strlen(srcset);
+      int base_ind = ATTR_POS (tag, attrind, ctx);
+      int size = strlen (srcset);
 
       /* These are relative to srcset. */
       int offset, url_start, url_end;


> +          /* If the URL wasn't terminated by a , there may also be a 
> descriptor
> +             which we just skip. */
> +          if (has_descriptor)
> +            {
> +              /* This is comma-terminated, except there may be one level of
> +                 parentheses escaping that. */
> +              bool in_paren = false;
> +              for (offset = url_end; offset < size; ++offset)
> +                {
> +                  char c = srcset[offset];
> +                  if (c == '(')
> +                    in_paren = true;
> +                  else if (c == '(' && in_paren)
> +                    in_paren = false;

should the condition be (c == ')' && in_paren)  ?


Thanks,
Giuseppe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]