Skip to content

Commit 4c81663

Browse files
committedJun 11, 2024·
Fix layout when all footnotes are removed from the footnote area
1 parent 4617b94 commit 4c81663

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
 

‎tests/draw/test_footnote.py

+51
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,57 @@ def test_footnote_margin(assert_pixels):
123123
<div>abc<span>d</span></div>''')
124124

125125

126+
@assert_no_logs
127+
def test_footnote_multiple_margin(assert_pixels):
128+
assert_pixels('''
129+
RRRR___
130+
RRRR___
131+
RRRR___
132+
RRRR___
133+
RRRR___
134+
RRRR___
135+
RRRRRR_
136+
RRRRRR_
137+
_______
138+
_______
139+
140+
RRRR___
141+
RRRR___
142+
_______
143+
_______
144+
_______
145+
_______
146+
RRRRRR_
147+
RRRRRR_
148+
RRRRRR_
149+
RRRRRR_
150+
''', '''
151+
<style>
152+
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
153+
@page {
154+
size: 7px 10px;
155+
156+
@footnote {
157+
margin-top: 1px;
158+
}
159+
}
160+
div {
161+
color: red;
162+
font-family: weasyprint;
163+
font-size: 2px;
164+
line-height: 1;
165+
}
166+
span {
167+
float: footnote;
168+
}
169+
</style>
170+
<div>ab</div>
171+
<div>ab</div>
172+
<div>ab</div>
173+
<div>a<span>d</span><span>e</span></div>
174+
<div>ab</div>''')
175+
176+
126177
@assert_no_logs
127178
def test_footnote_with_absolute(assert_pixels):
128179
assert_pixels('''

‎weasyprint/layout/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -379,4 +379,6 @@ def _update_footnote_area(self):
379379
return overflow
380380
else:
381381
self.current_footnote_area.height = 0
382+
if not self.in_column:
383+
self.page_bottom -= self.current_footnote_area.margin_height()
382384
return False

0 commit comments

Comments
 (0)
Please sign in to comment.