From 0320c4fbeec4c9c77ae575e492f39c3ba5a519e3 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sun, 27 Feb 2022 17:50:52 +0100 Subject: [PATCH 1/2] Version 54.2 --- docs/changelog.rst | 53 ++++++++++++++++++++++++++++++++++++++++++ weasyprint/__init__.py | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index e6e9aef77..d1fb14538 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,59 @@ Changelog ========= +Version 54.2 +------------ + +Released on 2022-02-27. + +Bug fixes: + +* `#1575 `_: + Always store parent blocks children as lists +* `#1574 `_, + `#1559 `_: + Fix float rounding errors +* `#1571 `_: + Ignore unknown glyphs +* `#1561 `_, + `#1562 `_: + Fix line break when breaks occur between a nbsp and an inline block +* `#1560 `_: + Always set the child index +* `#1558 `_: + Fix patterns with use tags + +Contributors: + +* Guillaume Ayoub +* Lucie Anglade +* Jack Lin +* aschmitz + +Backers and sponsors: + +* Grip Angebotssoftware +* Manuel Barkhau +* Crisp BV +* SimonSoft +* Menutech +* KontextWork +* Maykin Media +* René Fritz +* NCC Group +* Spacinov +* Nathalie Gutton +* Andreas Zettl +* Tom Pohl +* Kobalt +* Moritz Mahringer +* Florian Demmer +* Yanal-Yvez Fargialla +* Gábor +* Piotr Horzycki +* DeivGuerrero + + Version 54.1 ------------ diff --git a/weasyprint/__init__.py b/weasyprint/__init__.py index 701106b24..d40351c57 100644 --- a/weasyprint/__init__.py +++ b/weasyprint/__init__.py @@ -16,7 +16,7 @@ import html5lib import tinycss2 -VERSION = __version__ = '54.1' +VERSION = __version__ = '54.2' __all__ = [ 'HTML', 'CSS', 'Attachment', 'Document', 'Page', 'default_url_fetcher', From c1178a559ca1cf566211bb712fc0e0c42e26b019 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Wed, 2 Mar 2022 20:57:26 +0100 Subject: [PATCH 2/2] Fix (and test) discarded text-align values Fix #1586. --- tests/test_css_validation.py | 26 ++++++++++++++++++++++++++ weasyprint/css/validation/expanders.py | 9 ++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/tests/test_css_validation.py b/tests/test_css_validation.py index 27e588bda..fb71c0ae0 100644 --- a/tests/test_css_validation.py +++ b/tests/test_css_validation.py @@ -1143,3 +1143,29 @@ def test_line_clamp(rule, result): )) def test_line_clamp_invalid(rule, reason): assert_invalid(rule, reason) + + +@assert_no_logs +@pytest.mark.parametrize('rule, result', ( + ('text-align: left', { + 'text_align_all': 'left', 'text_align_last': 'left'}), + ('text-align: end', { + 'text_align_all': 'end', 'text_align_last': 'end'}), + ('text-align: justify', { + 'text_align_all': 'justify', 'text_align_last': 'start'}), + ('text-align: justify-all', { + 'text_align_all': 'justify', 'text_align_last': 'justify'}))) +def test_text_align(rule, result): + assert expand_to_dict(rule) == result + + +@assert_no_logs +@pytest.mark.parametrize('rule, reason', ( + ('text-align: none', 'invalid'), + ('text-align: left left', 'invalid'), + ('text-align: top', 'invalid'), + ('text-align: "right"', 'invalid'), + ('text-align: 1px', 'invalid'), +)) +def test_text_align_invalid(rule, reason): + assert_invalid(rule, reason) diff --git a/weasyprint/css/validation/expanders.py b/weasyprint/css/validation/expanders.py index 98770cf9a..27bddc0a1 100644 --- a/weasyprint/css/validation/expanders.py +++ b/weasyprint/css/validation/expanders.py @@ -21,7 +21,7 @@ flex_grow_shrink, flex_wrap, font_family, font_size, font_stretch, font_style, font_weight, line_height, list_style_image, list_style_position, list_style_type, other_colors, overflow_wrap, - validate_non_shorthand) + text_align_all, validate_non_shorthand) EXPANDERS = {} @@ -648,9 +648,12 @@ def expand_text_align(base_url, name, tokens): keyword = get_single_keyword(tokens) if keyword is None: raise InvalidValues - align_all = 'justify' if keyword == 'justify-all' else keyword - yield 'text_align_all', align_all + align_all = ( + 'justify' if keyword == 'justify-all' else text_align_all(tokens)) + if align_all is None: + raise InvalidValues align_last = 'start' if keyword == 'justify' else align_all + yield 'text_align_all', align_all yield 'text_align_last', align_last else: raise InvalidValues