From 5d9e5f70409dfcdd24fa1d513c02cb69788f904d Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Tue, 28 Jun 2022 15:57:49 +0200 Subject: [PATCH] Update and fix URLs in comments and documentation --- docs/api_reference.rst | 64 ++++++++++++------------ docs/changelog.rst | 14 +++--- docs/first_steps.rst | 34 ++++++------- docs/going_further.rst | 14 +++--- tests/draw/svg/test_bounding_box.py | 22 ++++---- tests/draw/svg/test_clip.py | 6 +-- tests/draw/svg/test_defs.py | 2 +- tests/draw/svg/test_gradients.py | 28 +++++------ tests/draw/svg/test_images.py | 24 ++++----- tests/draw/svg/test_opacity.py | 2 +- tests/draw/svg/test_paths.py | 44 ++++++++-------- tests/draw/svg/test_patterns.py | 8 +-- tests/draw/svg/test_shapes.py | 38 +++++++------- tests/draw/svg/test_text.py | 26 +++++----- tests/draw/svg/test_transform.py | 28 +++++------ tests/draw/svg/test_visibility.py | 16 +++--- tests/layout/test_block.py | 8 +-- tests/layout/test_inline.py | 6 +-- tests/layout/test_position.py | 2 +- tests/layout/test_table.py | 4 +- tests/test_acid2.py | 4 +- tests/test_api.py | 28 +++++------ tests/test_boxes.py | 8 +-- tests/test_css_descriptors.py | 34 ++++++------- tests/test_css_validation.py | 10 ++-- tests/test_pdf.py | 16 +++--- tests/testing_utils.py | 2 +- weasyprint/__init__.py | 2 +- weasyprint/css/__init__.py | 6 +-- weasyprint/css/computed_values.py | 10 ++-- weasyprint/css/html5_ua.css | 2 +- weasyprint/css/properties.py | 16 +++--- weasyprint/css/utils.py | 8 +-- weasyprint/css/validation/expanders.py | 10 ++-- weasyprint/css/validation/properties.py | 4 +- weasyprint/document.py | 4 +- weasyprint/draw.py | 6 +-- weasyprint/formatting_structure/boxes.py | 12 ++--- weasyprint/formatting_structure/build.py | 38 +++++++------- weasyprint/html.py | 24 ++++----- weasyprint/images.py | 4 +- weasyprint/layout/__init__.py | 8 +-- weasyprint/layout/absolute.py | 10 ++-- weasyprint/layout/block.py | 10 ++-- weasyprint/layout/column.py | 2 +- weasyprint/layout/float.py | 4 +- weasyprint/layout/inline.py | 14 +++--- weasyprint/layout/page.py | 20 ++++---- weasyprint/layout/preferred.py | 18 +++---- weasyprint/layout/replaced.py | 16 +++--- weasyprint/layout/table.py | 10 ++-- weasyprint/links.py | 2 +- weasyprint/pdf/pdfa.py | 10 ++-- weasyprint/stacking.py | 4 +- weasyprint/svg/css.py | 2 +- weasyprint/svg/defs.py | 2 +- weasyprint/svg/shapes.py | 2 +- weasyprint/urls.py | 4 +- 58 files changed, 388 insertions(+), 388 deletions(-) diff --git a/docs/api_reference.rst b/docs/api_reference.rst index fca50574..4166b1f1 100644 --- a/docs/api_reference.rst +++ b/docs/api_reference.rst @@ -85,7 +85,7 @@ HTTP redirects but more advanced features like cookies and authentication are currently not supported, although a custom :ref:`URL fetcher ` can help. -.. _data URIs: http://en.wikipedia.org/wiki/Data_URI_scheme +.. _data URIs: https://en.wikipedia.org/wiki/Data_URI_scheme HTML @@ -121,7 +121,7 @@ generated by WeasyPrint is missing some of the features you expect from the HTML, try to enable this option. .. _User-Agent stylesheet: https://github.com/Kozea/WeasyPrint/blob/master/weasyprint/css/html5_ua.css -.. _presentational hints: http://www.w3.org/TR/html5/rendering.html#presentational-hints +.. _presentational hints: https://www.w3.org/TR/html5/rendering.html#presentational-hints .. _Pillow: https://python-pillow.org/ Stylesheet Origins @@ -140,8 +140,8 @@ stylesheets in the cascade_, unless you use `!important`_ in declarations to raise their priority. .. _user agent stylesheet: https://github.com/Kozea/WeasyPrint/blob/master/weasyprint/css/html5_ua.css -.. _cascade: http://www.w3.org/TR/CSS21/cascade.html#cascading-order -.. _!important: http://www.w3.org/TR/CSS21/cascade.html#important-rules +.. _cascade: https://www.w3.org/TR/CSS21/cascade.html#cascading-order +.. _!important: https://www.w3.org/TR/CSS21/cascade.html#important-rules PDF @@ -222,17 +222,17 @@ The CSS 2.1 features listed here are **not** supported: * `System colors`_ and `system fonts`_. The former are deprecated in `CSS Color Module Level 3`_. -.. _CSS Level 2 Revision 1: http://www.w3.org/TR/CSS21/ -.. _Acid2 Test: http://www.webstandards.org/files/acid2/test.html -.. _::first-line: http://www.w3.org/TR/CSS21/selector.html#first-line-pseudo -.. _empty-cells: http://www.w3.org/TR/CSS21/tables.html#empty-cells -.. _visibility\: collapse: http://www.w3.org/TR/CSS21/tables.html#dynamic-effects -.. _width: http://www.w3.org/TR/CSS21/visudet.html#min-max-widths -.. _height: http://www.w3.org/TR/CSS21/visudet.html#min-max-heights -.. _font matching algorithm: http://www.w3.org/TR/CSS21/fonts.html#algorithm -.. _Bi-directional text: http://www.w3.org/TR/CSS21/visuren.html#direction -.. _System colors: http://www.w3.org/TR/CSS21/ui.html#system-colors -.. _system fonts: http://www.w3.org/TR/CSS21/fonts.html#propdef-font +.. _CSS Level 2 Revision 1: https://www.w3.org/TR/CSS21/ +.. _Acid2 Test: https://www.webstandards.org/files/acid2/test.html +.. _::first-line: https://www.w3.org/TR/CSS21/selector.html#first-line-pseudo +.. _empty-cells: https://www.w3.org/TR/CSS21/tables.html#empty-cells +.. _visibility\: collapse: https://www.w3.org/TR/CSS21/tables.html#dynamic-effects +.. _width: https://www.w3.org/TR/CSS21/visudet.html#min-max-widths +.. _height: https://www.w3.org/TR/CSS21/visudet.html#min-max-heights +.. _font matching algorithm: https://www.w3.org/TR/CSS21/fonts.html#algorithm +.. _Bi-directional text: https://www.w3.org/TR/CSS21/visuren.html#direction +.. _System colors: https://www.w3.org/TR/CSS21/ui.html#system-colors +.. _system fonts: https://www.w3.org/TR/CSS21/fonts.html#propdef-font To the best of our knowledge, everything else that applies to the print media **is** supported. Please report a bug if you find this list @@ -247,7 +247,7 @@ PDF is generally not interactive. The ``:hover``, ``:active``, ``:focus``, ``:target`` and ``:visited`` pseudo-classes are accepted as valid but never match anything. -.. _Selectors Level 3: http://www.w3.org/TR/css3-selectors/ +.. _Selectors Level 3: https://www.w3.org/TR/selectors-3/ CSS Text Module Level 3 / 4 +++++++++++++++++++++++++++ @@ -315,7 +315,7 @@ supported: .. _#1153: https://github.com/Kozea/WeasyPrint/issues/1153 .. _supported by Pyphen: https://github.com/Kozea/Pyphen/tree/master/pyphen/dictionaries -.. _hyphenation: http://www.w3.org/TR/css3-text/#hyphenation +.. _hyphenation: https://www.w3.org/TR/css-text-3/#hyphenation .. _CSS Text Module Level 3: https://www.w3.org/TR/css-text-3/ .. _CSS Text Module Level 4: https://www.w3.org/TR/css-text-4/ @@ -376,7 +376,7 @@ All the features of this draft are available, including: - the page ``size``, ``bleed`` and ``marks`` properties; - the named pages. -.. _CSS Paged Media Module Level 3: http://dev.w3.org/csswg/css3-page/ +.. _CSS Paged Media Module Level 3: https://drafts.csswg.org/css-page-3/ .. _#93: https://github.com/Kozea/WeasyPrint/issues/93 CSS Generated Content for Paged Media Module @@ -406,7 +406,7 @@ over the rendering of difficult pages with ``footnote-policy``. Page groups (``:nth(X of pagename)`` pseudo-class) are not supported. -.. _CSS Generated Content for Paged Media Module: http://www.w3.org/TR/css-gcpm-3/ +.. _CSS Generated Content for Paged Media Module: https://www.w3.org/TR/css-gcpm-3/ .. _Page selectors: https://www.w3.org/TR/css-gcpm-3/#document-page-selectors .. _running elements: https://www.w3.org/TR/css-gcpm-3/#running-elements .. _Footnotes: https://www.w3.org/TR/css-gcpm-3/#footnotes @@ -463,13 +463,13 @@ The other features of this module are **not** implemented: - quotes (``content: *-quote``); - leaders (``content: leader()``). -.. _CSS Generated Content Module Level 3: http://www.w3.org/TR/css-content-3/ +.. _CSS Generated Content Module Level 3: https://www.w3.org/TR/css-content-3/ .. _Quotes: https://www.w3.org/TR/css-content-3/#quotes .. _Named strings: https://www.w3.org/TR/css-content-3/#named-strings .. _Cross-references: https://www.w3.org/TR/css-content-3/#cross-references .. _an example: https://github.com/Kozea/WeasyPrint/pull/652#issuecomment-403276559 .. _PDF bookmarks: https://www.w3.org/TR/css-content-3/#bookmark-generation -.. _experimental: http://www.w3.org/TR/css-2010/#experimental +.. _experimental: https://www.w3.org/TR/css-2010/#experimental .. _user agent stylesheet: https://github.com/Kozea/WeasyPrint/blob/master/weasyprint/css/html5_ua.css CSS Color Module Level 3 @@ -485,7 +485,7 @@ document. This recommendation is fully implemented in WeasyPrint, except the deprecated System Colors. -.. _CSS Color Module Level 3: http://www.w3.org/TR/css3-color/ +.. _CSS Color Module Level 3: https://www.w3.org/TR/css-color-3/ CSS Transforms Module Level 1 +++++++++++++++++++++++++++++ @@ -504,7 +504,7 @@ WeasyPrint does **not** support the ``transform-style``, ``perspective``, transformations (``matrix3d``, ``rotate(3d|X|Y|Z)``, ``translate(3d|Z)``, ``scale(3d|Z)``). -.. _CSS Transforms Module Level 1: http://dev.w3.org/csswg/css3-transforms/ +.. _CSS Transforms Module Level 1: https://drafts.csswg.org/css-transforms-1/ CSS Backgrounds and Borders Module Level 3 ++++++++++++++++++++++++++++++++++++++++++ @@ -535,12 +535,12 @@ including the ``box-shadow`` property. This feature has been implemented in a `git branch`_ that is not released, as it relies on raster implementation of shadows. -.. _CSS Backgrounds and Borders Level 3: http://www.w3.org/TR/css3-background/ -.. _border part: http://www.w3.org/TR/css3-background/#borders -.. _background part: http://www.w3.org/TR/css3-background/#backgrounds -.. _rounded corners part: http://www.w3.org/TR/css3-background/#corners -.. _border images part: http://www.w3.org/TR/css3-background/#border-images -.. _box shadow part: http://www.w3.org/TR/css3-background/#misc +.. _CSS Backgrounds and Borders Level 3: https://www.w3.org/TR/css-backgrounds-3/ +.. _border part: https://www.w3.org/TR/css-backgrounds-3/#borders +.. _background part: https://www.w3.org/TR/css-backgrounds-3/#backgrounds +.. _rounded corners part: https://www.w3.org/TR/css-backgrounds-3/#corners +.. _border images part: https://www.w3.org/TR/css-backgrounds-3/#border-images +.. _box shadow part: https://www.w3.org/TR/css-backgrounds-3/#misc .. _git branch: https://github.com/Kozea/WeasyPrint/pull/149 CSS Image Values and Replaced Content Module Level 3 / 4 @@ -571,8 +571,8 @@ The ``image-rendering`` property is supported. The ``image-orientation`` property is **not** supported. -.. _Image Values and Replaced Content Module Level 3: http://www.w3.org/TR/css3-images/ -.. _Image Values and Replaced Content Module Level 4: http://www.w3.org/TR/css4-images/ +.. _Image Values and Replaced Content Module Level 3: https://www.w3.org/TR/css-images-3/ +.. _Image Values and Replaced Content Module Level 4: https://www.w3.org/TR/css-images-4/ CSS Box Sizing Module Level 3 +++++++++++++++++++++++++++++ @@ -655,7 +655,7 @@ The ``column-span`` property is supported for direct children of columns. The ``column-fill`` property is supported, with a column balancing algorithm that should be efficient with simple cases. -.. _CSS Multi-column Layout Module: https://www.w3.org/TR/css3-multicol/ +.. _CSS Multi-column Layout Module: https://www.w3.org/TR/css-multicol-1/ CSS Fragmentation Module Level 3 / 4 ++++++++++++++++++++++++++++++++++++ diff --git a/docs/changelog.rst b/docs/changelog.rst index 2f128df4..e47278e8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2229,7 +2229,7 @@ Bug fixes: Release process: * Drop Python 3.1 support. -* Set up [Travis CI](http://travis-ci.org/) +* Set up [Travis CI](https://travis-ci.org/) to automatically test all pushes and pull requests. * Start testing on Python 3.4 locally. (Travis does not support 3.4 yet.) @@ -2241,11 +2241,11 @@ Released on 2014-01-11. New features: -* Add the `overflow-wrap `_ +* Add the `overflow-wrap `_ property, allowing line breaks inside otherwise-unbreakable words. Thanks Frédérick Deslandes! * Add the `image-resolution - `_ property, + `_ property, allowing images to be sized proportionally to their intrinsic size at a resolution other than 96 image pixels per CSS ``in`` (ie. one image pixel per CSS ``px``) @@ -2516,7 +2516,7 @@ Released on 2012-07-19. WeasyPrint for fetching linked stylesheets or images, eg. to generate them on the fly without going through the network. This enables the creation of `Flask-WeasyPrint - `_. + `_. Version 0.11 @@ -2568,7 +2568,7 @@ Released on 2012-06-04. Bookmarks can be controlled by the ``-weasy-bookmark-level`` and ``-weasy-bookmark-label`` properties, as described in `CSS Generated Content -for Paged Media Module `_. +for Paged Media Module `_. The default UA stylesheet sets a matching bookmark level on all ``

`` to ``

`` elements. @@ -2588,8 +2588,8 @@ Released on 2012-05-07. * Speed improvements on big stylesheets / small documents thanks to tinycss. * Many bug fixes -.. _tinycss: http://packages.python.org/tinycss/ -.. _cssselect: http://packages.python.org/cssselect/ +.. _tinycss: https://packages.python.org/tinycss/ +.. _cssselect: https://packages.python.org/cssselect/ Version 0.7.1 diff --git a/docs/first_steps.rst b/docs/first_steps.rst index 04c43ce4..1a7e68e2 100644 --- a/docs/first_steps.rst +++ b/docs/first_steps.rst @@ -20,14 +20,14 @@ WeasyPrint |version| depends on: * Pillow_ ≥ 4.0.0 * fontTools_ ≥ 4.0.0 -.. _Python: http://www.python.org/ -.. _Pango: http://pango.gnome.org/ +.. _Python: https://www.python.org/ +.. _Pango: https://pango.gnome.org/ .. _CFFI: https://cffi.readthedocs.io/ .. _html5lib: https://html5lib.readthedocs.io/ .. _pydyf: https://doc.courtbouillon.org/pydyf/ .. _tinycss2: https://doc.courtbouillon.org/tinycss2/ .. _cssselect2: https://doc.courtbouillon.org/cssselect2/ -.. _Pyphen: http://pyphen.org/ +.. _Pyphen: https://pyphen.org/ .. _Pillow: https://python-pillow.org/ .. _fontTools: https://github.com/fonttools/fonttools @@ -307,7 +307,7 @@ Using the WeasyPrint command line interface can be as simple as this: .. code-block:: sh - weasyprint http://weasyprint.org /tmp/weasyprint-website.pdf + weasyprint https://weasyprint.org /tmp/weasyprint-website.pdf You may see warnings on the standard error output about unsupported CSS properties. See :ref:`Command-Line API` for the details of all available @@ -320,7 +320,7 @@ use the shell’s redirection instead: .. code-block:: sh - weasyprint http://weasyprint.org /tmp/weasyprint-website.pdf \ + weasyprint https://weasyprint.org /tmp/weasyprint-website.pdf \ -s <(echo 'body { font-family: serif !important }') If you have many documents to convert you may prefer using the Python API @@ -343,14 +343,14 @@ The Python version of the above example goes like this: .. code-block:: python from weasyprint import HTML - HTML('http://weasyprint.org/').write_pdf('/tmp/weasyprint-website.pdf') + HTML('https://weasyprint.org/').write_pdf('/tmp/weasyprint-website.pdf') … or with the inline stylesheet: .. code-block:: python from weasyprint import HTML, CSS - HTML('http://weasyprint.org/').write_pdf('/tmp/weasyprint-website.pdf', + HTML('https://weasyprint.org/').write_pdf('/tmp/weasyprint-website.pdf', stylesheets=[CSS(string='body { font-family: serif !important }')]) Instantiating HTML and CSS Objects @@ -367,8 +367,8 @@ Alternatively, use a named argument so that no guessing is involved: HTML('../foo.html') # Same as … HTML(filename='../foo.html') - HTML('http://weasyprint.org') # Same as … - HTML(url='http://weasyprint.org') + HTML('https://weasyprint.org') # Same as … + HTML(url='https://weasyprint.org') HTML(sys.stdin) # Same as … HTML(file_obj=sys.stdin) @@ -400,7 +400,7 @@ If you have ``@font-face`` rules in your CSS, you have to create a css = CSS(string=''' @font-face { font-family: Gentium; - src: url(http://example.com/fonts/Gentium.otf); + src: url(https://example.com/fonts/Gentium.otf); } h1 { font-family: Gentium }''', font_config=font_config) html.write_pdf( @@ -445,7 +445,7 @@ See the :ref:`Python API` for details. A few random examples: .. code-block:: python # Print the outline of the document. - # Output on http://www.w3.org/TR/CSS21/intro.html + # Output on https://www.w3.org/TR/CSS21/intro.html # 1. Introduction to CSS 2.1 (page 2) # 1. A brief CSS 2.1 tutorial for HTML (page 2) # 2. A brief CSS 2.1 tutorial for XML (page 5) @@ -510,7 +510,7 @@ If a ``file_obj`` is given, the resource will be closed automatically by the function internally used by WeasyPrint to retreive data. .. _Flask-Weasyprint: https://github.com/Kozea/Flask-WeasyPrint -.. _Flask: http://flask.pocoo.org/ +.. _Flask: https://flask.pocoo.org/ .. _Django-WeasyPrint: https://github.com/fdemmer/django-weasyprint .. _Django: https://www.djangoproject.com/ @@ -527,11 +527,11 @@ rendering time may be slightly increased. .. code-block:: python # No size optimization, faster, but generated PDF is larger - HTML('http://example.org/').write_pdf( + HTML('https://example.org/').write_pdf( 'example.pdf', optimize_size=()) # Full size optimization, slower, but generated PDF is smaller - HTML('http://example.org/').write_pdf( + HTML('https://example.org/').write_pdf( 'example.pdf', optimize_size=('fonts', 'images')) ``image_cache`` gives the possibility to use a cache for images, avoiding to @@ -545,7 +545,7 @@ time when you render a lot of documents that use the same images. cache = {} for i in range(10): - HTML(f'http://example.org/?id={i}').write_pdf( + HTML(f'https://example.org/?id={i}').write_pdf( f'example-{i}.pdf', image_cache=cache) @@ -610,7 +610,7 @@ untrusted users, you should: Infinite Requests ~~~~~~~~~~~~~~~~~ -WeasyPrint can reach files on the network, for example using ``http://`` +WeasyPrint can reach files on the network, for example using ``https://`` URIs. For various reasons, HTTP requests may take a long time and lead to problems similar to :ref:`Long Renderings`. @@ -687,7 +687,7 @@ Leaks can include (but are not restricted to): - locally installed fonts (using ``font-family`` and ``@font-face``), - network configuration (IPv4 and IPv6 support, IP addressing, firewall - configuration, using ``http://`` URIs and tracking time used to render + configuration, using ``https://`` URIs and tracking time used to render documents), - Python, Pango and other libraries versions (implementation details lead to different renderings). diff --git a/docs/going_further.rst b/docs/going_further.rst index edcf1de7..5fc0d929 100644 --- a/docs/going_further.rst +++ b/docs/going_further.rst @@ -100,7 +100,7 @@ like this: 7. Metadata −such as document information, attachments, embedded files, hyperlinks, and PDF trim and bleed boxes− are added to the PDF. -.. _like in web browsers: http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/#The_main_flow +.. _like in web browsers: https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/#The_main_flow Parsing HTML @@ -147,7 +147,7 @@ specificity and source order. Missing values are filled in through *inheritance* (from the parent element) or the property’s *initial value*, so that every element has a *specified value* for every property. -.. _cascade: http://www.w3.org/TR/CSS21/cascade.html +.. _cascade: https://www.w3.org/TR/CSS21/cascade.html These *specified values* are turned into *computed values* in the ``css.computed_values`` module. Keywords and lengths in various units are @@ -174,7 +174,7 @@ Boxes may have children and thus form a tree, much like elements. This tree is generally close but not identical to the ElementTree tree: some elements generate more than one box or none. -.. _visual formatting model: http://www.w3.org/TR/CSS21/visuren.html +.. _visual formatting model: https://www.w3.org/TR/CSS21/visuren.html Boxes are of a lot of different kinds. For example you should not confuse *block-level boxes* and *block containers*, though *block boxes* are both. The @@ -217,7 +217,7 @@ layout result. According to the `box model`_, each box has rectangular margin, border, padding and content areas: -.. _box model: http://www.w3.org/TR/CSS21/box.html +.. _box model: https://www.w3.org/TR/CSS21/box.html .. image:: https://www.w3.org/TR/CSS21/images/boxdim.png :alt: CSS Box Model @@ -239,8 +239,8 @@ The final result of the layout is a list of ``PageBox`` objects. .. [#] These are the coordinates *if* no `CSS transform`_ applies. Transforms change the actual location of boxes, but they are applied later during drawing and do not affect layout. -.. _used values: http://www.w3.org/TR/CSS21/cascade.html#used-value -.. _CSS transform: http://www.w3.org/TR/css3-transforms/ +.. _used values: https://www.w3.org/TR/CSS21/cascade.html#used-value +.. _CSS transform: https://www.w3.org/TR/css-transforms-1/ Stacking & Drawing @@ -257,7 +257,7 @@ the layout or stacking instead. The code lives in the ``draw`` module. -.. _stacking rules: http://www.w3.org/TR/CSS21/zindex.html +.. _stacking rules: https://www.w3.org/TR/CSS21/zindex.html Metadata diff --git a/tests/draw/svg/test_bounding_box.py b/tests/draw/svg/test_bounding_box.py index 26e8d8e0..c7eec55e 100644 --- a/tests/draw/svg/test_bounding_box.py +++ b/tests/draw/svg/test_bounding_box.py @@ -18,7 +18,7 @@ def test_bounding_box_rect(assert_pixels): @page { size: 5px } svg { display: block } - + @@ -49,7 +49,7 @@ def test_bounding_box_circle(assert_pixels): @page { size: 10px } svg { display: block } - + @@ -80,7 +80,7 @@ def test_bounding_box_ellipse(assert_pixels): @page { size: 10px } svg { display: block } - + @@ -106,7 +106,7 @@ def test_bounding_box_line(assert_pixels): @page { size: 5px } svg { display: block } - + @@ -133,7 +133,7 @@ def test_bounding_box_polygon(assert_pixels): @page { size: 5px } svg { display: block } - + @@ -159,7 +159,7 @@ def test_bounding_box_polyline(assert_pixels): @page { size: 5px } svg { display: block } - + @@ -184,7 +184,7 @@ def test_bounding_box_text(assert_pixels): @page { size: 2px } svg { display: block } - + @@ -213,7 +213,7 @@ def test_bounding_box_path_hv(assert_pixels): @page { size: 5px } svg { display: block } - + @@ -239,7 +239,7 @@ def test_bounding_box_path_l(assert_pixels): @page { size: 5px } svg { display: block } - + @@ -266,7 +266,7 @@ def test_bounding_box_path_c(assert_pixels): @page { size: 5px } svg { display: block } - + @@ -296,7 +296,7 @@ def test_bounding_box_path_s(assert_pixels): @page { size: 5px } svg { display: block } - + diff --git a/tests/draw/svg/test_clip.py b/tests/draw/svg/test_clip.py index 09e34b75..0b465e25 100644 --- a/tests/draw/svg/test_clip.py +++ b/tests/draw/svg/test_clip.py @@ -22,7 +22,7 @@ def test_clip_path(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -51,7 +51,7 @@ def test_clip_path_on_group(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -83,7 +83,7 @@ def test_clip_path_group_on_group(assert_pixels): @page { size: 9px } svg { display: block } - + diff --git a/tests/draw/svg/test_defs.py b/tests/draw/svg/test_defs.py index 35867795..bd8032ea 100644 --- a/tests/draw/svg/test_defs.py +++ b/tests/draw/svg/test_defs.py @@ -5,7 +5,7 @@ from base64 import b64encode from ...testing_utils import assert_no_logs SVG = ''' - + diff --git a/tests/draw/svg/test_gradients.py b/tests/draw/svg/test_gradients.py index cd138919..d57fdf43 100644 --- a/tests/draw/svg/test_gradients.py +++ b/tests/draw/svg/test_gradients.py @@ -23,7 +23,7 @@ def test_linear_gradient(assert_pixels): @page { size: 10px } svg { display: block } - + @@ -54,7 +54,7 @@ def test_linear_gradient_userspace(assert_pixels): @page { size: 10px } svg { display: block } - + @@ -83,7 +83,7 @@ def test_linear_gradient_multicolor(assert_pixels): @page { size: 10px 8px } svg { display: block } - + @@ -116,7 +116,7 @@ def test_linear_gradient_multicolor_userspace(assert_pixels): @page { size: 10px 8px } svg { display: block } - + @@ -150,7 +150,7 @@ def test_linear_gradient_transform(assert_pixels): @page { size: 10px 8px} svg { display: block } - + @@ -191,7 +191,7 @@ def test_linear_gradient_repeat(assert_pixels): @page { size: 10px 16px } svg { display: block } - + @@ -233,7 +233,7 @@ def test_linear_gradient_repeat_long(assert_pixels): @page { size: 10px 16px } svg { display: block } - + @@ -274,7 +274,7 @@ def test_linear_gradient_reflect(assert_pixels): @page { size: 10px 16px } svg { display: block } - + @@ -309,7 +309,7 @@ def test_radial_gradient(assert_pixels): @page { size: 10px } svg { display: block } - + - + @@ -372,7 +372,7 @@ def test_radial_gradient_multicolor(assert_pixels): @page { size: 10px } svg { display: block } - + - + - + - + - + @@ -38,7 +38,7 @@ def test_image_svg_viewbox(assert_pixels): @page { size: 4px 4px } svg { display: block } - + @@ -63,7 +63,7 @@ def test_image_svg_align_default(assert_pixels): svg { display: block } + xmlns="https://www.w3.org/2000/svg"> @@ -89,7 +89,7 @@ def test_image_svg_align_none(assert_pixels): + xmlns="https://www.w3.org/2000/svg"> @@ -115,7 +115,7 @@ def test_image_svg_align_meet_x(assert_pixels): + xmlns="https://www.w3.org/2000/svg"> @@ -141,7 +141,7 @@ def test_image_svg_align_meet_y(assert_pixels): + xmlns="https://www.w3.org/2000/svg"> @@ -167,7 +167,7 @@ def test_image_svg_align_slice_x(assert_pixels): + xmlns="https://www.w3.org/2000/svg"> @@ -193,7 +193,7 @@ def test_image_svg_align_slice_y(assert_pixels): + xmlns="https://www.w3.org/2000/svg"> @@ -214,7 +214,7 @@ def test_image_svg_percentage(assert_pixels): @page { size: 4px 4px } svg { display: block } - + @@ -233,7 +233,7 @@ def test_image_svg_wrong(assert_pixels): @page { size: 4px 4px } svg { display: block } - + ''') @@ -251,7 +251,7 @@ def test_image_image(assert_pixels): @page { size: 4px 4px } svg { display: block } - + ''' % path2url(resource_filename('pattern.png'))) @@ -268,7 +268,7 @@ def test_image_image_wrong(assert_pixels): @page { size: 4px 4px } svg { display: block } - + ''') diff --git a/tests/draw/svg/test_opacity.py b/tests/draw/svg/test_opacity.py index c67cfe7e..e769a475 100644 --- a/tests/draw/svg/test_opacity.py +++ b/tests/draw/svg/test_opacity.py @@ -7,7 +7,7 @@ opacity_source = ''' @page { size: 9px } svg { display: block } - %s''' + %s''' @assert_no_logs diff --git a/tests/draw/svg/test_paths.py b/tests/draw/svg/test_paths.py index e7b7f241..e666f7dc 100644 --- a/tests/draw/svg/test_paths.py +++ b/tests/draw/svg/test_paths.py @@ -21,7 +21,7 @@ def test_path_Hh(assert_pixels): @page { size: 10px } svg { display: block } - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -421,7 +421,7 @@ def test_path_Aa3(assert_pixels): @page { size: 12px } svg { display: block } - + @@ -448,7 +448,7 @@ def test_path_Aa4(assert_pixels): @page { size: 12px } svg { display: block } - + - + @@ -504,7 +504,7 @@ def test_path_Aa6(assert_pixels): @page { size: 12px } svg { display: block } - + @@ -531,7 +531,7 @@ def test_path_Aa7(assert_pixels): @page { size: 12px } svg { display: block } - + @@ -558,7 +558,7 @@ def test_path_wrong_point(assert_pixels): @page { size: 12px } svg { display: block } - + @@ -585,7 +585,7 @@ def test_path_markers_l(assert_pixels): @page { size: 12px } svg { display: block } - + - + - + - + - + - + - + @@ -44,7 +44,7 @@ def test_rect_fill(assert_pixels): @page { size: 9px } svg { display: block } - + ''') @@ -67,7 +67,7 @@ def test_rect_stroke_fill(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -91,7 +91,7 @@ def test_rect_round(assert_pixels): @page { size: 9px } svg { display: block } - + ''') @@ -114,7 +114,7 @@ def test_rect_round_zero(assert_pixels): @page { size: 9px } svg { display: block } - + ''') @@ -137,7 +137,7 @@ def test_line(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -161,7 +161,7 @@ def test_polyline(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -185,7 +185,7 @@ def test_polyline_fill(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -209,7 +209,7 @@ def test_polygon(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -233,7 +233,7 @@ def test_polygon_fill(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -258,7 +258,7 @@ def test_circle_stroke(assert_pixels): @page { size: 10px } svg { display: block } - + @@ -283,7 +283,7 @@ def test_circle_fill(assert_pixels): @page { size: 10px } svg { display: block } - + @@ -308,7 +308,7 @@ def test_ellipse_stroke(assert_pixels): @page { size: 10px } svg { display: block } - + @@ -333,7 +333,7 @@ def test_ellipse_fill(assert_pixels): @page { size: 10px } svg { display: block } - + @@ -357,7 +357,7 @@ def test_rect_in_g(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -382,7 +382,7 @@ def test_rect_x_y_in_g(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -407,7 +407,7 @@ def test_rect_stroke_zero(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -431,7 +431,7 @@ def test_rect_width_height_zero(assert_pixels): @page { size: 9px } svg { display: block } - + ''') @@ -454,7 +454,7 @@ def test_rect_fill_inherit(assert_pixels): @page { size: 9px } svg { display: block } - + ''') diff --git a/tests/draw/svg/test_text.py b/tests/draw/svg/test_text.py index 90c20969..7bf3501a 100644 --- a/tests/draw/svg/test_text.py +++ b/tests/draw/svg/test_text.py @@ -14,7 +14,7 @@ def test_text_fill(assert_pixels): @page { size: 20px 2px } svg { display: block } - + ABC DEF @@ -35,7 +35,7 @@ def test_text_stroke(assert_pixels): @page { font-size: 1px; size: 20em 8ex } svg { display: block } - + A B C @@ -55,7 +55,7 @@ def test_text_x(assert_pixels): @page { size: 20px 2px } svg { display: block } - + ABCD @@ -83,7 +83,7 @@ def test_text_y(assert_pixels): @page { size: 30px 10px } svg { display: block } - + ABCDEF @@ -111,7 +111,7 @@ def test_text_xy(assert_pixels): @page { size: 30px 10px } svg { display: block } - + ABCDE @@ -131,7 +131,7 @@ def test_text_dx(assert_pixels): @page { size: 20px 2px } svg { display: block } - + ABCD @@ -159,7 +159,7 @@ def test_text_dy(assert_pixels): @page { size: 30px 10px } svg { display: block } - + ABCDEF @@ -187,7 +187,7 @@ def test_text_dx_dy(assert_pixels): @page { size: 30px 10px } svg { display: block } - + ABCDE @@ -209,7 +209,7 @@ def test_text_anchor_start(assert_pixels): @page { size: 20px 4px } svg { display: block } - + ABC @@ -233,7 +233,7 @@ def test_text_anchor_middle(assert_pixels): @page { size: 20px 2px } svg { display: block } - + ABC @@ -253,7 +253,7 @@ def test_text_anchor_end(assert_pixels): @page { size: 20px 2px } svg { display: block } - + ABC @@ -273,7 +273,7 @@ def test_text_tspan(assert_pixels): @page { size: 20px 2px } svg { display: block } - + ABC DEF @@ -294,7 +294,7 @@ def test_text_rotate(assert_pixels): @page { size: 20px 4px } svg { display: block } - + abc - + @@ -44,7 +44,7 @@ def test_transform_translatex(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -68,7 +68,7 @@ def test_transform_translatey(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -92,7 +92,7 @@ def test_transform_rotate(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -116,7 +116,7 @@ def test_transform_rotate_cx_cy(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -140,7 +140,7 @@ def test_transform_skew(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -164,7 +164,7 @@ def test_transform_skewx(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -188,7 +188,7 @@ def test_transform_skewy(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -212,7 +212,7 @@ def test_transform_scale(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -236,7 +236,7 @@ def test_transform_scale_2(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -260,7 +260,7 @@ def test_transform_scalex(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -284,7 +284,7 @@ def test_transform_scaley(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -308,7 +308,7 @@ def test_transform_matrix(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -333,7 +333,7 @@ def test_transform_multiple(assert_pixels): @page { size: 9px } svg { display: block } - + diff --git a/tests/draw/svg/test_visibility.py b/tests/draw/svg/test_visibility.py index 6474e277..39c3272b 100644 --- a/tests/draw/svg/test_visibility.py +++ b/tests/draw/svg/test_visibility.py @@ -20,7 +20,7 @@ def test_visibility_visible(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -44,7 +44,7 @@ def test_visibility_hidden(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -68,7 +68,7 @@ def test_visibility_inherit_hidden(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -93,7 +93,7 @@ def test_visibility_inherit_visible(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -119,7 +119,7 @@ def test_display_inline(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -143,7 +143,7 @@ def test_display_none(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -167,7 +167,7 @@ def test_display_inherit_none(assert_pixels): @page { size: 9px } svg { display: block } - + @@ -192,7 +192,7 @@ def test_display_inherit_inline(assert_pixels): @page { size: 9px } svg { display: block } - + diff --git a/tests/layout/test_block.py b/tests/layout/test_block.py index e618797a..c321cef8 100644 --- a/tests/layout/test_block.py +++ b/tests/layout/test_block.py @@ -257,7 +257,7 @@ def test_block_percentage_heights(): ('width: 10%; height: 1000px; min-width: auto; max-height: none',), )) def test_box_sizing(size): - # http://www.w3.org/TR/css3-ui/#box-sizing + # https://www.w3.org/TR/css-ui-3/#box-sizing page, = render_pages('''
a\nb\rc\r\nd\u2029e
') html, = page.children body, = html.children @@ -1005,7 +1005,7 @@ def test_vertical_align_13(): @assert_no_logs def test_box_decoration_break_inline_slice(): - # http://www.w3.org/TR/css3-background/#the-box-decoration-break + # https://www.w3.org/TR/css-backgrounds-3/#the-box-decoration-break page_1, = render_pages(''' -

+

@@ -729,8 +729,8 @@ def test_links_1():

''', [ [ - ('external', 'http://weasyprint.org', (0, 0, 30, 20), None), - ('external', 'http://weasyprint.org', (0, 0, 30, 30), None), + ('external', 'https://weasyprint.org', (0, 0, 30, 20), None), + ('external', 'https://weasyprint.org', (0, 0, 30, 30), None), ('internal', 'lipsum', (10, 100, 42, 120), None), ('internal', 'lipsum', (10, 100, 42, 132), None) ], @@ -741,8 +741,8 @@ def test_links_1(): ], [ ( [ - ('external', 'http://weasyprint.org', (0, 0, 30, 20), None), - ('external', 'http://weasyprint.org', (0, 0, 30, 30), None), + ('external', 'https://weasyprint.org', (0, 0, 30, 20), None), + ('external', 'https://weasyprint.org', (0, 0, 30, 30), None), ('internal', 'lipsum', (10, 100, 42, 120), None), ('internal', 'lipsum', (10, 100, 42, 132), None) ], @@ -762,11 +762,11 @@ def test_links_2(): ''' - ''', [[('external', 'http://weasyprint.org/foo/lipsum/%C3%A9_%E9', + ''', [[('external', 'https://weasyprint.org/foo/lipsum/%C3%A9_%E9', (5, 10, 195, 10), None)]], - [{}], [([('external', 'http://weasyprint.org/foo/lipsum/%C3%A9_%E9', + [{}], [([('external', 'https://weasyprint.org/foo/lipsum/%C3%A9_%E9', (5, 10, 195, 10), None)], [])], - base_url='http://weasyprint.org/foo/bar/') + base_url='https://weasyprint.org/foo/bar/') @assert_no_logs @@ -776,11 +776,11 @@ def test_links_3():
- ''', [[('external', 'http://weasyprint.org/foo/lipsum/%C3%A9_%E9', + ''', [[('external', 'https://weasyprint.org/foo/lipsum/%C3%A9_%E9', (5, 10, 195, 10), None)]], - [{}], [([('external', 'http://weasyprint.org/foo/lipsum/%C3%A9_%E9', + [{}], [([('external', 'https://weasyprint.org/foo/lipsum/%C3%A9_%E9', (5, 10, 195, 10), None)], [])], - base_url='http://weasyprint.org/foo/bar/') + base_url='https://weasyprint.org/foo/bar/') @assert_no_logs @@ -816,13 +816,13 @@ def test_links_6(): - + ''', [[ ('internal', 'lipsum', (5, 10, 195, 10), None), - ('external', 'http://weasyprint.org/', (0, 10, 200, 10), None)]], + ('external', 'https://weasyprint.org/', (0, 10, 200, 10), None)]], [{'lipsum': (5, 10)}], [([('internal', 'lipsum', (5, 10, 195, 10), None), - ('external', 'http://weasyprint.org/', (0, 10, 200, 10), None)], + ('external', 'https://weasyprint.org/', (0, 10, 200, 10), None)], [('lipsum', 5, 10)])], base_url=None) diff --git a/tests/test_boxes.py b/tests/test_boxes.py index 5f2f00b2..5a54f152 100644 --- a/tests/test_boxes.py +++ b/tests/test_boxes.py @@ -223,7 +223,7 @@ def test_styles(): @assert_no_logs def test_whitespace(): # TODO: test more cases - # http://www.w3.org/TR/CSS21/text.html#white-space-model + # https://www.w3.org/TR/CSS21/text.html#white-space-model assert_tree(parse_all('''

Lorem \t\r\n ipsum\t dolor sit @@ -338,10 +338,10 @@ def test_images_2(): @assert_no_logs def test_tables_1(): - # Rules in http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes + # Rules in https://www.w3.org/TR/CSS21/tables.html#anonymous-boxes # Rule 1.3 - # Also table model: http://www.w3.org/TR/CSS21/tables.html#model + # Also table model: https://www.w3.org/TR/CSS21/tables.html#model assert_tree(parse_all(''' @@ -408,7 +408,7 @@ def test_tables_2(): @assert_no_logs def test_tables_3(): - # http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes + # https://www.w3.org/TR/CSS21/tables.html#anonymous-boxes # Rules 1.1 and 1.2 # Rule XXX (not in the spec): column groups have at least one column child assert_tree(parse_all(''' diff --git a/tests/test_css_descriptors.py b/tests/test_css_descriptors.py index 56e1e402..8b83b5f9 100644 --- a/tests/test_css_descriptors.py +++ b/tests/test_css_descriptors.py @@ -13,16 +13,16 @@ def test_font_face_1(): stylesheet = tinycss2.parse_stylesheet( '@font-face {' ' font-family: Gentium Hard;' - ' src: url(http://example.com/fonts/Gentium.woff);' + ' src: url(https://example.com/fonts/Gentium.woff);' '}') at_rule, = stylesheet assert at_rule.at_keyword == 'font-face' font_family, src = list(preprocess_descriptors( - 'font-face', 'http://weasyprint.org/foo/', + 'font-face', 'https://weasyprint.org/foo/', tinycss2.parse_declaration_list(at_rule.content))) assert font_family == ('font_family', 'Gentium Hard') assert src == ( - 'src', (('external', 'http://example.com/fonts/Gentium.woff'),)) + 'src', (('external', 'https://example.com/fonts/Gentium.woff'),)) @assert_no_logs @@ -39,11 +39,11 @@ def test_font_face_2(): assert at_rule.at_keyword == 'font-face' font_family, src, font_style, font_weight, font_stretch = list( preprocess_descriptors( - 'font-face', 'http://weasyprint.org/foo/', + 'font-face', 'https://weasyprint.org/foo/', tinycss2.parse_declaration_list(at_rule.content))) assert font_family == ('font_family', 'Fonty Smiley') assert src == ( - 'src', (('external', 'http://weasyprint.org/foo/Fonty-Smiley.woff'),)) + 'src', (('external', 'https://weasyprint.org/foo/Fonty-Smiley.woff'),)) assert font_style == ('font_style', 'italic') assert font_weight == ('font_weight', 200) assert font_stretch == ('font_stretch', 'condensed') @@ -59,7 +59,7 @@ def test_font_face_3(): at_rule, = stylesheet assert at_rule.at_keyword == 'font-face' font_family, src = list(preprocess_descriptors( - 'font-face', 'http://weasyprint.org/foo/', + 'font-face', 'https://weasyprint.org/foo/', tinycss2.parse_declaration_list(at_rule.content))) assert font_family == ('font_family', 'Gentium Hard') assert src == ('src', (('local', None),)) @@ -76,7 +76,7 @@ def test_font_face_4(): at_rule, = stylesheet assert at_rule.at_keyword == 'font-face' font_family, src = list(preprocess_descriptors( - 'font-face', 'http://weasyprint.org/foo/', + 'font-face', 'https://weasyprint.org/foo/', tinycss2.parse_declaration_list(at_rule.content))) assert font_family == ('font_family', 'Gentium Hard') assert src == ('src', (('local', 'Gentium Hard'),)) @@ -95,7 +95,7 @@ def test_font_face_5(): assert at_rule.at_keyword == 'font-face' with capture_logs() as logs: font_family, src = list(preprocess_descriptors( - 'font-face', 'http://weasyprint.org/foo/', + 'font-face', 'https://weasyprint.org/foo/', tinycss2.parse_declaration_list(at_rule.content))) assert font_family == ('font_family', 'Gentium Hard') assert src == ('src', (('local', 'Gentium Hard'),)) @@ -118,11 +118,11 @@ def test_font_face_bad_1(): with capture_logs() as logs: font_family, src, font_stretch = list( preprocess_descriptors( - 'font-face', 'http://weasyprint.org/foo/', + 'font-face', 'https://weasyprint.org/foo/', tinycss2.parse_declaration_list(at_rule.content))) assert font_family == ('font_family', 'Bad Font') assert src == ( - 'src', (('external', 'http://weasyprint.org/foo/BadFont.woff'),)) + 'src', (('external', 'https://weasyprint.org/foo/BadFont.woff'),)) assert font_stretch == ('font_stretch', 'expanded') assert logs == [ 'WARNING: Ignored `font-style: wrong` at 1:91, invalid value.', @@ -134,7 +134,7 @@ def test_font_face_bad_2(): stylesheet = tinycss2.parse_stylesheet('@font-face{}') with capture_logs() as logs: preprocess_stylesheet( - 'print', 'http://wp.org/foo/', stylesheet, None, None, None, + 'print', 'https://wp.org/foo/', stylesheet, None, None, None, None, None) assert logs == [ "WARNING: Missing src descriptor in '@font-face' rule at 1:1"] @@ -144,7 +144,7 @@ def test_font_face_bad_3(): stylesheet = tinycss2.parse_stylesheet('@font-face{src: url(test.woff)}') with capture_logs() as logs: preprocess_stylesheet( - 'print', 'http://wp.org/foo/', stylesheet, None, None, None, + 'print', 'https://wp.org/foo/', stylesheet, None, None, None, None, None) assert logs == [ "WARNING: Missing font-family descriptor in '@font-face' rule at 1:1"] @@ -154,7 +154,7 @@ def test_font_face_bad_4(): stylesheet = tinycss2.parse_stylesheet('@font-face{font-family: test}') with capture_logs() as logs: preprocess_stylesheet( - 'print', 'http://wp.org/foo/', stylesheet, None, None, None, + 'print', 'https://wp.org/foo/', stylesheet, None, None, None, None, None) assert logs == [ "WARNING: Missing src descriptor in '@font-face' rule at 1:1"] @@ -165,7 +165,7 @@ def test_font_face_bad_5(): '@font-face { font-family: test; src: wrong }') with capture_logs() as logs: preprocess_stylesheet( - 'print', 'http://wp.org/foo/', stylesheet, None, None, None, + 'print', 'https://wp.org/foo/', stylesheet, None, None, None, None, None) assert logs == [ 'WARNING: Ignored `src: wrong ` at 1:33, invalid value.', @@ -177,7 +177,7 @@ def test_font_face_bad_6(): '@font-face { font-family: good, bad; src: url(test.woff) }') with capture_logs() as logs: preprocess_stylesheet( - 'print', 'http://wp.org/foo/', stylesheet, None, None, None, + 'print', 'https://wp.org/foo/', stylesheet, None, None, None, None, None) assert logs == [ 'WARNING: Ignored `font-family: good, bad` at 1:14, invalid value.', @@ -189,7 +189,7 @@ def test_font_face_bad_7(): '@font-face { font-family: good, bad; src: really bad }') with capture_logs() as logs: preprocess_stylesheet( - 'print', 'http://wp.org/foo/', stylesheet, None, None, None, + 'print', 'https://wp.org/foo/', stylesheet, None, None, None, None, None) assert logs == [ 'WARNING: Ignored `font-family: good, bad` at 1:14, invalid value.', @@ -207,6 +207,6 @@ def test_counter_style_invalid(rule): stylesheet = tinycss2.parse_stylesheet(rule) with capture_logs() as logs: preprocess_stylesheet( - 'print', 'http://wp.org/foo/', stylesheet, None, None, None, + 'print', 'https://wp.org/foo/', stylesheet, None, None, None, None, {}) assert len(logs) >= 1 diff --git a/tests/test_css_validation.py b/tests/test_css_validation.py index 700d19b5..f407c5b5 100644 --- a/tests/test_css_validation.py +++ b/tests/test_css_validation.py @@ -18,7 +18,7 @@ def expand_to_dict(css, expected_error=None): declarations = tinycss2.parse_declaration_list(css) with capture_logs() as logs: - base_url = 'http://weasyprint.org/foo/' + base_url = 'https://weasyprint.org/foo/' declarations = list(preprocess_declarations(base_url, declarations)) if expected_error: @@ -360,7 +360,7 @@ def test_expand_borders_invalid(): 'list_style_type': 'inherit', }), ('list-style: url(../bar/lipsum.png)', { - 'list_style_image': ('url', 'http://weasyprint.org/bar/lipsum.png'), + 'list_style_image': ('url', 'https://weasyprint.org/bar/lipsum.png'), }), ('list-style: square', { 'list_style_type': 'square', @@ -422,7 +422,7 @@ def test_expand_background(): assert_background('red', background_color=(1, 0, 0, 1)) assert_background( 'url(lipsum.png)', - background_image=[('url', 'http://weasyprint.org/foo/lipsum.png')]) + background_image=[('url', 'https://weasyprint.org/foo/lipsum.png')]) assert_background( 'no-repeat', background_repeat=[('no-repeat', 'no-repeat')]) @@ -468,7 +468,7 @@ def test_expand_background(): assert_background( 'url(bar) #f00 repeat-y center left fixed', background_color=(1, 0, 0, 1), - background_image=[('url', 'http://weasyprint.org/foo/bar')], + background_image=[('url', 'https://weasyprint.org/foo/bar')], background_repeat=[('no-repeat', 'repeat')], background_attachment=['fixed'], background_position=[('left', (0, '%'), 'top', (50, '%'))]) @@ -515,7 +515,7 @@ def test_expand_background(): assert_background( 'url(bar) center, no-repeat', background_color=(0, 0, 0, 0), - background_image=[('url', 'http://weasyprint.org/foo/bar'), + background_image=[('url', 'https://weasyprint.org/foo/bar'), ('none', None)], background_position=[('left', (50, '%'), 'top', (50, '%')), ('left', (0, '%'), 'top', (0, '%'))], diff --git a/tests/test_pdf.py b/tests/test_pdf.py index 1b459063..6e93040c 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -303,7 +303,7 @@ def test_links(): p { display: block; height: 90pt; margin: 0 0 10pt 0 } img { width: 30pt; vertical-align: top } -

+

@@ -322,13 +322,13 @@ def test_links(): b'/Rect \\[ ([\\d\\.]+ [\\d\\.]+ [\\d\\.]+ [\\d\\.]+) \\]', pdf)] # 30pt wide (like the image), 20pt high (like line-height) - assert uris.pop(0) == b'http://weasyprint.org' + assert uris.pop(0) == b'https://weasyprint.org' assert subtypes.pop(0) == b'/Link' assert types.pop(0) == b'/URI' assert rects.pop(0) == [0, TOP, 30, TOP - 20] # The image itself: 30*30pt - assert uris.pop(0) == b'http://weasyprint.org' + assert uris.pop(0) == b'https://weasyprint.org' assert subtypes.pop(0) == b'/Link' assert types.pop(0) == b'/URI' assert rects.pop(0) == [0, TOP, 30, TOP - 30] @@ -373,8 +373,8 @@ def test_relative_links_no_height(): # 100% wide (block), 0pt high pdf = FakeHTML( string='a', - base_url='http://weasyprint.org/foo/bar/').write_pdf() - assert b'/S /URI\n/URI (http://weasyprint.org/foo/lipsum)' + base_url='https://weasyprint.org/foo/bar/').write_pdf() + assert b'/S /URI\n/URI (https://weasyprint.org/foo/lipsum)' assert f'/Rect [ 0 {TOP} {RIGHT} {TOP} ]'.encode() in pdf @@ -438,15 +438,15 @@ def test_relative_links_anchors(): def test_relative_links_different_base(): pdf = FakeHTML( string='a', - base_url='http://weasyprint.org/foo/bar/').write_pdf() - assert b'http://weasyprint.org/test/lipsum' in pdf + base_url='https://weasyprint.org/foo/bar/').write_pdf() + assert b'https://weasyprint.org/test/lipsum' in pdf @assert_no_logs def test_relative_links_same_base(): pdf = FakeHTML( string='a', - base_url='http://weasyprint.org/foo/bar/').write_pdf() + base_url='https://weasyprint.org/foo/bar/').write_pdf() assert b'/Dest (test)' in pdf diff --git a/tests/testing_utils.py b/tests/testing_utils.py index 060fcfc8..642b1b24 100644 --- a/tests/testing_utils.py +++ b/tests/testing_utils.py @@ -127,7 +127,7 @@ def http_server(handlers): return [response] # Port 0: let the OS pick an available port number - # http://stackoverflow.com/a/1365284/1162888 + # https://stackoverflow.com/a/1365284/1162888 server = wsgiref.simple_server.make_server('127.0.0.1', 0, wsgi_app) _host, port = server.socket.getsockname() thread = threading.Thread(target=server.serve_forever) diff --git a/weasyprint/__init__.py b/weasyprint/__init__.py index b9f12223..72150969 100644 --- a/weasyprint/__init__.py +++ b/weasyprint/__init__.py @@ -31,7 +31,7 @@ from .logger import LOGGER, PROGRESS_LOGGER # noqa isort:skip def _find_base_url(html_document, fallback_base_url): """Return the base URL for the document. - See http://www.w3.org/TR/html5/urls.html#document-base-url + See https://www.w3.org/TR/html5/urls.html#document-base-url """ first_base_element = next(iter(html_document.iter('base')), None) diff --git a/weasyprint/css/__init__.py b/weasyprint/css/__init__.py index 414f9d1a..8c41b522 100644 --- a/weasyprint/css/__init__.py +++ b/weasyprint/css/__init__.py @@ -4,7 +4,7 @@ This module takes care of steps 3 and 4 of “CSS 2.1 processing model”: Retri stylesheets associated with a document and annotate every element with a value for every CSS property. -http://www.w3.org/TR/CSS21/intro.html#processing-model +https://www.w3.org/TR/CSS21/intro.html#processing-model This module does this in more than two steps. The :func:`get_all_computed_styles` function does everything, but it is itsef based @@ -48,7 +48,7 @@ class StyleFor: # values: (values, weight) # values: a PropertyValue-like object # weight: values with a greater weight take precedence, see - # http://www.w3.org/TR/CSS21/cascade.html#cascading-order + # https://www.w3.org/TR/CSS21/cascade.html#cascading-order self._cascaded_styles = cascaded_styles = {} # keys: (element, pseudo_element_type), like cascaded_styles @@ -587,7 +587,7 @@ def declaration_precedence(origin, importance): and ``'user agent'``. """ - # See http://www.w3.org/TR/CSS21/cascade.html#cascading-order + # See https://www.w3.org/TR/CSS21/cascade.html#cascading-order if origin == 'user agent': return 1 elif origin == 'user' and not importance: diff --git a/weasyprint/css/computed_values.py b/weasyprint/css/computed_values.py index d064019c..3f828dfc 100644 --- a/weasyprint/css/computed_values.py +++ b/weasyprint/css/computed_values.py @@ -21,7 +21,7 @@ ZERO_PIXELS = Dimension(0, 'px') # Value in pixels of font-size for keywords: 12pt (16px) for # medium, and scaling factors given in CSS3 for others: -# http://www.w3.org/TR/css3-fonts/#font-size-prop +# https://www.w3.org/TR/css-fonts-3/#font-size-prop FONT_SIZE_KEYWORDS = OrderedDict( # medium is 16px, others are a ratio of medium (name, INITIAL_VALUES['font_size'] * a / b) @@ -45,7 +45,7 @@ BORDER_WIDTH_KEYWORDS = { } assert INITIAL_VALUES['border_top_width'] == BORDER_WIDTH_KEYWORDS['medium'] -# http://www.w3.org/TR/CSS21/fonts.html#propdef-font-weight +# https://www.w3.org/TR/CSS21/fonts.html#propdef-font-weight FONT_WEIGHT_RELATIVE = dict( bolder={ 100: 400, @@ -71,7 +71,7 @@ FONT_WEIGHT_RELATIVE = dict( }, ) -# http://www.w3.org/TR/css3-page/#size +# https://www.w3.org/TR/css-page-3/#size # name=(width in pixels, height in pixels) PAGE_SIZES = { 'a10': (Dimension(26, 'mm'), Dimension(37, 'mm'),), @@ -538,7 +538,7 @@ def content(style, name, values): def display(style, name, value): """Compute the ``display`` property. - See http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo + See https://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo """ float_ = style.specified['float'] @@ -561,7 +561,7 @@ def display(style, name, value): def compute_float(style, name, value): """Compute the ``float`` property. - See http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo + See https://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo """ if style.specified['position'] in ('absolute', 'fixed'): diff --git a/weasyprint/css/html5_ua.css b/weasyprint/css/html5_ua.css index cd628f1d..9d21c43b 100644 --- a/weasyprint/css/html5_ua.css +++ b/weasyprint/css/html5_ua.css @@ -8,7 +8,7 @@ what various web browsers use. */ -/* http://www.w3.org/TR/html5/Overview#scroll-to-the-fragment-identifier */ +/* https://www.w3.org/TR/html5/Overview#scroll-to-the-fragment-identifier */ *[id] { -weasy-anchor: attr(id); } a[name] { -weasy-anchor: attr(name); } diff --git a/weasyprint/css/properties.py b/weasyprint/css/properties.py index 39e35040..8704c091 100644 --- a/weasyprint/css/properties.py +++ b/weasyprint/css/properties.py @@ -9,7 +9,7 @@ Dimension = collections.namedtuple('Dimension', ['value', 'unit']) INITIAL_VALUES = { - # CSS 2.1: http://www.w3.org/TR/CSS21/propidx.html + # CSS 2.1: https://www.w3.org/TR/CSS21/propidx.html 'bottom': 'auto', 'caption_side': 'top', 'clear': 'none', @@ -42,7 +42,7 @@ INITIAL_VALUES = { 'width': 'auto', 'z_index': 'auto', - # Backgrounds and Borders 3 (CR): https://www.w3.org/TR/css3-background/ + # Backgrounds and Borders 3 (CR): https://www.w3.org/TR/css-backgrounds-3/ 'background_attachment': ('scroll',), 'background_clip': ('border-box',), 'background_color': parse_color('transparent'), @@ -71,7 +71,7 @@ INITIAL_VALUES = { 'border_top_style': 'none', 'border_top_width': 3, # computed value for 'medium' - # Color 3 (REC): https://www.w3.org/TR/css3-color/ + # Color 3 (REC): https://www.w3.org/TR/css-color-3/ 'opacity': 1, # Multi-column Layout (WD): https://www.w3.org/TR/css-multicol-1/ @@ -120,7 +120,7 @@ INITIAL_VALUES = { 'quotes': list('“”‘’'), # chosen by the user agent 'string_set': 'none', - # Images 3/4 (CR/WD): https://www.w3.org/TR/css4-images/ + # Images 3/4 (CR/WD): https://www.w3.org/TR/css-images-4/ 'image_resolution': 1, # dppx 'image_rendering': 'auto', # https://drafts.csswg.org/css-images-3/ @@ -214,10 +214,10 @@ KNOWN_PROPERTIES = set(name.replace('_', '-') for name in INITIAL_VALUES) # Values inherited but not applicable to print are not included. # # text_decoration is not a really inherited, see -# http://www.w3.org/TR/CSS2/text.html#propdef-text-decoration +# https://www.w3.org/TR/CSS2/text.html#propdef-text-decoration # # link: click events normally bubble up to link ancestors -# See http://lists.w3.org/Archives/Public/www-style/2012Jun/0315.html +# See https://lists.w3.org/Archives/Public/www-style/2012Jun/0315.html INHERITED = { 'block_ellipsis', 'border_collapse', @@ -270,8 +270,8 @@ INHERITED = { } -# http://www.w3.org/TR/CSS21/tables.html#model -# See also http://lists.w3.org/Archives/Public/www-style/2012Jun/0066.html +# https://www.w3.org/TR/CSS21/tables.html#model +# See also https://lists.w3.org/Archives/Public/www-style/2012Jun/0066.html # Only non-inherited properties need to be included here. TABLE_WRAPPER_BOX_PROPERTIES = { 'bottom', diff --git a/weasyprint/css/utils.py b/weasyprint/css/utils.py index 75f1faa9..a8ef37ca 100644 --- a/weasyprint/css/utils.py +++ b/weasyprint/css/utils.py @@ -9,7 +9,7 @@ from tinycss2.color3 import parse_color from ..urls import iri_to_uri, url_is_absolute from .properties import Dimension -# http://dev.w3.org/csswg/css3-values/#angles +# https://drafts.csswg.org/css-values-3/#angles # 1 is this many radians. ANGLE_TO_RADIANS = { 'rad': 1, @@ -19,7 +19,7 @@ ANGLE_TO_RADIANS = { } # How many CSS pixels is one ? -# http://www.w3.org/TR/CSS21/syndata.html#length-units +# https://www.w3.org/TR/CSS21/syndata.html#length-units LENGTHS_TO_PIXELS = { 'px': 1, 'pt': 1. / 0.75, @@ -30,7 +30,7 @@ LENGTHS_TO_PIXELS = { 'q': 96. / 25.4 / 4, # LENGTHS_TO_PIXELS['mm'] / 4 } -# http://dev.w3.org/csswg/css-values/#resolution +# https://drafts.csswg.org/css-values/#resolution RESOLUTION_TO_DPPX = { 'dppx': 1, 'dpi': 1 / LENGTHS_TO_PIXELS['in'], @@ -257,7 +257,7 @@ def parse_2d_position(tokens): def parse_position(tokens): """Parse background-position and object-position. - See http://dev.w3.org/csswg/css3-background/#the-background-position + See https://drafts.csswg.org/css-backgrounds-3/#the-background-position https://drafts.csswg.org/css-images-3/#propdef-object-position """ diff --git a/weasyprint/css/validation/expanders.py b/weasyprint/css/validation/expanders.py index 7064856e..310d30ea 100644 --- a/weasyprint/css/validation/expanders.py +++ b/weasyprint/css/validation/expanders.py @@ -167,7 +167,7 @@ def border_radius(name, tokens, base_url): def expand_list_style(name, tokens, base_url): """Expand the ``list-style`` shorthand property. - See http://www.w3.org/TR/CSS21/generate.html#propdef-list-style + See https://www.w3.org/TR/CSS21/generate.html#propdef-list-style """ type_specified = image_specified = False @@ -209,7 +209,7 @@ def expand_list_style(name, tokens, base_url): def expand_border(base_url, name, tokens): """Expand the ``border`` shorthand property. - See http://www.w3.org/TR/CSS21/box.html#propdef-border + See https://www.w3.org/TR/CSS21/box.html#propdef-border """ for suffix in ('-top', '-right', '-bottom', '-left'): @@ -227,7 +227,7 @@ def expand_border(base_url, name, tokens): def expand_border_side(name, tokens): """Expand the ``border-*`` shorthand properties. - See http://www.w3.org/TR/CSS21/box.html#propdef-border-top + See https://www.w3.org/TR/CSS21/box.html#propdef-border-top """ for token in tokens: @@ -246,7 +246,7 @@ def expand_border_side(name, tokens): def expand_background(base_url, name, tokens): """Expand the ``background`` shorthand property. - See http://dev.w3.org/csswg/css3-background/#the-background + See https://drafts.csswg.org/css-backgrounds-3/#the-background """ properties = [ @@ -546,7 +546,7 @@ def expand_font(name, tokens): def expand_word_wrap(name, tokens): """Expand the ``word-wrap`` legacy property. - See http://www.w3.org/TR/css3-text/#overflow-wrap + See https://www.w3.org/TR/css-text-3/#overflow-wrap """ keyword = overflow_wrap(tokens) diff --git a/weasyprint/css/validation/properties.py b/weasyprint/css/validation/properties.py index 7ebea699..fae8c18b 100644 --- a/weasyprint/css/validation/properties.py +++ b/weasyprint/css/validation/properties.py @@ -1,6 +1,6 @@ """Validate properties. -See http://www.w3.org/TR/CSS21/propidx.html and various CSS3 modules. +See https://www.w3.org/TR/CSS21/propidx.html and various CSS3 modules. """ @@ -1268,7 +1268,7 @@ def image_rendering(keyword): def size(tokens): """``size`` property validation. - See http://www.w3.org/TR/css3-page/#page-size-prop + See https://www.w3.org/TR/css-page-3/#page-size-prop """ lengths = [get_length(token, negative=False) for token in tokens] diff --git a/weasyprint/document.py b/weasyprint/document.py index b707a0a2..9f758034 100644 --- a/weasyprint/document.py +++ b/weasyprint/document.py @@ -130,13 +130,13 @@ class DocumentMetadata: self.generator = generator #: The creation date of the document, as a string or :obj:`None`. #: Dates are in one of the six formats specified in - #: `W3C’s profile of ISO 8601 `_. + #: `W3C’s profile of ISO 8601 `_. #: Extracted from the ```` element in HTML #: and written to the ``/CreationDate`` info field in PDF. self.created = created #: The modification date of the document, as a string or :obj:`None`. #: Dates are in one of the six formats specified in - #: `W3C’s profile of ISO 8601 `_. + #: `W3C’s profile of ISO 8601 `_. #: Extracted from the ```` element in HTML #: and written to the ``/ModDate`` info field in PDF. self.modified = modified diff --git a/weasyprint/draw.py b/weasyprint/draw.py index 32fd2194..81866d91 100644 --- a/weasyprint/draw.py +++ b/weasyprint/draw.py @@ -78,7 +78,7 @@ def draw_box_background_and_border(stream, page, box): def draw_stacking_context(stream, stacking_context): """Draw a ``stacking_context`` on ``stream``.""" - # See http://www.w3.org/TR/CSS2/zindex.html + # See https://www.w3.org/TR/CSS2/zindex.html with stacked(stream): box = stacking_context.box @@ -267,7 +267,7 @@ def draw_background(stream, bg, clip_box=True, bleed=None, marks=()): svg = f''' + xmlns="https://www.w3.org/2000/svg"> ''' if 'crop' in marks: svg += f''' @@ -520,7 +520,7 @@ def clip_border_segment(stream, style, width, side, border_box, pi" Quart. J. Pure. Appl. Math., vol. 45 (1913-1914), pp. 350-372], wonderfully explained by Dr Rob. - http://mathforum.org/dr.math/faq/formulas/ + https://mathforum.org/dr.math/faq/formulas/ """ x = (a - b) / (a + b) diff --git a/weasyprint/formatting_structure/boxes.py b/weasyprint/formatting_structure/boxes.py index 476e1994..5b9a7d6a 100644 --- a/weasyprint/formatting_structure/boxes.py +++ b/weasyprint/formatting_structure/boxes.py @@ -1,12 +1,12 @@ """Classes for all types of boxes in the CSS formatting structure / box model. -See http://www.w3.org/TR/CSS21/visuren.html +See https://www.w3.org/TR/CSS21/visuren.html Names are the same as in CSS 2.1 with the exception of ``TextBox``. In WeasyPrint, any text is in a ``TextBox``. What CSS calls anonymous inline boxes are text boxes but not all text boxes are anonymous inline boxes. -See http://www.w3.org/TR/CSS21/visuren.html#anonymous +See https://www.w3.org/TR/CSS21/visuren.html#anonymous Abstract classes, should not be instantiated: @@ -56,7 +56,7 @@ from ..css import computed_from_cascaded class Box: """Abstract base class for all boxes.""" # Definitions for the rules generating anonymous table boxes - # http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes + # https://www.w3.org/TR/CSS21/tables.html#anonymous-boxes proper_table_child = False internal_table_or_caption = False tabular_container = False @@ -190,7 +190,7 @@ class Box: def hit_area(self): """Return the (x, y, w, h) rectangle where the box is clickable.""" # "Border area. That's the area that hit-testing is done on." - # http://lists.w3.org/Archives/Public/www-style/2012Jun/0318.html + # https://lists.w3.org/Archives/Public/www-style/2012Jun/0318.html # TODO: manage the border radii, use outer_border_radii instead return (self.border_box_x(), self.border_box_y(), self.border_width(), self.border_height()) @@ -222,7 +222,7 @@ class Box: height = self.border_height() - bt - bb # Fix overlapping curves - # See http://www.w3.org/TR/css3-background/#corner-overlap + # See https://www.w3.org/TR/css-backgrounds-3/#corner-overlap ratio = min([1] + [ extent / sum_radii for extent, sum_radii in [ @@ -536,7 +536,7 @@ class InlineReplacedBox(ReplacedBox, AtomicInlineLevelBox): class TableBox(BlockLevelBox, ParentBox): """Box for elements with ``display: table``""" # Definitions for the rules generating anonymous table boxes - # http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes + # https://www.w3.org/TR/CSS21/tables.html#anonymous-boxes tabular_container = True def all_children(self): diff --git a/weasyprint/formatting_structure/build.py b/weasyprint/formatting_structure/build.py index 6137dd6b..8eab60ec 100644 --- a/weasyprint/formatting_structure/build.py +++ b/weasyprint/formatting_structure/build.py @@ -38,7 +38,7 @@ BOX_TYPE_FROM_DISPLAY = { ('table-caption',): boxes.TableCaptionBox, } -# http://stackoverflow.com/questions/16317534/ +# https://stackoverflow.com/questions/16317534/ ASCII_TO_WIDE = {i: chr(i + 0xfee0) for i in range(0x21, 0x7f)} ASCII_TO_WIDE.update({0x20: '\u3000', 0x2D: '\u2212'}) @@ -115,7 +115,7 @@ def element_to_box(element, style_for, get_image_from_uri, base_url, ] ``TextBox``es are anonymous inline boxes: - See http://www.w3.org/TR/CSS21/visuren.html#anonymous + See https://www.w3.org/TR/CSS21/visuren.html#anonymous """ if not isinstance(element.tag, str): @@ -700,7 +700,7 @@ def update_counters(state, style): # 'auto' is the initial value but is not valid in stylesheet: # there was no counter-increment declaration for this element. # (Or the winning value was 'initial'.) - # http://dev.w3.org/csswg/css3-lists/#declaring-a-list-item + # https://drafts.csswg.org/css-lists-3/#declaring-a-list-item if 'list-item' in style['display']: counter_increment = [('list-item', 1)] else: @@ -762,7 +762,7 @@ def anonymous_table_boxes(box): Take and return a ``Box`` object. - See http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes + See https://www.w3.org/TR/CSS21/tables.html#anonymous-boxes """ if not isinstance(box, boxes.ParentBox) or box.is_running(): @@ -799,7 +799,7 @@ def table_boxes_children(box, children): # TODO: Maybe only remove text if internal is also # a proper table descendant of box. # This is what the spec says, but maybe not what browsers do: - # http://lists.w3.org/Archives/Public/www-style/2011Oct/0567 + # https://lists.w3.org/Archives/Public/www-style/2011Oct/0567 # Last child internal, text = children[-2:] @@ -875,8 +875,8 @@ def wrap_table(box, children): Because of colspan/rowspan works, grid_y is implicitly the index of a row, but grid_x is an explicit attribute on cells, columns and column group. - http://www.w3.org/TR/CSS21/tables.html#model - http://www.w3.org/TR/CSS21/tables.html#table-layout + https://www.w3.org/TR/CSS21/tables.html#model + https://www.w3.org/TR/CSS21/tables.html#table-layout """ # Group table children by type @@ -937,7 +937,7 @@ def wrap_table(box, children): # Assign a (x,y) position in the grid to each cell. # rowspan can not extend beyond a row group, so each row group # is independent. - # http://www.w3.org/TR/CSS21/tables.html#table-layout + # https://www.w3.org/TR/CSS21/tables.html#table-layout # Column 0 is on the left if direction is ltr, right if rtl. # This algorithm does not change. grid_height = 0 @@ -955,7 +955,7 @@ def wrap_table(box, children): grid_x += 1 cell.grid_x = grid_x new_grid_x = grid_x + cell.colspan - # http://www.w3.org/TR/html401/struct/tables.html#adef-rowspan + # https://www.w3.org/TR/html401/struct/tables.html#adef-rowspan if cell.rowspan != 1: max_rowspan = len(occupied_cells_by_row) + 1 if cell.rowspan == 0: @@ -1030,7 +1030,7 @@ def collapse_table_borders(table, grid_width, grid_height): width = box_style[f'border_{side}_width'] color = get_color(box_style, f'border_{side}_color') - # http://www.w3.org/TR/CSS21/tables.html#border-conflict-resolution + # https://www.w3.org/TR/CSS21/tables.html#border-conflict-resolution score = ((1 if style == 'hidden' else 0), width, style_scores[style]) style = style_map.get(style, style) @@ -1051,7 +1051,7 @@ def collapse_table_borders(table, grid_width, grid_height): # The order is important here: # "A style set on a cell wins over one on a row, which wins over a # row group, column, column group and, lastly, table" - # See http://www.w3.org/TR/CSS21/tables.html#border-conflict-resolution + # See https://www.w3.org/TR/CSS21/tables.html#border-conflict-resolution strong_null_border = ( (1, 0, style_scores['hidden']), ('hidden', 0, TRANSPARENT)) grid_y = 0 @@ -1142,7 +1142,7 @@ def collapse_table_borders(table, grid_width, grid_height): x=0, y=grid_height, w=grid_width)) # "UAs must compute an initial left and right border width for the table # by examining the first and last cells in the first row of the table." - # http://www.w3.org/TR/CSS21/tables.html#collapsing-borders + # https://www.w3.org/TR/CSS21/tables.html#collapsing-borders # ... so h=1, not grid_height: set_transparent_border(table, 'left', max_vertical_width( x=0, y=0, h=1)) @@ -1157,7 +1157,7 @@ def flex_boxes(box): Take and return a ``Box`` object. - See http://www.w3.org/TR/css-flexbox-1/#flex-items + See https://www.w3.org/TR/css-flexbox-1/#flex-items """ if not isinstance(box, boxes.ParentBox) or box.is_running(): @@ -1194,8 +1194,8 @@ def flex_children(box, children): def process_whitespace(box, following_collapsible_space=False): """First part of "The 'white-space' processing model". - See http://www.w3.org/TR/CSS21/text.html#white-space-model - http://dev.w3.org/csswg/css3-text/#white-space-rules + See https://www.w3.org/TR/CSS21/text.html#white-space-model + https://drafts.csswg.org/css-text-3/#white-space-rules """ if isinstance(box, boxes.TextBox): @@ -1218,7 +1218,7 @@ def process_whitespace(box, following_collapsible_space=False): # TODO: this should be language-specific # Could also replace with a zero width space character (U+200B), # or no character - # CSS3: http://www.w3.org/TR/css3-text/#line-break-transform + # CSS3: https://www.w3.org/TR/css-text-3/#overflow-wrap text = text.replace('\n', ' ') if space_collapse: @@ -1274,7 +1274,7 @@ def inline_in_block(box): This line box will be broken into multiple lines later. This is the first case in - http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level + https://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level Eg.:: @@ -1385,7 +1385,7 @@ def block_in_inline(box): in an anonymous block-level box. This is the second case in - http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level + https://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level Eg. if this is given:: @@ -1539,7 +1539,7 @@ def set_viewport_overflow(root_box): Like backgrounds, ``overflow`` on the root element must be propagated to the viewport. - See http://www.w3.org/TR/CSS21/visufx.html#overflow + See https://www.w3.org/TR/CSS21/visufx.html#overflow """ chosen_box = root_box if (root_box.element_tag.lower() == 'html' and diff --git a/weasyprint/html.py b/weasyprint/html.py index 396359d7..cedf9476 100644 --- a/weasyprint/html.py +++ b/weasyprint/html.py @@ -25,7 +25,7 @@ HTML5_UA_STYLESHEET = CSS( string=HTML5_UA, counter_style=HTML5_UA_COUNTER_STYLE) HTML5_PH_STYLESHEET = CSS(string=HTML5_PH) -# http://whatwg.org/C#space-character +# https://html.spec.whatwg.org/multipage/#space-character HTML_WHITESPACE = ' \t\n\f\r' HTML_SPACE_SEPARATED_TOKENS_RE = re.compile(f'[^{HTML_WHITESPACE}]+') @@ -37,7 +37,7 @@ def ascii_lower(string): :returns: A new Unicode string. This is used for `ASCII case-insensitive - `_ matching. + `_ matching. This is different from the :meth:`str.lower` method of Unicode strings which also affect non-ASCII characters, @@ -114,7 +114,7 @@ def handle_img(element, box, get_image_from_uri, base_url): Return either an image or the alt-text. - See: http://www.w3.org/TR/html5/embedded-content-1.html#the-img-element + See: https://www.w3.org/TR/html5/embedded-content-1.html#the-img-element """ src = get_url_attribute(element, 'src', base_url) @@ -194,7 +194,7 @@ def handle_col(element, box, _get_image_from_uri, _base_url): """Handle the ``span`` attribute.""" if isinstance(box, boxes.TableColumnBox) and box.span > 1: # Generate multiple boxes - # http://lists.w3.org/Archives/Public/www-style/2011Nov/0293.html + # https://lists.w3.org/Archives/Public/www-style/2011Nov/0293.html return [box.copy() for _i in range(box.span)] return [box] @@ -205,9 +205,9 @@ def handle_td(element, box, _get_image_from_uri, _base_url): """Handle the ``colspan``, ``rowspan`` attributes.""" if isinstance(box, boxes.TableCellBox): # HTML 4.01 gives special meaning to colspan=0 - # http://www.w3.org/TR/html401/struct/tables.html#adef-rowspan + # https://www.w3.org/TR/html401/struct/tables.html#adef-rowspan # but HTML 5 removed it - # http://www.w3.org/TR/html5/tabular-data.html#attr-tdth-colspan + # https://html.spec.whatwg.org/multipage/tables.html#attr-tdth-colspan # rowspan=0 is still there though. try: box.colspan = max(int(element.get('colspan', '').strip()), 1) @@ -252,10 +252,10 @@ def get_html_metadata(html): Relevant specs: - http://www.whatwg.org/html#the-title-element - http://www.whatwg.org/html#standard-metadata-names - http://wiki.whatwg.org/wiki/MetaExtensions - http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions + https://www.whatwg.org/html#the-title-element + https://www.whatwg.org/html#standard-metadata-names + https://wiki.whatwg.org/wiki/MetaExtensions + https://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions """ title = None @@ -312,8 +312,8 @@ def strip_whitespace(string): """Use the HTML definition of "space character", not all Unicode Whitespace. - http://www.whatwg.org/html#strip-leading-and-trailing-whitespace - http://www.whatwg.org/html#space-character + https://www.whatwg.org/html#strip-leading-and-trailing-whitespace + https://www.whatwg.org/html#space-character """ return string.strip(HTML_WHITESPACE) diff --git a/weasyprint/images.py b/weasyprint/images.py index 265381d5..17be5e87 100644 --- a/weasyprint/images.py +++ b/weasyprint/images.py @@ -148,7 +148,7 @@ def process_color_stops(vector_length, positions): ``positions`` is a list of ``None``, or ``Dimension`` in px or %. 0 is the starting point, 1 the ending point. - See http://dev.w3.org/csswg/css-images-3/#color-stop-syntax. + See https://drafts.csswg.org/css-images-3/#color-stop-syntax. Return processed color stops, as a list of floats in px. @@ -205,7 +205,7 @@ def normalize_stop_positions(positions): def gradient_average_color(colors, positions): """ - http://dev.w3.org/csswg/css-images-3/#gradient-average-color + https://drafts.csswg.org/css-images-3/#gradient-average-color """ nb_stops = len(positions) assert nb_stops > 1 diff --git a/weasyprint/layout/__init__.py b/weasyprint/layout/__init__.py index 31b84504..d9774b16 100644 --- a/weasyprint/layout/__init__.py +++ b/weasyprint/layout/__init__.py @@ -6,7 +6,7 @@ box fragement. Boxes in the new tree have *used values* in their ``position_x``, ``position_y``, ``width`` and ``height`` attributes, amongst others. -See http://www.w3.org/TR/CSS21/cascade.html#used-value +See https://www.w3.org/TR/CSS21/cascade.html#used-value """ @@ -34,7 +34,7 @@ def initialize_page_maker(context, root_box): page_break = root_box.style['break_before'] # TODO: take care of text direction and writing mode - # https://www.w3.org/TR/css3-page/#progression + # https://www.w3.org/TR/css-page-3/#progression if page_break == 'right': right_page = True elif page_break == 'left': @@ -252,7 +252,7 @@ class LayoutContext: self._excluded_shapes_lists.append(self.excluded_shapes) def finish_block_formatting_context(self, root_box): - # See http://www.w3.org/TR/CSS2/visudet.html#root-height + # See https://www.w3.org/TR/CSS2/visudet.html#root-height if root_box.style['height'] == 'auto' and self.excluded_shapes: box_bottom = root_box.content_box_y() + root_box.height max_shape_bottom = max([ @@ -285,7 +285,7 @@ class LayoutContext: 4: ['Third Header', '3.5th Header']} Value depends on current page. - http://dev.w3.org/csswg/css-gcpm/#funcdef-string + https://drafts.csswg.org/css-gcpm/#funcdef-string :param store: dictionary where the resolved value is stored. :param page: current page. diff --git a/weasyprint/layout/absolute.py b/weasyprint/layout/absolute.py index bbee5463..f7d82e03 100644 --- a/weasyprint/layout/absolute.py +++ b/weasyprint/layout/absolute.py @@ -48,7 +48,7 @@ class AbsolutePlaceholder: @handle_min_max_width def absolute_width(box, context, cb_x, cb_y, cb_width, cb_height): - # http://www.w3.org/TR/CSS2/visudet.html#abs-replaced-width + # https://www.w3.org/TR/CSS2/visudet.html#abs-replaced-width ltr = ( box.style.parent_style is None or box.style.parent_style['direction'] == 'ltr') @@ -122,7 +122,7 @@ def absolute_width(box, context, cb_x, cb_y, cb_width, cb_height): def absolute_height(box, context, cb_x, cb_y, cb_width, cb_height): - # http://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height + # https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height paddings_borders = ( box.padding_top + box.padding_bottom + box.border_top_width + box.border_bottom_width) @@ -235,7 +235,7 @@ def absolute_layout(context, placeholder, containing_block, fixed_boxes, def absolute_box_layout(context, box, containing_block, fixed_boxes, bottom_space, skip_stack): # TODO: handle inline boxes (point 10.1.4.1) - # http://www.w3.org/TR/CSS2/visudet.html#containing-block-details + # https://www.w3.org/TR/CSS2/visudet.html#containing-block-details if isinstance(containing_block, boxes.PageBox): cb_x = containing_block.content_box_x() cb_y = containing_block.content_box_y() @@ -271,7 +271,7 @@ def absolute_replaced(context, box, cb_x, cb_y, cb_width, cb_height): box.style.parent_style is None or box.style.parent_style['direction'] == 'ltr') - # http://www.w3.org/TR/CSS21/visudet.html#abs-replaced-width + # https://www.w3.org/TR/CSS21/visudet.html#abs-replaced-width if box.left == box.right == 'auto': # static position: if ltr: @@ -307,7 +307,7 @@ def absolute_replaced(context, box, cb_x, cb_y, cb_width, cb_height): else: box.left = cb_width - (box.margin_width() + box.right) - # http://www.w3.org/TR/CSS21/visudet.html#abs-replaced-height + # https://www.w3.org/TR/CSS21/visudet.html#abs-replaced-height if box.top == box.bottom == 'auto': box.top = box.position_y - cb_y if 'auto' in (box.top, box.bottom): diff --git a/weasyprint/layout/block.py b/weasyprint/layout/block.py index 7db73b41..b3406f29 100644 --- a/weasyprint/layout/block.py +++ b/weasyprint/layout/block.py @@ -119,7 +119,7 @@ def block_box_layout(context, box, bottom_space, skip_stack, new_box = result[0] if new_box and new_box.is_table_wrapper: # Don't collide with floats - # http://www.w3.org/TR/CSS21/visuren.html#floats + # https://www.w3.org/TR/CSS21/visuren.html#floats position_x, position_y, _ = avoid_collisions( context, new_box, containing_block, outer=False) new_box.translate( @@ -139,7 +139,7 @@ def block_level_width(box, containing_block): # TODO: what is the real text direction? direction = 'ltr' - # http://www.w3.org/TR/CSS21/visudet.html#blockwidth + # https://www.w3.org/TR/CSS21/visudet.html#blockwidth # These names are waaay too long margin_l = box.margin_left @@ -345,7 +345,7 @@ def _linebox_layout(context, box, index, child, new_children, page_is_empty, break # TODO: this is incomplete. - # See http://dev.w3.org/csswg/css3-page/#allowed-pg-brk + # See https://drafts.csswg.org/css-page-3/#allowed-pg-brk # "When an unforced page break occurs here, both the adjoining # ‘margin-top’ and ‘margin-bottom’ are set to zero." # See https://github.com/Kozea/WeasyPrint/issues/115 @@ -765,7 +765,7 @@ def block_container_layout(context, box, bottom_space, skip_stack, start=not is_start, end=box_is_fragmented and not discard) # TODO: See corner cases in - # http://www.w3.org/TR/CSS21/visudet.html#normal-block + # https://www.w3.org/TR/CSS21/visudet.html#normal-block # TODO: See float.float_layout if new_box.height == 'auto': if context.excluded_shapes and new_box.style['overflow'] != 'visible': @@ -824,7 +824,7 @@ def collapse_margin(adjoining_margins): def establishes_formatting_context(box): """Return whether a box establishes a block formatting context. - See http://www.w3.org/TR/CSS2/visuren.html#block-formatting + See https://www.w3.org/TR/CSS2/visuren.html#block-formatting """ return ( diff --git a/weasyprint/layout/column.py b/weasyprint/layout/column.py index f8635010..4a0738bf 100644 --- a/weasyprint/layout/column.py +++ b/weasyprint/layout/column.py @@ -15,7 +15,7 @@ def columns_layout(context, box, bottom_space, skip_stack, containing_block, collapse_margin) # Implementation of the multi-column pseudo-algorithm: - # https://www.w3.org/TR/css3-multicol/#pseudo-algorithm + # https://www.w3.org/TR/css-multicol-1/#pseudo-algorithm width = None style = box.style original_bottom_space = bottom_space diff --git a/weasyprint/layout/float.py b/weasyprint/layout/float.py index e9441746..daff903a 100644 --- a/weasyprint/layout/float.py +++ b/weasyprint/layout/float.py @@ -26,7 +26,7 @@ def float_layout(context, box, containing_block, absolute_boxes, fixed_boxes, resolve_percentages(box, (cb_width, cb_height)) # TODO: This is only handled later in blocks.block_container_layout - # http://www.w3.org/TR/CSS21/visudet.html#normal-block + # https://www.w3.org/TR/CSS21/visudet.html#normal-block if cb_height == 'auto': cb_height = ( containing_block.position_y - containing_block.content_box_y()) @@ -81,7 +81,7 @@ def float_layout(context, box, containing_block, absolute_boxes, fixed_boxes, def find_float_position(context, box, containing_block): """Get the right position of the float ``box``.""" - # See http://www.w3.org/TR/CSS2/visuren.html#float-position + # See https://www.w3.org/TR/CSS2/visuren.html#float-position # Point 4 is already handled as box.position_y is set according to the # containing box top position, with collapsing margins handled diff --git a/weasyprint/layout/inline.py b/weasyprint/layout/inline.py index 4f8e6211..b6171543 100644 --- a/weasyprint/layout/inline.py +++ b/weasyprint/layout/inline.py @@ -180,7 +180,7 @@ def get_next_linebox(context, linebox, position_y, bottom_space, skip_stack, def skip_first_whitespace(box, skip_stack): """Return ``skip_stack`` to start just after removable leading spaces. - See http://www.w3.org/TR/CSS21/text.html#white-space-model + See https://www.w3.org/TR/CSS21/text.html#white-space-model """ if skip_stack is None: @@ -382,12 +382,12 @@ def inline_block_box_layout(context, box, position_x, skip_stack, resolve_percentages(box, containing_block) - # http://www.w3.org/TR/CSS21/visudet.html#inlineblock-width + # https://www.w3.org/TR/CSS21/visudet.html#inlineblock-width if box.margin_left == 'auto': box.margin_left = 0 if box.margin_right == 'auto': box.margin_right = 0 - # http://www.w3.org/TR/CSS21/visudet.html#block-root-margin + # https://www.w3.org/TR/CSS21/visudet.html#block-root-margin if box.margin_top == 'auto': box.margin_top = 0 if box.margin_bottom == 'auto': @@ -411,7 +411,7 @@ def inline_block_baseline(box): Position is taken from the top of its margin box. - http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align + https://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align """ if box.is_table_wrapper: @@ -897,7 +897,7 @@ def split_text_box(context, box, available_width, skip, is_line_start=True): box.pango_layout = layout # "The height of the content area should be based on the font, # but this specification does not specify how." - # http://www.w3.org/TR/CSS21/visudet.html#inline-non-replaced + # https://www.w3.org/TR/CSS21/visudet.html#inline-non-replaced # We trust Pango and use the height of the LayoutLine. box.height = height # "only the 'line-height' is used when calculating the height @@ -920,7 +920,7 @@ def split_text_box(context, box, available_width, skip, is_line_start=True): preserved_line_break = ( (length != resume_index) and between.strip(' ')) if preserved_line_break: - # See http://unicode.org/reports/tr14/ + # See https://unicode.org/reports/tr14/ # \r is already handled by process_whitespace line_breaks = ('\n', '\t', '\f', '\u0085', '\u2028', '\u2029') assert between in line_breaks, ( @@ -1159,7 +1159,7 @@ def add_word_spacing(context, box, justification_spacing, x_advance): def is_phantom_linebox(linebox): - # See http://www.w3.org/TR/CSS21/visuren.html#phantom-line-box + # See https://www.w3.org/TR/CSS21/visuren.html#phantom-line-box for child in linebox.children: if isinstance(child, boxes.InlineBox): if not is_phantom_linebox(child): diff --git a/weasyprint/layout/page.py b/weasyprint/layout/page.py index ea92fdb3..054364e1 100644 --- a/weasyprint/layout/page.py +++ b/weasyprint/layout/page.py @@ -102,9 +102,9 @@ class HorizontalBox(OrientedBox): def compute_fixed_dimension(context, box, outer, vertical, top_or_left): - """ - Compute and set a margin box fixed dimension on ``box``, as described in: - http://dev.w3.org/csswg/css3-page/#margin-constraints + """Compute and set a margin box fixed dimension on ``box``. + + Described in: https://drafts.csswg.org/css-page-3/#margin-constraints :param box: The margin box to work on @@ -134,7 +134,7 @@ def compute_fixed_dimension(context, box, outer, vertical, top_or_left): # XXX this is not in the spec, but without it box.inner # would end up with a negative value. # Instead, this will trigger rule 3 below. - # http://lists.w3.org/Archives/Public/www-style/2012Jul/0006.html + # https://lists.w3.org/Archives/Public/www-style/2012Jul/0006.html box.inner = 0 # Rule 3 if 'auto' not in [box.margin_a, box.margin_b, box.inner]: @@ -175,7 +175,7 @@ def compute_fixed_dimension(context, box, outer, vertical, top_or_left): def compute_variable_dimension(context, side_boxes, vertical, outer_sum): """ Compute and set a margin box fixed dimension on ``box``, as described in: - http://dev.w3.org/csswg/css3-page/#margin-dimension + https://drafts.csswg.org/css-page-3/#margin-dimension :param side_boxes: Three boxes on a same side (as opposed to a corner.) A list of: @@ -359,7 +359,7 @@ def make_margin_boxes(context, page, state): page_end_y = margin_top + max_box_height # Margin box dimensions, described in - # http://dev.w3.org/csswg/css3-page/#margin-box-dimensions + # https://drafts.csswg.org/css-page-3/#margin-box-dimensions generated_boxes = [] for prefix, vertical, containing_block, position_x, position_y in [ @@ -468,8 +468,8 @@ def page_width_or_height(box, containing_block_size): over-constrained, instead of ignoring any margins, the containing block is resized to coincide with the margin edges of the page box." - http://dev.w3.org/csswg/css3-page/#page-box-page-rule - http://www.w3.org/TR/CSS21/visudet.html#blockwidth + https://drafts.csswg.org/css-page-3/#page-box-page-rule + https://www.w3.org/TR/CSS21/visudet.html#blockwidth """ remaining = containing_block_size - box.padding_plus_border @@ -543,7 +543,7 @@ def make_page(context, root_box, page_type, resume_at, page_number, root_box = root_box.copy_with_children([]) # TODO: handle cases where the root element is something else. - # See http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo + # See https://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo assert isinstance(root_box, (boxes.BlockBox, boxes.FlexContainerBox)) context.create_block_formatting_context() context.current_page = page_number @@ -721,7 +721,7 @@ def set_page_type_computed_styles(page_type, html, style_for): style_for.set_computed_styles( page_type, # @page inherits from the root element: - # http://lists.w3.org/Archives/Public/www-style/2012Jan/1164.html + # https://lists.w3.org/Archives/Public/www-style/2012Jan/1164.html root=html.etree_element, parent=html.etree_element, base_url=html.base_url) diff --git a/weasyprint/layout/preferred.py b/weasyprint/layout/preferred.py index 87ec0d5e..4fb355c2 100644 --- a/weasyprint/layout/preferred.py +++ b/weasyprint/layout/preferred.py @@ -4,7 +4,7 @@ Also known as max-content and min-content width, also known as the shrink-to-fit algorithm. Terms used (max-content width, min-content width) are defined in David -Baron's unofficial draft (http://dbaron.org/css/intrinsic/). +Baron's unofficial draft (https://dbaron.org/css/intrinsic/). """ @@ -22,7 +22,7 @@ def shrink_to_fit(context, box, available_content_width): *Warning:* both available_content_width and the return value are for width of the *content area*, not margin area. - http://www.w3.org/TR/CSS21/visudet.html#float-width + https://www.w3.org/TR/CSS21/visudet.html#float-width """ return min( @@ -92,7 +92,7 @@ def _block_content_width(context, box, function, outer): if width == 'auto' or width.unit == '%': # "percentages on the following properties are treated instead as # though they were the following: width: auto" - # http://dbaron.org/css/intrinsic/#outer-intrinsic + # https://dbaron.org/css/intrinsic/#outer-intrinsic children_widths = [ function(context, child, outer=True) for child in box.children if not child.is_absolutely_positioned()] @@ -313,11 +313,11 @@ def inline_line_widths(context, box, outer, is_line_start, minimum, current_line += lines[0] break else: - # http://www.w3.org/TR/css3-text/#line-break-details + # https://www.w3.org/TR/css-text-3/#overflow-wrap # "The line breaking behavior of a replaced element # or other atomic inline is equivalent to that # of the Object Replacement Character (U+FFFC)." - # http://www.unicode.org/reports/tr14/#DescriptionOfProperties + # https://www.unicode.org/reports/tr14/#DescriptionOfProperties # "By default, there is a break opportunity # both before and after any inline object." if minimum: @@ -342,7 +342,7 @@ def inline_line_widths(context, box, outer, is_line_start, minimum, def _percentage_contribution(box): """Return the percentage contribution of a cell, column or column group. - http://dbaron.org/css/intrinsic/#pct-contrib + https://dbaron.org/css/intrinsic/#pct-contrib """ min_width = ( @@ -366,7 +366,7 @@ def table_and_columns_preferred_widths(context, box, outer=True): column_intrinsic_percentages, constrainedness, total_horizontal_border_spacing, grid)`` - http://dbaron.org/css/intrinsic/ + https://dbaron.org/css/intrinsic/ """ from .table import distribute_excess_width @@ -586,7 +586,7 @@ def table_and_columns_preferred_widths(context, box, outer=True): # infinitely large number if the numerator is nonzero [and] the # denominator of that ratio is 0." # - # http://dbaron.org/css/intrinsic/#autotableintrinsic + # https://dbaron.org/css/intrinsic/#autotableintrinsic # # Please note that "an infinitely large number" is not "infinite", # and that's probably not a coincindence: putting 'inf' here breaks @@ -607,7 +607,7 @@ def table_and_columns_preferred_widths(context, box, outer=True): if table.style['width'] != 'auto' and table.style['width'].unit == 'px': # "percentages on the following properties are treated instead as # though they were the following: width: auto" - # http://dbaron.org/css/intrinsic/#outer-intrinsic + # https://dbaron.org/css/intrinsic/#outer-intrinsic table_min_width = table_max_width = table.style['width'].value else: table_min_width = table_min_content_width diff --git a/weasyprint/layout/replaced.py b/weasyprint/layout/replaced.py index 600a19a3..c66edc31 100644 --- a/weasyprint/layout/replaced.py +++ b/weasyprint/layout/replaced.py @@ -1,6 +1,6 @@ """Layout for images and other replaced elements. -See http://dev.w3.org/csswg/css-images-3/#sizing +See https://drafts.csswg.org/css-images-3/#sizing """ @@ -15,7 +15,7 @@ def default_image_sizing(intrinsic_width, intrinsic_height, intrinsic_ratio, Return a ``(concrete_width, concrete_height)`` tuple. - See http://dev.w3.org/csswg/css-images-3/#default-sizing + See https://drafts.csswg.org/css-images-3/#default-sizing """ if specified_width == 'auto': @@ -53,7 +53,7 @@ def contain_constraint_image_sizing(constraint_width, constraint_height, Return a ``(concrete_width, concrete_height)`` tuple. - See http://dev.w3.org/csswg/css-images-3/#contain-constraint + See https://drafts.csswg.org/css-images-3/#contain-constraint """ return _constraint_image_sizing( @@ -66,7 +66,7 @@ def cover_constraint_image_sizing(constraint_width, constraint_height, Return a ``(concrete_width, concrete_height)`` tuple. - See http://dev.w3.org/csswg/css-images-3/#cover-constraint + See https://drafts.csswg.org/css-images-3/#cover-constraint """ return _constraint_image_sizing( @@ -139,7 +139,7 @@ def replaced_box_width(box, containing_block): box.style['image_resolution'], box.style['font_size']) # This algorithm simply follows the different points of the specification: - # http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width + # https://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width if box.height == 'auto' and box.width == 'auto': if width is not None: # Point #1 @@ -168,7 +168,7 @@ def replaced_box_width(box, containing_block): @handle_min_max_height def replaced_box_height(box): """Compute and set the used height for replaced boxes.""" - # http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height + # https://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height width, height, ratio = box.replacement.get_intrinsic_size( box.style['image_resolution'], box.style['font_size']) @@ -282,7 +282,7 @@ def block_replaced_box_layout(context, box, containing_block): replaced_box_height(box) # Don't collide with floats - # http://www.w3.org/TR/CSS21/visuren.html#floats + # https://www.w3.org/TR/CSS21/visuren.html#floats box.position_x, box.position_y, _ = avoid_collisions( context, box, containing_block, outer=False) resume_at = None @@ -296,6 +296,6 @@ def block_replaced_box_layout(context, box, containing_block): def block_replaced_width(box, containing_block): from .block import block_level_width - # http://www.w3.org/TR/CSS21/visudet.html#block-replaced-width + # https://www.w3.org/TR/CSS21/visudet.html#block-replaced-width replaced_box_width.without_min_max(box, containing_block) block_level_width.without_min_max(box, containing_block) diff --git a/weasyprint/layout/table.py b/weasyprint/layout/table.py index 08624257..117ca69d 100644 --- a/weasyprint/layout/table.py +++ b/weasyprint/layout/table.py @@ -198,7 +198,7 @@ def table_layout(context, table, bottom_space, skip_stack, containing_block, row = row.copy_with_children(new_row_children) # Table height algorithm - # http://www.w3.org/TR/CSS21/tables.html#height-layout + # https://www.w3.org/TR/CSS21/tables.html#height-layout # cells with vertical-align: baseline baseline_cells = [] @@ -604,7 +604,7 @@ def add_top_padding(box, extra_padding): def fixed_table_layout(box): """Run the fixed table layout and return a list of column widths. - http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout + https://www.w3.org/TR/CSS21/tables.html#fixed-table-layout """ table = box.get_wrapped_table() @@ -693,7 +693,7 @@ def fixed_table_layout(box): def auto_table_layout(context, box, containing_block): """Run the auto table layout and return a list of column widths. - http://www.w3.org/TR/CSS21/tables.html#auto-table-layout + https://www.w3.org/TR/CSS21/tables.html#auto-table-layout """ table = box.get_wrapped_table() @@ -809,7 +809,7 @@ def table_wrapper_width(context, wrapper, containing_block): def cell_baseline(cell): """Return the y position of a cell baseline from the top of its border box. - See http://www.w3.org/TR/CSS21/tables.html#height-layout + See https://www.w3.org/TR/CSS21/tables.html#height-layout """ result = find_in_flow_baseline( @@ -849,7 +849,7 @@ def distribute_excess_width(context, grid, excess_width, column_widths, Return excess width left when it's impossible without breaking rules. - See http://dbaron.org/css/intrinsic/#distributetocols + See https://dbaron.org/css/intrinsic/#distributetocols """ # First group diff --git a/weasyprint/links.py b/weasyprint/links.py index 78e4e6aa..233aefbe 100644 --- a/weasyprint/links.py +++ b/weasyprint/links.py @@ -75,7 +75,7 @@ def gather_links_and_bookmarks(box, anchors, links, bookmarks, # "Transforms apply to block-level and atomic inline-level elements, # but do not apply to elements which may be split into # multiple inline-level boxes." - # http://www.w3.org/TR/css3-2d-transforms/#introduction + # https://www.w3.org/TR/css-transforms-1/#introduction if box.style['transform'] and not isinstance(box, boxes.InlineBox): border_width = box.border_width() border_height = box.border_height() diff --git a/weasyprint/pdf/pdfa.py b/weasyprint/pdf/pdfa.py index aec6b8b4..578e8d1f 100644 --- a/weasyprint/pdf/pdfa.py +++ b/weasyprint/pdf/pdfa.py @@ -11,11 +11,11 @@ from ..logger import LOGGER # XML namespaces used for metadata NS = { - 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', - 'dc': 'http://purl.org/dc/elements/1.1/', - 'xmp': 'http://ns.adobe.com/xap/1.0/', - 'pdf': 'http://ns.adobe.com/pdf/1.3/', - 'pdfaid': 'http://www.aiim.org/pdfa/ns/id/', + 'rdf': 'https://www.w3.org/1999/02/22-rdf-syntax-ns#', + 'dc': 'https://purl.org/dc/elements/1.1/', + 'xmp': 'https://ns.adobe.com/xap/1.0/', + 'pdf': 'https://ns.adobe.com/pdf/1.3/', + 'pdfaid': 'https://www.aiim.org/pdfa/ns/id/', } for key, value in NS.items(): register_namespace(key, value) diff --git a/weasyprint/stacking.py b/weasyprint/stacking.py index a47ba94c..06c0a443 100644 --- a/weasyprint/stacking.py +++ b/weasyprint/stacking.py @@ -11,8 +11,8 @@ _Z_INDEX_GETTER = operator.attrgetter('z_index') class StackingContext: """Stacking contexts define the paint order of all pieces of a document. - http://www.w3.org/TR/CSS21/visuren.html#x43 - http://www.w3.org/TR/CSS21/zindex.html + https://www.w3.org/TR/CSS21/visuren.html#x43 + https://www.w3.org/TR/CSS21/zindex.html """ def __init__(self, box, child_contexts, blocks, floats, blocks_and_cells, diff --git a/weasyprint/svg/css.py b/weasyprint/svg/css.py index e75e2314..6a4c1800 100644 --- a/weasyprint/svg/css.py +++ b/weasyprint/svg/css.py @@ -58,7 +58,7 @@ def parse_stylesheets(tree, url): # TODO: support contentStyleType on stylesheets = [] for element in tree.etree_element.iter(): - # http://www.w3.org/TR/SVG/styling.html#StyleElement + # https://www.w3.org/TR/SVG/styling.html#StyleElement if (element.tag == '{http://www.w3.org/2000/svg}style' and element.get('type', 'text/css') == 'text/css' and element.text): diff --git a/weasyprint/svg/defs.py b/weasyprint/svg/defs.py index c98e682a..3dd13e7b 100644 --- a/weasyprint/svg/defs.py +++ b/weasyprint/svg/defs.py @@ -48,7 +48,7 @@ def use(svg, node, font_size): if tree.tag in ('svg', 'symbol'): # Explicitely specified - # http://www.w3.org/TR/SVG11/struct.html#UseElement + # https://www.w3.org/TR/SVG11/struct.html#UseElement tree._etree_node.tag = 'svg' if 'width' in node.attrib and 'height' in node.attrib: tree.attrib['width'] = node.attrib['width'] diff --git a/weasyprint/svg/shapes.py b/weasyprint/svg/shapes.py index 56558ab2..c1411779 100644 --- a/weasyprint/svg/shapes.py +++ b/weasyprint/svg/shapes.py @@ -68,7 +68,7 @@ def rect(svg, node, font_size): ry = height / 2 # Inspired by Cairo Cookbook - # http://cairographics.org/cookbook/roundedrectangles/ + # https://cairographics.org/cookbook/roundedrectangles/ ARC_TO_BEZIER = 4 * (2 ** .5 - 1) / 3 c1, c2 = ARC_TO_BEZIER * rx, ARC_TO_BEZIER * ry diff --git a/weasyprint/urls.py b/weasyprint/urls.py index 51a277c1..b599468f 100644 --- a/weasyprint/urls.py +++ b/weasyprint/urls.py @@ -15,9 +15,9 @@ from urllib.request import Request, pathname2url, urlopen from . import __version__ from .logger import LOGGER -# See http://stackoverflow.com/a/11687993/1162888 +# See https://stackoverflow.com/a/11687993/1162888 # Both are needed in Python 3 as the re module does not like to mix -# http://tools.ietf.org/html/rfc3986#section-3.1 +# https://datatracker.ietf.org/doc/html/rfc3986#section-3.1 UNICODE_SCHEME_RE = re.compile('^([a-zA-Z][a-zA-Z0-9.+-]+):') BYTES_SCHEME_RE = re.compile(b'^([a-zA-Z][a-zA-Z0-9.+-]+):')