Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS: 'column-rule': size unit unhandled #2217

Closed
sphakka opened this issue Aug 1, 2024 · 1 comment
Closed

CSS: 'column-rule': size unit unhandled #2217

sphakka opened this issue Aug 1, 2024 · 1 comment
Labels
crash Problems preventing documents from being rendered
Milestone

Comments

@sphakka
Copy link

sphakka commented Aug 1, 2024

(Possibly related to old issue #60.) With Weasyprint v62.3 (latest as of now) on Linux, using column-rule chokes on size unit.

MWE:

<!doctype html>
<html>
	<head>
		<title>Test CSS3 column-rule</title>
		<meta charset="utf-8" />
	</head>
	<style>
	 .two-columns {
		 columns: 2;
		 column-rule: 1px dotted gray;
	 }
	</style>
	<body>
		<div class="two-columns">
			<p>Foo bar</p>
			<p>Bar quux</p>
		</div>
	</body>
</html>

Command:

$ weasyprint test-col.html test-col.pdf
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.12/weasyprint", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/weasyprint/__main__.py", line 183, in main
    html.write_pdf(output, **options)
  File "/usr/lib/python3.12/site-packages/weasyprint/__init__.py", line 259, in write_pdf
    self.render(font_config, counter_style, **options)
  File "/usr/lib/python3.12/site-packages/weasyprint/document.py", line 400, in write_pdf
    pdf = generate_pdf(self, target, zoom, **options)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/weasyprint/pdf/__init__.py", line 190, in generate_pdf
    page.paint(stream, scale)
  File "/usr/lib/python3.12/site-packages/weasyprint/document.py", line 99, in paint
    draw_page(self._page_box, stream)
  File "/usr/lib/python3.12/site-packages/weasyprint/draw.py", line 67, in draw_page
    draw_stacking_context(stream, stacking_context)
  File "/usr/lib/python3.12/site-packages/weasyprint/draw.py", line 170, in draw_stacking_context
    draw_stacking_context(stream, child_context)
  File "/usr/lib/python3.12/site-packages/weasyprint/draw.py", line 144, in draw_stacking_context
    draw_border(stream, block)
  File "/usr/lib/python3.12/site-packages/weasyprint/draw.py", line 426, in draw_border
    gap = percentage(box.style['column_gap'], box.width)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/weasyprint/layout/percent.py", line 17, in percentage
    elif value.unit == 'px':
         ^^^^^^^^^^
AttributeError: 'str' object has no attribute 'unit'
@liZe liZe added the crash Problems preventing documents from being rendered label Aug 1, 2024
@liZe liZe added this to the 63.0 milestone Aug 1, 2024
@liZe
Copy link
Member

liZe commented Aug 1, 2024

Thanks for the report! It’s been introduced by the grid layout support, for which the column-gap property has been adapted to follow the new Box Alignment Module.

@liZe liZe closed this as completed in 3f07e03 Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Problems preventing documents from being rendered
Projects
None yet
Development

No branches or pull requests

2 participants