Cairo doesn't add links on empty pages, so we need to draw something on each
page in tests. This bug shouldn't happen with real life documents.
This issue appeared while fixing #780. Before that, empty pages were not empty
as they had at least an empty SVG drawn on the background.
See https://gitlab.freedesktop.org/cairo/cairo/issues/357
There's a limitation / bug in cairo: we can't add links to pages that have not
been created yet. We have to use named destinations instead as they work even
if the destination has not been created.
This change offers the advantage of advertising targets: generated PDF files
now embed the list of named targets (even if I don't know if PDF readers have a
UI for that feature).
Fix#678.
pdfrw is a great piece of software, but we don't know PDF enough to debug the
problems we've met. It's safer to use the new cairo API and get back to manual
edition for attachments and bleed boxes.
We only have two regressions for now:
- some internal links are broken,
- PDF producer is not overwritten.
A mail has been sent to cairo's mailing-list about that:
https://lists.cairographics.org/archives/cairo/2018-August/028694.htmlFix#639, #615, fix#596, fix#565.
Fix#437.
Backward-incompatible change: the signature of weasyprint.urls.url_join has
changed to allow relative links without a base URI.
This feature doesn't look really safe at first sight, but I can't find
anything bad coming from these changes. If there's a bug, I take the blame.
- Put line breaks after operators (that's OK)
- Don't assign lambdas, use functions (well, that's really explicit in
PEP8, it's really verbose but why not)
- Put imports at the beginning of the file (only special cases for us)
This patch honors the filename key of a fetched resource, which can be set by
the `Content-Disposition` or `Content-Type` headers and uses
`mimetypes.guess_extension` for resources that lack any indication of a
filename.