Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

srcset values with multiple paths only relativizes the first #889

Closed
myShoggoth opened this issue Oct 7, 2021 · 1 comment · Fixed by #891
Closed

srcset values with multiple paths only relativizes the first #889

myShoggoth opened this issue Oct 7, 2021 · 1 comment · Fixed by #891
Assignees
Labels

Comments

@myShoggoth
Copy link

For an example, the haskellfoundation/haskellfoundation.github.io@50e7310 commit for the Haskell Foundation website has the donors list at the bottom. The ones that use the srcset attribute only have the first path relativized, for example:

<img alt="Obsidian Systems" src="./assets/images/sponsors/obsidian-systems/obsidian-systems-683.png" srcset="./assets/images/sponsors/obsidian-systems/obsidian-systems-200.png 200w, /assets/images/sponsors/obsidian-systems/obsidian-systems-400.png 400w, /assets/images/sponsors/obsidian-systems/obsidian-systems-683.png 683w">

in our case this is okay for the deployed site, since the absolute path is correct in that case, but it would not be so if we wanted to deploy branch builds to a subdirectory, and it looks bad locally opening files in the browser.

@Minoru Minoru self-assigned this Oct 7, 2021
Minoru added a commit to Minoru/hakyll that referenced this issue Oct 9, 2021
We used to assume that `srcset` is just like `src`, and contains only
one URL. As the name of the attribute might suggest, this assumption is
wrong.

The attribute's value has a somewhat-complex grammar, with optional
fields and different separators, so I implemented a Parsec parser for
(the most of) it. The parser expects URLs to be a contiguous string of
anything but space or comma (`srcset`'s separators); I hope it will be
sufficient.

This also adds tests for the affected functions, and documentation for
`getUrls`.

Fixes jaspervdj#889.
@Minoru Minoru added the bug label Oct 9, 2021
@Minoru
Copy link
Collaborator

Minoru commented Oct 10, 2021

Thanks for the report! #891 ought to fix it; if you have a moment to test or even review it, that'd be great!

Minoru added a commit that referenced this issue Oct 11, 2021
We used to assume that `srcset` is just like `src`, and contains only
one URL. As the name of the attribute might suggest, this assumption is
wrong.

The attribute's value has a somewhat-complex grammar, with optional
fields and different separators, so I implemented a Parsec parser for
(the most of) it. The parser expects URLs to be a contiguous string of
anything but space or comma (`srcset`'s separators); I hope it will be
sufficient.

This also adds tests for the affected functions, and documentation for
`getUrls`.

Fixes #889.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants