weasyprint 65.0__py3-none-any.whl → 65.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
weasyprint/__init__.py CHANGED
@@ -15,7 +15,7 @@ import cssselect2
15
15
  import tinycss2
16
16
  import tinyhtml5
17
17
 
18
- VERSION = __version__ = '65.0'
18
+ VERSION = __version__ = '65.1'
19
19
 
20
20
  #: Default values for command-line and Python API options. See
21
21
  #: :func:`__main__.main` to learn more about specific options for
@@ -20,7 +20,7 @@ a[href] { -weasy-link: attr(href) }
20
20
  /* Display and visibility */
21
21
 
22
22
  [hidden], area, base, basefont, command, datalist, head, input[type=hidden i], link, menu[type=context i], meta, noembed, noframes, param, rp, script, source, style, template, title, track { display: none }
23
- address, article, aside, blockquote, body, center, dd, details, dir, div, dl, dt, frame, frameset, fieldset, figure, figcaption, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, html, legend, listing, menu, nav, ol, p, plaintext, pre, section, summary, ul, xmp { display: block }
23
+ address, article, aside, blockquote, body, center, dd, details, dir, div, dl, dt, frame, frameset, fieldset, figure, figcaption, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, html, legend, listing, main, menu, nav, ol, p, plaintext, pre, section, summary, ul, xmp { display: block }
24
24
  button, input, keygen, select, textarea { display: inline-block }
25
25
  li { display: list-item }
26
26
  table { display: table }
@@ -62,14 +62,18 @@ dd { margin-left: 40px }
62
62
  [dir] [dir=rtl i] dd { margin-left: 40px; margin-right: 0 }
63
63
  [dir] [dir] [dir=ltr i] dd { margin-left: 0; margin-right: 40px }
64
64
  [dir] [dir] [dir=rtl i] dd { margin-left: 40px; margin-right: 0 }
65
+ dd[dir=ltr i][dir][dir] { margin-left: 0; margin-right: 40px }
66
+ dd[dir=rtl i][dir][dir] { margin-left: 40px; margin-right: 0 }
65
67
 
66
68
  dir, menu, ol, ul { padding-left: 40px }
67
- [dir=rtl i] :is(dir, menu, ol, ul) { padding-left: 0; padding-right: 40px }
68
69
  [dir=ltr i] :is(dir, menu, ol, ul) { padding-left: 40px; padding-right: 0 }
69
- [dir] [dir=rtl i] :is(dir, menu, ol, ul) { padding-left: 0; padding-right: 40px }
70
+ [dir=rtl i] :is(dir, menu, ol, ul) { padding-left: 0; padding-right: 40px }
70
71
  [dir] [dir=ltr i] :is(dir, menu, ol, ul) { padding-left: 40px; padding-right: 0 }
71
- [dir] [dir] [dir=rtl i] :is(dir, menu, ol, ul) { padding-left: 0; padding-right: 40px }
72
+ [dir] [dir=rtl i] :is(dir, menu, ol, ul) { padding-left: 0; padding-right: 40px }
72
73
  [dir] [dir] [dir=ltr i] :is(dir, menu, ol, ul) { padding-left: 40px; padding-right: 0 }
74
+ [dir] [dir] [dir=rtl i] :is(dir, menu, ol, ul) { padding-left: 0; padding-right: 40px }
75
+ :is(dir, menu, ol, ul)[dir=ltr i][dir][dir] { padding-left: 40px; padding-right: 0 }
76
+ :is(dir, menu, ol, ul)[dir=rtl i][dir][dir] { padding-left: 0; padding-right: 40px }
73
77
 
74
78
  table { border-spacing: 2px; border-collapse: separate }
75
79
  td, th { padding: 1px }
weasyprint/layout/flex.py CHANGED
@@ -167,9 +167,9 @@ def flex_layout(context, box, bottom_space, skip_stack, containing_block, page_i
167
167
  content_size = min_content_width(context, new_child, outer=False)
168
168
  transferred_size = None
169
169
  if isinstance(child, boxes.ReplacedBox):
170
- image = box.replacement
170
+ image = child.replacement
171
171
  _, intrinsic_height, intrinsic_ratio = image.get_intrinsic_size(
172
- box.style['image_resolution'], box.style['font_size'])
172
+ child.style['image_resolution'], child.style['font_size'])
173
173
  if intrinsic_ratio and intrinsic_height:
174
174
  transferred_size = intrinsic_height * intrinsic_ratio
175
175
  if specified_size != 'auto':
@@ -195,9 +195,9 @@ def flex_layout(context, box, bottom_space, skip_stack, containing_block, page_i
195
195
  content_size = new_child.height if new_child else 0
196
196
  transferred_size = None
197
197
  if isinstance(child, boxes.ReplacedBox):
198
- image = box.replacement
198
+ image = child.replacement
199
199
  intrinsic_width, _, intrinsic_ratio = image.get_intrinsic_size(
200
- box.style['image_resolution'], box.style['font_size'])
200
+ child.style['image_resolution'], child.style['font_size'])
201
201
  if intrinsic_ratio and intrinsic_width:
202
202
  transferred_size = intrinsic_width / intrinsic_ratio
203
203
  if specified_size != 'auto':
@@ -221,14 +221,16 @@ def flex_layout(context, box, bottom_space, skip_stack, containing_block, page_i
221
221
  child.flex_base_size = flex_basis
222
222
  if main == 'width':
223
223
  child.main_outer_extra = (
224
- child.border_left_width + child.border_right_width)
224
+ child.border_left_width + child.border_right_width +
225
+ child.padding_left + child.padding_right)
225
226
  if child.margin_left != 'auto':
226
227
  child.main_outer_extra += child.margin_left
227
228
  if child.margin_right != 'auto':
228
229
  child.main_outer_extra += child.margin_right
229
230
  else:
230
231
  child.main_outer_extra = (
231
- child.border_top_width + child.border_bottom_width)
232
+ child.border_top_width + child.border_bottom_width +
233
+ child.padding_top + child.padding_bottom)
232
234
  if child.margin_top != 'auto':
233
235
  child.main_outer_extra += child.margin_top
234
236
  if child.margin_bottom != 'auto':
@@ -250,8 +252,12 @@ def flex_layout(context, box, bottom_space, skip_stack, containing_block, page_i
250
252
  new_child = block.block_level_layout(
251
253
  context, new_child, bottom_space, child_skip_stack, parent_box,
252
254
  page_is_empty, absolute_boxes, fixed_boxes)[0]
253
- child.flex_base_size = new_child.height
254
- child.main_outer_extra = new_child.margin_height() - new_child.height
255
+ if new_child:
256
+ child.flex_base_size = new_child.height
257
+ child.main_outer_extra = (
258
+ new_child.margin_height() - new_child.height)
259
+ else:
260
+ child.flex_base_size = child.main_outer_extra = 0
255
261
 
256
262
  if main == 'width':
257
263
  position_x += child.flex_base_size + child.main_outer_extra
weasyprint/layout/page.py CHANGED
@@ -799,6 +799,8 @@ def set_page_type_computed_styles(page_type, html, style_for):
799
799
 
800
800
 
801
801
  def _includes_resume_at(resume_at, page_group_resume_at):
802
+ if not page_group_resume_at:
803
+ return True
802
804
  (page_child_index, page_child_resume_at), = page_group_resume_at.items()
803
805
  if resume_at is None or page_child_index not in resume_at:
804
806
  return False
@@ -807,7 +809,7 @@ def _includes_resume_at(resume_at, page_group_resume_at):
807
809
  return _includes_resume_at(resume_at[page_child_index], page_child_resume_at)
808
810
 
809
811
 
810
- def _update_page_groups(page_groups, resume_at, next_page, root_box):
812
+ def _update_page_groups(page_groups, resume_at, next_page, root_box, blank):
811
813
  # https://www.w3.org/TR/css-gcpm-3/#document-sequence-selectors
812
814
 
813
815
  # Remove or increment page groups.
@@ -819,35 +821,40 @@ def _update_page_groups(page_groups, resume_at, next_page, root_box):
819
821
  page_groups.pop(i - page_groups_length)
820
822
 
821
823
  # Add page groups.
822
- if next_page['break'] == 'any' or not next_page['page']:
823
- # We don’t have a forced page break or a named page.
824
- return
825
- if page_groups and page_groups[-1][0] == next_page['page']:
826
- # We’re already in an element whose page name is the next page name.
827
- return
824
+ if not blank:
825
+ if (resume_at and next_page['break'] == 'any') or not next_page['page']:
826
+ # We don’t have a forced page break or a named page.
827
+ return next_page['page']
828
+ if page_groups and page_groups[-1][0] == next_page['page']:
829
+ # We’re already in an element whose page name is the next page name.
830
+ return next_page['page']
828
831
 
829
832
  # Find the box that has the named page. It is a first in-flow child of the
830
833
  # element corresponding to resume_at.
831
834
 
832
835
  # Find element corrensponding to resume_at.
833
- page_group_resume_at = copy.deepcopy(resume_at)
834
- current_resume_at = page_group_resume_at
836
+ current_resume_at = page_group_resume_at = copy.deepcopy(resume_at) or {0: None}
835
837
  current_element = root_box
836
838
  while True:
837
839
  child_index, child_resume_at = tuple(current_resume_at.items())[-1]
840
+ parent_element = current_element
838
841
  current_element = current_element.children[child_index]
839
842
  if child_resume_at is None:
840
843
  break
841
844
  current_resume_at = child_resume_at
842
845
 
846
+ if blank:
847
+ # Page is blank, don’t create a new page group and return parent’s page name.
848
+ return parent_element.style['page']
849
+
843
850
  # Find the descendant with named page.
844
851
  while True:
845
852
  if current_element.style['page'] == next_page['page']:
846
853
  page_groups.append([next_page['page'], 0, page_group_resume_at])
847
- return
854
+ return next_page['page']
848
855
  if not isinstance(current_element, boxes.ParentBox):
849
856
  # Shouldn’t happen.
850
- return
857
+ return next_page['page']
851
858
  for i, child in enumerate(current_element.children):
852
859
  if not child.is_in_normal_flow():
853
860
  continue
@@ -858,7 +865,7 @@ def _update_page_groups(page_groups, resume_at, next_page, root_box):
858
865
  break
859
866
  else:
860
867
  # Shouldn’t happen.
861
- return
868
+ return next_page['page']
862
869
 
863
870
 
864
871
  def remake_page(index, page_groups, context, root_box, html):
@@ -891,9 +898,8 @@ def remake_page(index, page_groups, context, root_box, html):
891
898
  (next_page_side == 'left' and right_page) or
892
899
  (next_page_side == 'right' and not right_page) or
893
900
  (context.reported_footnotes and resume_at is None))
894
- name = '' if blank else next_page['page']
895
901
  side = 'right' if right_page else 'left'
896
- _update_page_groups(page_groups, resume_at, next_page, root_box)
902
+ name = _update_page_groups(page_groups, resume_at, next_page, root_box, blank)
897
903
  groups = tuple((name, index) for name, index, _ in page_groups)
898
904
  page_type = PageType(side, blank, name, index, groups)
899
905
  set_page_type_computed_styles(page_type, html, context.style_for)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weasyprint
3
- Version: 65.0
3
+ Version: 65.1
4
4
  Summary: The Awesome Document Factory
5
5
  Keywords: html,css,pdf,converter
6
6
  Author-email: Simon Sapin <simon.sapin@exyr.org>
@@ -1,4 +1,4 @@
1
- weasyprint/__init__.py,sha256=tNkl1pKk8bY-aU64SZC2USPpatilxPwciiS7EaVDsRM,17409
1
+ weasyprint/__init__.py,sha256=MrV26630NkuBXozSOqGdsFZWOFI6arULa1nSj-7EYM8,17409
2
2
  weasyprint/__main__.py,sha256=WaRdNsuuTBCJlny8AgqF9I_0Mnx5GseQEFA5lXimErw,7114
3
3
  weasyprint/anchors.py,sha256=yXEZD0uFsCAdDjC07cHgWqRuGOSsOsmmmk4omZZecAo,6428
4
4
  weasyprint/document.py,sha256=pUwJKcUp3tmgxh155RsQpS3kVUMuXWZfXCOziqQwaNc,17131
@@ -12,7 +12,7 @@ weasyprint/css/__init__.py,sha256=6w2UoHQSoZ76eCuferHS3R0M8nAzFgab1NwR1vpy9LA,51
12
12
  weasyprint/css/computed_values.py,sha256=O3USpx2ZH7Ff_FN5oIjn40lNMHj3zdThR0r51HRniIQ,27301
13
13
  weasyprint/css/counters.py,sha256=DHSrGJr2ktpZLCc-JYIiE67ak0TORsKSBKkjju-qwdE,11373
14
14
  weasyprint/css/html5_ph.css,sha256=l8t4ZN3KoevKx0UEfNw3_vgVjArcII6y5DZXZolWaw0,4629
15
- weasyprint/css/html5_ua.css,sha256=HJsoxwopC2Alp6qkbmaMUBX3lpU7qSYaSxcMHREcwEc,18809
15
+ weasyprint/css/html5_ua.css,sha256=qGUxl1eIu3tQRVu2fVMnC_oo_CbMYoukAC8dSvH1ErM,19111
16
16
  weasyprint/css/html5_ua_form.css,sha256=0JLdrpmhokuy9IFhK2L1ZwbTa2G3ibXTXcGuCkAw80Y,288
17
17
  weasyprint/css/media_queries.py,sha256=wHPteZ9Gs2ttuA5kZpMDgRtFHnhYZVwrFXrhKgmR-4g,1072
18
18
  weasyprint/css/properties.py,sha256=5nywzyQjLOSKKGxsvJsVgoyQfMsLSQarMeso-WRgYlU,11593
@@ -34,13 +34,13 @@ weasyprint/layout/absolute.py,sha256=Caek_aFJDz5NLYFxTfEYO1-l7ITUMcx6TNDjNpE15-Y
34
34
  weasyprint/layout/background.py,sha256=0ZRFZGAJnvF9eULIMyt8oy6lDqE-hKSbcyomQPx8HsQ,10008
35
35
  weasyprint/layout/block.py,sha256=jwQS2jGCoQ0hSvCsWRPFK7Y3wad-Ucgzv0fzf-4DKm0,45388
36
36
  weasyprint/layout/column.py,sha256=P_863u0_vFYzig9tfBUMI8ZCpXlbx9SLoYekbZ5vg5Y,17299
37
- weasyprint/layout/flex.py,sha256=AAd3ILF-sVjkTCQafEFcqUDsdZHrGYKR60YG59OwgQo,42335
37
+ weasyprint/layout/flex.py,sha256=uAm4DAOvomSg0aX1oEse8-vT3M_fVI-IGFO1yatBH6E,42630
38
38
  weasyprint/layout/float.py,sha256=xo9CuXfvrC5jE8rnCVT2ShNRAXl7vAISq41oqkvvbK8,9266
39
39
  weasyprint/layout/grid.py,sha256=hzmsWXWQYw5rdy2XA_O_4Hz7CWCVle0RnnWTkugPEvY,54729
40
40
  weasyprint/layout/inline.py,sha256=aFxHM0b-fQCSIWyXgf3dLHM90sQq8AOcS1ELx7sDpbc,48217
41
41
  weasyprint/layout/leader.py,sha256=wklI0aLyTx0VJhqU7D_FxtJpfe7dXswcN-VApAusM-Q,2825
42
42
  weasyprint/layout/min_max.py,sha256=JdXJG9ISO_RsfeHua_-3g477a16I-NrnYuwH_tQwq4o,1527
43
- weasyprint/layout/page.py,sha256=4WBLmg0RtGYK1reehYOAkBO06_bTsgiMz8_UvXN-DJ0,39554
43
+ weasyprint/layout/page.py,sha256=JLKoYzGmrULONv11KLLrQuRFaTRK7XJZocuUsB0EGKs,39908
44
44
  weasyprint/layout/percent.py,sha256=2XzT_Y-fu7OVt2Ut1f9T1Tt9S4ftRr4x7wL3agvEJus,5626
45
45
  weasyprint/layout/preferred.py,sha256=cSOraU8g7i_8dDUifJhvKk0gxHBdPXqGZjjIgs8LVIs,31040
46
46
  weasyprint/layout/replaced.py,sha256=ucAd6VMKIEryjnwK8ciKbUoE2yK29-ggdYlGW3KPDXk,11178
@@ -67,8 +67,8 @@ weasyprint/text/constants.py,sha256=ifPeTG_us_sSgWuM-WTQgDrrAgwwnohYR63HhS_1dIM,
67
67
  weasyprint/text/ffi.py,sha256=0FWxNeYn0Nub-fKHWElFcQc9GmlgiLAKvS82hpDxsAs,18282
68
68
  weasyprint/text/fonts.py,sha256=Qa7HxrQeJN84XXBKgJitcRdVMRA9vz1QY8Kl3StRCE4,17460
69
69
  weasyprint/text/line_break.py,sha256=FXlHDk8A4lBB-i3wqgl7RO66P3TPpFzkkFbmu-FHGKg,24735
70
- weasyprint-65.0.dist-info/entry_points.txt,sha256=wgDp3XXzFywdYgI5vUWMp1zAwx1sZXXH0FTUQbFOq6A,55
71
- weasyprint-65.0.dist-info/licenses/LICENSE,sha256=v9FOzPphAFdUYOaFVWsYM5nUvTNZBOPJUhsBFtIcVNo,1534
72
- weasyprint-65.0.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
73
- weasyprint-65.0.dist-info/METADATA,sha256=X0c9Bin5j5eoQX3YDf0QaJry6HbiBmZMhqebufYN_YM,3707
74
- weasyprint-65.0.dist-info/RECORD,,
70
+ weasyprint-65.1.dist-info/entry_points.txt,sha256=wgDp3XXzFywdYgI5vUWMp1zAwx1sZXXH0FTUQbFOq6A,55
71
+ weasyprint-65.1.dist-info/licenses/LICENSE,sha256=v9FOzPphAFdUYOaFVWsYM5nUvTNZBOPJUhsBFtIcVNo,1534
72
+ weasyprint-65.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
73
+ weasyprint-65.1.dist-info/METADATA,sha256=v9-RDucK9Kk_K1t1UO7i1KRMr7GRF-bbdCdt9XGn-qg,3707
74
+ weasyprint-65.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.11.0
2
+ Generator: flit 3.12.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any