mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-09-11 12:46:15 +03:00
Update and fix URLs in comments and documentation
This commit is contained in:
parent
95f4bda002
commit
5d9e5f7040
@ -85,7 +85,7 @@ HTTP redirects but more advanced features like cookies and authentication
|
||||
are currently not supported, although a custom :ref:`URL fetcher
|
||||
<URL Fetchers>` 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
|
||||
++++++++++++++++++++++++++++++++++++
|
||||
|
@ -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 <http://dev.w3.org/csswg/css-text/#overflow-wrap>`_
|
||||
* Add the `overflow-wrap <https://drafts.csswg.org/css-text/#overflow-wrap>`_
|
||||
property, allowing line breaks inside otherwise-unbreakable words.
|
||||
Thanks Frédérick Deslandes!
|
||||
* Add the `image-resolution
|
||||
<http://dev.w3.org/csswg/css-images-3/#the-image-resolution>`_ property,
|
||||
<https://drafts.csswg.org/css-images-3/#the-image-resolution>`_ 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
|
||||
<http://packages.python.org/Flask-WeasyPrint/>`_.
|
||||
<https://packages.python.org/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 <http://dev.w3.org/csswg/css3-gcpm/#bookmarks>`_.
|
||||
for Paged Media Module <https://drafts.csswg.org/css-gcpm-3/#bookmarks>`_.
|
||||
|
||||
The default UA stylesheet sets a matching bookmark level on all ``<h1>``
|
||||
to ``<h6>`` 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
|
||||
|
@ -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).
|
||||
|
@ -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
|
||||
|
@ -18,7 +18,7 @@ def test_bounding_box_rect(assert_pixels):
|
||||
@page { size: 5px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="5px" height="5px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="5px" height="5px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -49,7 +49,7 @@ def test_bounding_box_circle(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -80,7 +80,7 @@ def test_bounding_box_ellipse(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -106,7 +106,7 @@ def test_bounding_box_line(assert_pixels):
|
||||
@page { size: 5px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="5px" height="5px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="5px" height="5px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -133,7 +133,7 @@ def test_bounding_box_polygon(assert_pixels):
|
||||
@page { size: 5px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="5px" height="5px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="5px" height="5px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -159,7 +159,7 @@ def test_bounding_box_polyline(assert_pixels):
|
||||
@page { size: 5px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="5px" height="5px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="5px" height="5px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -184,7 +184,7 @@ def test_bounding_box_text(assert_pixels):
|
||||
@page { size: 2px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="2px" height="2px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="2px" height="2px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -213,7 +213,7 @@ def test_bounding_box_path_hv(assert_pixels):
|
||||
@page { size: 5px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="5px" height="5px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="5px" height="5px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -239,7 +239,7 @@ def test_bounding_box_path_l(assert_pixels):
|
||||
@page { size: 5px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="5px" height="5px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="5px" height="5px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -266,7 +266,7 @@ def test_bounding_box_path_c(assert_pixels):
|
||||
@page { size: 5px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="5px" height="5px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="5px" height="5px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -296,7 +296,7 @@ def test_bounding_box_path_s(assert_pixels):
|
||||
@page { size: 5px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="5px" height="5px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="5px" height="5px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="1" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
|
@ -22,7 +22,7 @@ def test_clip_path(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<clipPath id="clip">
|
||||
<rect x="2" y="2" width="5" height="5" />
|
||||
@ -51,7 +51,7 @@ def test_clip_path_on_group(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<clipPath id="clip">
|
||||
<rect x="2" y="2" width="5" height="5" />
|
||||
@ -83,7 +83,7 @@ def test_clip_path_group_on_group(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<clipPath id="clip">
|
||||
<rect x="2" y="2" width="2" height="2" />
|
||||
|
@ -5,7 +5,7 @@ from base64 import b64encode
|
||||
from ...testing_utils import assert_no_logs
|
||||
|
||||
SVG = '''
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<rect id="rectangle" width="5" height="2" fill="red" />
|
||||
</defs>
|
||||
|
@ -23,7 +23,7 @@ def test_linear_gradient(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -54,7 +54,7 @@ def test_linear_gradient_userspace(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="10"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
@ -83,7 +83,7 @@ def test_linear_gradient_multicolor(assert_pixels):
|
||||
@page { size: 10px 8px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="8px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="8px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="1"
|
||||
gradientUnits="objectBoundingBox">
|
||||
@ -116,7 +116,7 @@ def test_linear_gradient_multicolor_userspace(assert_pixels):
|
||||
@page { size: 10px 8px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="8px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="8px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="8"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
@ -150,7 +150,7 @@ def test_linear_gradient_transform(assert_pixels):
|
||||
@page { size: 10px 8px}
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="8px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="8px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="1"
|
||||
gradientUnits="objectBoundingBox" gradientTransform="scale(0.5)">
|
||||
@ -191,7 +191,7 @@ def test_linear_gradient_repeat(assert_pixels):
|
||||
@page { size: 10px 16px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="11px" height="16px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="11px" height="16px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="0.5"
|
||||
gradientUnits="objectBoundingBox" spreadMethod="repeat">
|
||||
@ -233,7 +233,7 @@ def test_linear_gradient_repeat_long(assert_pixels):
|
||||
@page { size: 10px 16px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="11px" height="16px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="11px" height="16px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="0.25"
|
||||
gradientUnits="objectBoundingBox" spreadMethod="repeat">
|
||||
@ -274,7 +274,7 @@ def test_linear_gradient_reflect(assert_pixels):
|
||||
@page { size: 10px 16px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="11px" height="16px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="11px" height="16px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="0.5"
|
||||
gradientUnits="objectBoundingBox" spreadMethod="reflect">
|
||||
@ -309,7 +309,7 @@ def test_radial_gradient(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<radialGradient id="grad" cx="0.5" cy="0.5" r="0.5"
|
||||
fx="0.5" fy="0.5" fr="0.2"
|
||||
@ -341,7 +341,7 @@ def test_radial_gradient_userspace(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<radialGradient id="grad" cx="5" cy="5" r="5" fx="5" fy="5" fr="2"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
@ -372,7 +372,7 @@ def test_radial_gradient_multicolor(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<radialGradient id="grad" cx="0.5" cy="0.5" r="0.5"
|
||||
fx="0.5" fy="0.5" fr="0.2"
|
||||
@ -406,7 +406,7 @@ def test_radial_gradient_multicolor_userspace(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<radialGradient id="grad" cx="5" cy="5" r="5"
|
||||
fx="5" fy="5" fr="2"
|
||||
@ -441,7 +441,7 @@ def test_radial_gradient_repeat(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<radialGradient id="grad" cx="0.5" cy="0.5" r="0.5"
|
||||
fx="0.5" fy="0.5" fr="0.2"
|
||||
@ -476,7 +476,7 @@ def test_radial_gradient_reflect(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<radialGradient id="grad" cx="0.5" cy="0.5" r="0.5"
|
||||
fx="0.5" fy="0.5" fr="0.2"
|
||||
|
@ -18,7 +18,7 @@ def test_image_svg(assert_pixels):
|
||||
@page { size: 4px 4px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="4px" height="4px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="4px" height="4px" xmlns="https://www.w3.org/2000/svg">
|
||||
<svg x="1" y="1" width="2" height="2" viewBox="0 0 10 10">
|
||||
<rect x="5" y="5" width="5" height="5" fill="blue" />
|
||||
</svg>
|
||||
@ -38,7 +38,7 @@ def test_image_svg_viewbox(assert_pixels):
|
||||
@page { size: 4px 4px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg viewBox="0 0 4 4" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg viewBox="0 0 4 4" xmlns="https://www.w3.org/2000/svg">
|
||||
<svg x="1" y="1" width="2" height="2" viewBox="10 10 10 10">
|
||||
<rect x="15" y="15" width="5" height="5" fill="blue" />
|
||||
</svg>
|
||||
@ -63,7 +63,7 @@ def test_image_svg_align_default(assert_pixels):
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="8px" height="4px" viewBox="0 0 4 4"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
xmlns="https://www.w3.org/2000/svg">
|
||||
<rect width="4" height="4" fill="red" />
|
||||
<rect width="1" height="2" fill="blue" />
|
||||
<rect x="3" y="2" width="1" height="2" fill="lime" />
|
||||
@ -89,7 +89,7 @@ def test_image_svg_align_none(assert_pixels):
|
||||
</style>
|
||||
<svg width="8px" height="4px" viewBox="0 0 4 4"
|
||||
preserveAspectRatio="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
xmlns="https://www.w3.org/2000/svg">
|
||||
<rect width="4" height="4" fill="red" />
|
||||
<rect width="1" height="2" fill="blue" />
|
||||
<rect x="3" y="2" width="1" height="2" fill="lime" />
|
||||
@ -115,7 +115,7 @@ def test_image_svg_align_meet_x(assert_pixels):
|
||||
</style>
|
||||
<svg width="8px" height="4px" viewBox="0 0 4 4"
|
||||
preserveAspectRatio="xMaxYMax meet"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
xmlns="https://www.w3.org/2000/svg">
|
||||
<rect width="4" height="4" fill="red" />
|
||||
<rect width="1" height="2" fill="blue" />
|
||||
<rect x="3" y="2" width="1" height="2" fill="lime" />
|
||||
@ -141,7 +141,7 @@ def test_image_svg_align_meet_y(assert_pixels):
|
||||
</style>
|
||||
<svg width="4px" height="8px" viewBox="0 0 4 4"
|
||||
preserveAspectRatio="xMaxYMax meet"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
xmlns="https://www.w3.org/2000/svg">
|
||||
<rect width="4" height="4" fill="red" />
|
||||
<rect width="1" height="2" fill="blue" />
|
||||
<rect x="3" y="2" width="1" height="2" fill="lime" />
|
||||
@ -167,7 +167,7 @@ def test_image_svg_align_slice_x(assert_pixels):
|
||||
</style>
|
||||
<svg width="8px" height="4px" viewBox="0 0 4 4"
|
||||
preserveAspectRatio="xMinYMin slice"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
xmlns="https://www.w3.org/2000/svg">
|
||||
<rect width="4" height="4" fill="red" />
|
||||
<rect width="1" height="2" fill="blue" />
|
||||
<rect x="3" y="2" width="1" height="2" fill="lime" />
|
||||
@ -193,7 +193,7 @@ def test_image_svg_align_slice_y(assert_pixels):
|
||||
</style>
|
||||
<svg width="4px" height="8px" viewBox="0 0 4 4"
|
||||
preserveAspectRatio="xMinYMin slice"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
xmlns="https://www.w3.org/2000/svg">
|
||||
<rect width="4" height="4" fill="red" />
|
||||
<rect width="1" height="2" fill="blue" />
|
||||
<rect x="3" y="2" width="1" height="2" fill="lime" />
|
||||
@ -214,7 +214,7 @@ def test_image_svg_percentage(assert_pixels):
|
||||
@page { size: 4px 4px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="100%" height="100%" xmlns="https://www.w3.org/2000/svg">
|
||||
<svg x="1" y="1" width="50%" height="50%" viewBox="0 0 10 10">
|
||||
<rect x="5" y="5" width="5" height="5" fill="blue" />
|
||||
</svg>
|
||||
@ -233,7 +233,7 @@ def test_image_svg_wrong(assert_pixels):
|
||||
@page { size: 4px 4px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="4px" height="4px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="4px" height="4px" xmlns="https://www.w3.org/2000/svg">
|
||||
<That’s bad!
|
||||
</svg>
|
||||
''')
|
||||
@ -251,7 +251,7 @@ def test_image_image(assert_pixels):
|
||||
@page { size: 4px 4px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="4px" height="4px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="4px" height="4px" xmlns="https://www.w3.org/2000/svg">
|
||||
<image xlink:href="%s" />
|
||||
</svg>
|
||||
''' % path2url(resource_filename('pattern.png')))
|
||||
@ -268,7 +268,7 @@ def test_image_image_wrong(assert_pixels):
|
||||
@page { size: 4px 4px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="4px" height="4px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="4px" height="4px" xmlns="https://www.w3.org/2000/svg">
|
||||
<image xlink:href="it doesn’t exist, mouhahahaha" />
|
||||
</svg>
|
||||
''')
|
||||
|
@ -7,7 +7,7 @@ opacity_source = '''
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">%s</svg>'''
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">%s</svg>'''
|
||||
|
||||
|
||||
@assert_no_logs
|
||||
|
@ -21,7 +21,7 @@ def test_path_Hh(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 0 1 H 8 H 1"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 0 4 H 8 4"
|
||||
@ -52,7 +52,7 @@ def test_path_Vv(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 0 V 1 V 4"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 4 6 V 4 10"
|
||||
@ -83,7 +83,7 @@ def test_path_Ll(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 4 3 L 4 10"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 7 0 l 0 6"
|
||||
@ -110,7 +110,7 @@ def test_path_Zz(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 1 H 6 V 5 H 1 Z"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 9 10 V 7 H 5 V 10 z"
|
||||
@ -137,7 +137,7 @@ def test_path_Zz_fill(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 1 H 6 V 5 H 1 Z"
|
||||
stroke="blue" stroke-width="2" fill="lime"/>
|
||||
<path d="M 9 10 V 7 H 5 V 10 z"
|
||||
@ -164,7 +164,7 @@ def test_path_Cc(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 2 5 C 2 5 3 5 5 5"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 2 8 c 0 0 1 0 3 0"
|
||||
@ -191,7 +191,7 @@ def test_path_Ss(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 2 5 S 3 5 5 5"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 2 8 s 1 0 3 0"
|
||||
@ -220,7 +220,7 @@ def test_path_CcSs(assert_pixels):
|
||||
@page { size: 10px 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 2 1 C 2 1 3 1 5 1 S 8 3 8 1"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 2 4 C 2 4 3 4 5 4 s 3 2 1 0"
|
||||
@ -251,7 +251,7 @@ def test_path_Qq(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 2 5 Q 4 5 6 5"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 2 8 q 2 0 4 0"
|
||||
@ -278,7 +278,7 @@ def test_path_Tt(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 2 5 T 6 5"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 2 8 t 4 0"
|
||||
@ -307,7 +307,7 @@ def test_path_QqTt(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 0 3 Q 3 0 6 3 T 12 3"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 0 9 Q 3 6 6 9 t 6 0"
|
||||
@ -336,7 +336,7 @@ def test_path_QqTt2(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 0 3 q 3 -3 6 0 T 12 3"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 0 9 q 3 -3 6 0 t 6 0"
|
||||
@ -365,7 +365,7 @@ def test_path_Aa(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 6 A 5 5 0 0 1 6 1"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 6 11 a 5 5 0 0 1 5 -5"
|
||||
@ -394,7 +394,7 @@ def test_path_Aa2(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 6 A 5 5 0 1 0 6 1"
|
||||
stroke="lime" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -421,7 +421,7 @@ def test_path_Aa3(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 6 a 5 5 0 1 0 5 -5"
|
||||
stroke="lime" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -448,7 +448,7 @@ def test_path_Aa4(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 6 A 5 5 0 0 0 6 1"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
<path d="M 6 11 a 5 5 0 0 0 5 -5"
|
||||
@ -477,7 +477,7 @@ def test_path_Aa5(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 6 11 A 5 5 0 1 1 11 6"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -504,7 +504,7 @@ def test_path_Aa6(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 6 11 a 5 5 0 1 1 5 -5"
|
||||
stroke="blue" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -531,7 +531,7 @@ def test_path_Aa7(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 6 A 5 5 0 0 0 11 6"
|
||||
stroke="lime" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -558,7 +558,7 @@ def test_path_wrong_point(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<path d="M 1 1 L 1 5 L"
|
||||
stroke="lime" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -585,7 +585,7 @@ def test_path_markers_l(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<marker id="line"
|
||||
viewBox="0 0 1 2" refX="0.5" refY="1"
|
||||
markerUnits="strokeWidth"
|
||||
@ -619,7 +619,7 @@ def test_path_markers_hv(assert_pixels):
|
||||
@page { size: 12px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12px" height="12px" xmlns="https://www.w3.org/2000/svg">
|
||||
<marker id="line"
|
||||
viewBox="0 0 1 2" refX="0.5" refY="1"
|
||||
markerUnits="strokeWidth"
|
||||
|
@ -19,7 +19,7 @@ def test_pattern(assert_pixels):
|
||||
@page { size: 8px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="8px" height="8px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="8px" height="8px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<pattern id="pat" x="0" y="0" width="4" height="4"
|
||||
patternUnits="userSpaceOnUse"
|
||||
@ -51,7 +51,7 @@ def test_pattern_2(assert_pixels):
|
||||
@page { size: 8px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="8px" height="8px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="8px" height="8px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<pattern id="pat" x="0" y="0" width="50%" height="50%"
|
||||
patternUnits="objectBoundingBox"
|
||||
@ -83,7 +83,7 @@ def test_pattern_3(assert_pixels):
|
||||
@page { size: 8px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="8px" height="8px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="8px" height="8px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<pattern id="pat" x="0" y="0" width="4" height="4"
|
||||
patternUnits="userSpaceOnUse"
|
||||
@ -115,7 +115,7 @@ def test_pattern_4(assert_pixels):
|
||||
@page { size: 8px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="8px" height="8px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="8px" height="8px" xmlns="https://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<pattern id="pat" x="0" y="0" width="4" height="4"
|
||||
patternUnits="userSpaceOnUse"
|
||||
|
@ -20,7 +20,7 @@ def test_rect_stroke(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="5" height="5"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -44,7 +44,7 @@ def test_rect_fill(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="5" height="5" fill="red" />
|
||||
</svg>
|
||||
''')
|
||||
@ -67,7 +67,7 @@ def test_rect_stroke_fill(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="5" height="5"
|
||||
stroke-width="2" stroke="red" fill="blue" />
|
||||
</svg>
|
||||
@ -91,7 +91,7 @@ def test_rect_round(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect width="9" height="9" fill="red" rx="4" ry="4" />
|
||||
</svg>
|
||||
''')
|
||||
@ -114,7 +114,7 @@ def test_rect_round_zero(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect width="9" height="9" fill="red" rx="0" ry="4" />
|
||||
</svg>
|
||||
''')
|
||||
@ -137,7 +137,7 @@ def test_line(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<line x1="0" y1="5" x2="6" y2="5"
|
||||
stroke="red" stroke-width="2"/>
|
||||
</svg>
|
||||
@ -161,7 +161,7 @@ def test_polyline(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<polyline points="1,6, 1,2, 5,2, 5,6"
|
||||
stroke="red" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -185,7 +185,7 @@ def test_polyline_fill(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<polyline points="1,6, 1,2, 5,2, 5,6"
|
||||
stroke="red" stroke-width="2" fill="blue"/>
|
||||
</svg>
|
||||
@ -209,7 +209,7 @@ def test_polygon(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<polygon points="1,6, 1,2, 5,2, 5,6"
|
||||
stroke="red" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -233,7 +233,7 @@ def test_polygon_fill(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<polygon points="1,6, 1,2, 5,2, 5,6"
|
||||
stroke="red" stroke-width="2" fill="blue"/>
|
||||
</svg>
|
||||
@ -258,7 +258,7 @@ def test_circle_stroke(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<circle cx="5" cy="5" r="3"
|
||||
stroke="red" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -283,7 +283,7 @@ def test_circle_fill(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<circle cx="5" cy="5" r="3"
|
||||
stroke="red" stroke-width="2" fill="blue"/>
|
||||
</svg>
|
||||
@ -308,7 +308,7 @@ def test_ellipse_stroke(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<ellipse cx="5" cy="5" rx="3" ry="3"
|
||||
stroke="red" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
@ -333,7 +333,7 @@ def test_ellipse_fill(assert_pixels):
|
||||
@page { size: 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="10px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="10px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<ellipse cx="5" cy="5" rx="3" ry="3"
|
||||
stroke="red" stroke-width="2" fill="blue"/>
|
||||
</svg>
|
||||
@ -357,7 +357,7 @@ def test_rect_in_g(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<g x="5" y="5">
|
||||
<rect width="5" height="5" fill="red" />
|
||||
</g>
|
||||
@ -382,7 +382,7 @@ def test_rect_x_y_in_g(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<g x="5" y="5">
|
||||
<rect x="2" y="2" width="5" height="5" fill="red" />
|
||||
</g>
|
||||
@ -407,7 +407,7 @@ def test_rect_stroke_zero(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="5" height="5"
|
||||
stroke-width="0" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -431,7 +431,7 @@ def test_rect_width_height_zero(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="0" height="0" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="0" height="0" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="5" height="5" fill="red" />
|
||||
</svg>
|
||||
''')
|
||||
@ -454,7 +454,7 @@ def test_rect_fill_inherit(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="5" height="5" fill="inherit" />
|
||||
</svg>
|
||||
''')
|
||||
|
@ -14,7 +14,7 @@ def test_text_fill(assert_pixels):
|
||||
@page { size: 20px 2px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="2px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="2px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="0" y="1.5" font-family="weasyprint" font-size="2" fill="blue">
|
||||
ABC DEF
|
||||
</text>
|
||||
@ -35,7 +35,7 @@ def test_text_stroke(assert_pixels):
|
||||
@page { font-size: 1px; size: 20em 8ex }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="4px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="4px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="2" y="2.5" font-family="weasyprint" font-size="2"
|
||||
fill="transparent" stroke="blue" stroke-width="1ex">
|
||||
A B C
|
||||
@ -55,7 +55,7 @@ def test_text_x(assert_pixels):
|
||||
@page { size: 20px 2px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="2px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="2px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="0 4 7" y="1.5" font-family="weasyprint" font-size="2"
|
||||
fill="blue">
|
||||
ABCD
|
||||
@ -83,7 +83,7 @@ def test_text_y(assert_pixels):
|
||||
@page { size: 30px 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="30px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="30px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="0" y="9 9 4 9 4" font-family="weasyprint" font-size="5"
|
||||
fill="blue">
|
||||
ABCDEF
|
||||
@ -111,7 +111,7 @@ def test_text_xy(assert_pixels):
|
||||
@page { size: 30px 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="30px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="30px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="0 10" y="9 4 9 4" font-family="weasyprint" font-size="5"
|
||||
fill="blue">
|
||||
ABCDE
|
||||
@ -131,7 +131,7 @@ def test_text_dx(assert_pixels):
|
||||
@page { size: 20px 2px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="2px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="2px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text dx="0 2 1" y="1.5" font-family="weasyprint" font-size="2"
|
||||
fill="blue">
|
||||
ABCD
|
||||
@ -159,7 +159,7 @@ def test_text_dy(assert_pixels):
|
||||
@page { size: 30px 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="30px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="30px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="0" dy="9 0 -5 5 -5" font-family="weasyprint" font-size="5"
|
||||
fill="blue">
|
||||
ABCDEF
|
||||
@ -187,7 +187,7 @@ def test_text_dx_dy(assert_pixels):
|
||||
@page { size: 30px 10px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="30px" height="10px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="30px" height="10px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text dx="0 5" dy="9 -5 5 -5" font-family="weasyprint" font-size="5"
|
||||
fill="blue">
|
||||
ABCDE
|
||||
@ -209,7 +209,7 @@ def test_text_anchor_start(assert_pixels):
|
||||
@page { size: 20px 4px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="4px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="4px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="2" y="1.5" font-family="weasyprint" font-size="2"
|
||||
fill="blue">
|
||||
ABC
|
||||
@ -233,7 +233,7 @@ def test_text_anchor_middle(assert_pixels):
|
||||
@page { size: 20px 2px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="2px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="2px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="10" y="1.5" font-family="weasyprint" font-size="2"
|
||||
fill="blue" text-anchor="middle">
|
||||
ABC
|
||||
@ -253,7 +253,7 @@ def test_text_anchor_end(assert_pixels):
|
||||
@page { size: 20px 2px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="2px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="2px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="18" y="1.5" font-family="weasyprint" font-size="2"
|
||||
fill="blue" text-anchor="end">
|
||||
ABC
|
||||
@ -273,7 +273,7 @@ def test_text_tspan(assert_pixels):
|
||||
@page { size: 20px 2px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="2px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="2px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="10" y="10" font-family="weasyprint" font-size="2" fill="blue">
|
||||
<tspan x="0" y="1.5">ABC DEF</tspan>
|
||||
</text>
|
||||
@ -294,7 +294,7 @@ def test_text_rotate(assert_pixels):
|
||||
@page { size: 20px 4px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="20px" height="4px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="20px" height="4px" xmlns="https://www.w3.org/2000/svg">
|
||||
<text x="2" y="1.5" font-family="weasyprint" font-size="2" fill="red"
|
||||
letter-spacing="2">abc</text>
|
||||
<text x="2" y="1.5" font-family="weasyprint" font-size="2" fill="blue"
|
||||
|
@ -20,7 +20,7 @@ def test_transform_translate(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="0" y="4" width="5" height="5" transform="translate(2, -2)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -44,7 +44,7 @@ def test_transform_translatex(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="0" y="2" width="5" height="5" transform="translateX(2)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -68,7 +68,7 @@ def test_transform_translatey(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="0" width="5" height="5" transform="translateY(2)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -92,7 +92,7 @@ def test_transform_rotate(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="-7" width="4" height="5" transform="rotate(90)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -116,7 +116,7 @@ def test_transform_rotate_cx_cy(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="7" y="2" width="4" height="5" transform="rotate(90 7 2)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -140,7 +140,7 @@ def test_transform_skew(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="2" height="2" transform="skew(20 20)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -164,7 +164,7 @@ def test_transform_skewx(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="2" height="2" transform="skewX(20)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -188,7 +188,7 @@ def test_transform_skewy(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="2" height="2" transform="skewY(20)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -212,7 +212,7 @@ def test_transform_scale(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="2" height="2" transform="scale(1.5)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -236,7 +236,7 @@ def test_transform_scale_2(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="2" height="2" transform="scale(1.5 1.5)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -260,7 +260,7 @@ def test_transform_scalex(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="2" height="2" transform="scaleX(1.5)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -284,7 +284,7 @@ def test_transform_scaley(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="2" y="2" width="2" height="2" transform="scaleY(1.5)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
</svg>
|
||||
@ -308,7 +308,7 @@ def test_transform_matrix(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="0" y="0" width="2" height="2"
|
||||
transform="matrix(1.5 0 0 1.5 3 3)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
@ -333,7 +333,7 @@ def test_transform_multiple(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect x="0" y="0" width="4" height="5"
|
||||
transform="rotate(90) translateY(-7) translateX(2)"
|
||||
stroke-width="2" stroke="red" fill="none" />
|
||||
|
@ -20,7 +20,7 @@ def test_visibility_visible(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect visibility="visible"
|
||||
x="2" y="2" width="5" height="5" fill="red" />
|
||||
</svg>
|
||||
@ -44,7 +44,7 @@ def test_visibility_hidden(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect visibility="hidden"
|
||||
x="2" y="2" width="5" height="5" fill="red" />
|
||||
</svg>
|
||||
@ -68,7 +68,7 @@ def test_visibility_inherit_hidden(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<g visibility="hidden">
|
||||
<rect x="2" y="2" width="5" height="5" fill="red" />
|
||||
</g>
|
||||
@ -93,7 +93,7 @@ def test_visibility_inherit_visible(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<g visibility="hidden">
|
||||
<rect visibility="visible"
|
||||
x="2" y="2" width="5" height="5" fill="red" />
|
||||
@ -119,7 +119,7 @@ def test_display_inline(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect display="inline"
|
||||
x="2" y="2" width="5" height="5" fill="red" />
|
||||
</svg>
|
||||
@ -143,7 +143,7 @@ def test_display_none(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<rect display="none"
|
||||
x="2" y="2" width="5" height="5" fill="red" />
|
||||
</svg>
|
||||
@ -167,7 +167,7 @@ def test_display_inherit_none(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<g display="none">
|
||||
<rect x="2" y="2" width="5" height="5" fill="red" />
|
||||
</g>
|
||||
@ -192,7 +192,7 @@ def test_display_inherit_inline(assert_pixels):
|
||||
@page { size: 9px }
|
||||
svg { display: block }
|
||||
</style>
|
||||
<svg width="9px" height="9px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="9px" height="9px" xmlns="https://www.w3.org/2000/svg">
|
||||
<g display="none">
|
||||
<rect display="inline"
|
||||
x="2" y="2" width="5" height="5" fill="red" />
|
||||
|
@ -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('''
|
||||
<style>
|
||||
@page { size: 100000px }
|
||||
@ -312,7 +312,7 @@ def test_box_sizing(size):
|
||||
('min-width: 0; min-height: 0; width: 0; height: 0'),
|
||||
))
|
||||
def test_box_sizing_zero(size):
|
||||
# http://www.w3.org/TR/css3-ui/#box-sizing
|
||||
# https://www.w3.org/TR/css-ui-3/#box-sizing
|
||||
page, = render_pages('''
|
||||
<style>
|
||||
@page { size: 100000px }
|
||||
@ -565,7 +565,7 @@ def test_vertical_space_9(margin_1, margin_2, result):
|
||||
|
||||
@assert_no_logs
|
||||
def test_box_decoration_break_block_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, page_2 = render_pages('''
|
||||
<style>
|
||||
@page { size: 100px }
|
||||
@ -614,7 +614,7 @@ def test_box_decoration_break_block_slice():
|
||||
|
||||
@assert_no_logs
|
||||
def test_box_decoration_break_block_clone():
|
||||
# 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, page_2 = render_pages('''
|
||||
<style>
|
||||
@page { size: 100px }
|
||||
|
@ -130,7 +130,7 @@ def test_position_x_rtl():
|
||||
|
||||
@assert_no_logs
|
||||
def test_breaking_linebox_regression_1():
|
||||
# See http://unicode.org/reports/tr14/
|
||||
# See https://unicode.org/reports/tr14/
|
||||
page, = render_pages('<pre>a\nb\rc\r\nd\u2029e</pre>')
|
||||
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('''
|
||||
<style>
|
||||
@font-face { src: url(weasyprint.otf); font-family: weasyprint }
|
||||
@ -1036,7 +1036,7 @@ def test_box_decoration_break_inline_slice():
|
||||
|
||||
@assert_no_logs
|
||||
def test_box_decoration_break_inline_clone():
|
||||
# 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('''
|
||||
<style>
|
||||
@font-face { src: url(weasyprint.otf); font-family: weasyprint }
|
||||
|
@ -370,7 +370,7 @@ def test_fixed_positioning():
|
||||
|
||||
@assert_no_logs
|
||||
def test_fixed_positioning_regression_1():
|
||||
# Regression test for https://github.com/Kozea/WeasyPrint/issues/641
|
||||
# Regression test for https://github.com/Kozea/WeasyPrint/pull/641
|
||||
page_1, page_2 = render_pages('''
|
||||
<style>
|
||||
@page:first { size: 100px 200px }
|
||||
|
@ -1413,7 +1413,7 @@ def test_layout_table_auto_45():
|
||||
@assert_no_logs
|
||||
def test_layout_table_auto_46():
|
||||
# Test regression:
|
||||
# http://test.weasyprint.org/suite-css21/chapter8/section2/test56/
|
||||
# https://test.weasyprint.org/suite-css21/chapter8/section2/test56/
|
||||
page, = render_pages('''
|
||||
<div style="position: absolute">
|
||||
<table style="margin: 50px; border: 20px solid black">
|
||||
@ -1842,7 +1842,7 @@ def test_table_row_height_2():
|
||||
|
||||
@assert_no_logs
|
||||
def test_table_row_height_3():
|
||||
# Test regression: https://github.com/Kozea/WeasyPrint/issues/
|
||||
# Test regression: https://github.com/Kozea/WeasyPrint/issues/937
|
||||
page, = render_pages('''
|
||||
<style>
|
||||
@font-face { src: url(weasyprint.otf); font-family: weasyprint }
|
||||
|
@ -18,14 +18,14 @@ def test_acid2():
|
||||
return HTML(resource_filename(filename)).render()
|
||||
|
||||
with capture_logs():
|
||||
# This is a copy of http://www.webstandards.org/files/acid2/test.html
|
||||
# This is a copy of https://www.webstandards.org/files/acid2/test.html
|
||||
document = render('acid2-test.html')
|
||||
intro_page, test_page = document.pages
|
||||
# Ignore the intro page: it is not in the reference
|
||||
test_png = document.copy([test_page]).write_png()
|
||||
test_pixels = Image.open(io.BytesIO(test_png)).getdata()
|
||||
|
||||
# This is a copy of http://www.webstandards.org/files/acid2/reference.html
|
||||
# This is a copy of https://www.webstandards.org/files/acid2/reference.html
|
||||
ref_png = render('acid2-reference.html').write_png()
|
||||
ref_image = Image.open(io.BytesIO(ref_png))
|
||||
ref_pixels = ref_image.getdata()
|
||||
|
@ -718,7 +718,7 @@ def test_links_1():
|
||||
p { height: 90px; margin: 0 0 10px 0 }
|
||||
img { width: 30px; vertical-align: top }
|
||||
</style>
|
||||
<p><a href="http://weasyprint.org"><img src=pattern.png></a></p>
|
||||
<p><a href="https://weasyprint.org"><img src=pattern.png></a></p>
|
||||
<p style="padding: 0 10px"><a
|
||||
href="#lipsum"><img style="border: solid 1px"
|
||||
src=pattern.png></a></p>
|
||||
@ -729,8 +729,8 @@ def test_links_1():
|
||||
</p>
|
||||
''', [
|
||||
[
|
||||
('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():
|
||||
'''
|
||||
<body style="width: 200px">
|
||||
<a href="../lipsum/é_%E9" style="display: block; margin: 10px 5px">
|
||||
''', [[('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():
|
||||
<body style="width: 200px">
|
||||
<div style="display: block; margin: 10px 5px;
|
||||
-weasy-link: url(../lipsum/é_%E9)">
|
||||
''', [[('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():
|
||||
<body style="width: 200px">
|
||||
<a href="#lipsum" id="lipsum"
|
||||
style="display: block; margin: 10px 5px"></a>
|
||||
<a href="http://weasyprint.org/" style="display: block"></a>
|
||||
<a href="https://weasyprint.org/" style="display: block"></a>
|
||||
''', [[
|
||||
('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)
|
||||
|
||||
|
@ -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('''
|
||||
<p>Lorem \t\r\n ipsum\t<strong> dolor
|
||||
<img src=pattern.png> 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('''
|
||||
<x-table>
|
||||
<x-tr>
|
||||
@ -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('''
|
||||
|
@ -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
|
||||
|
@ -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, '%'))],
|
||||
|
@ -303,7 +303,7 @@ def test_links():
|
||||
p { display: block; height: 90pt; margin: 0 0 10pt 0 }
|
||||
img { width: 30pt; vertical-align: top }
|
||||
</style>
|
||||
<p><a href="http://weasyprint.org"><img src=pattern.png></a></p>
|
||||
<p><a href="https://weasyprint.org"><img src=pattern.png></a></p>
|
||||
<p style="padding: 0 10pt"><a
|
||||
href="#lipsum"><img style="border: solid 1pt"
|
||||
src=pattern.png></a></p>
|
||||
@ -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 href="../lipsum" style="display: block"></a>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 href="/test/lipsum"></a>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 id="test" href="/foo/bar/#test"></a>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
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -21,7 +21,7 @@ ZERO_PIXELS = Dimension(0, 'px')
|
||||
|
||||
# Value in pixels of font-size for <absolute-size> 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'):
|
||||
|
@ -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); }
|
||||
|
||||
|
@ -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',
|
||||
|
@ -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<unit> is this many radians.
|
||||
ANGLE_TO_RADIANS = {
|
||||
'rad': 1,
|
||||
@ -19,7 +19,7 @@ ANGLE_TO_RADIANS = {
|
||||
}
|
||||
|
||||
# How many CSS pixels is one <unit>?
|
||||
# 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
|
||||
|
||||
"""
|
||||
|
@ -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)
|
||||
|
@ -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]
|
||||
|
@ -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 <http://www.w3.org/TR/NOTE-datetime>`_.
|
||||
#: `W3C’s profile of ISO 8601 <https://www.w3.org/TR/NOTE-datetime>`_.
|
||||
#: Extracted from the ``<meta name=dcterms.created>`` 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 <http://www.w3.org/TR/NOTE-datetime>`_.
|
||||
#: `W3C’s profile of ISO 8601 <https://www.w3.org/TR/NOTE-datetime>`_.
|
||||
#: Extracted from the ``<meta name=dcterms.modified>`` element in HTML
|
||||
#: and written to the ``/ModDate`` info field in PDF.
|
||||
self.modified = modified
|
||||
|
@ -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'''
|
||||
<svg height="{height}" width="{width}"
|
||||
fill="transparent" stroke="black" stroke-width="1"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
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)
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
<http://whatwg.org/C#ascii-case-insensitive>`_ matching.
|
||||
<https://whatwg.org/C#ascii-case-insensitive>`_ 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)
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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):
|
||||
|
@ -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 (
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -58,7 +58,7 @@ def parse_stylesheets(tree, url):
|
||||
# TODO: support contentStyleType on <svg>
|
||||
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):
|
||||
|
@ -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']
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.+-]+):')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user