Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1509 from Kozea/footnotes
Support footnotes
- Loading branch information
Showing
22 changed files
with
1,092 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
""" | ||
weasyprint.tests.test_draw.test_footnotes | ||
----------------------------------------- | ||
Test how footnotes are drawn. | ||
""" | ||
|
||
from ..testing_utils import assert_no_logs | ||
from . import assert_pixels | ||
|
||
|
||
@assert_no_logs | ||
def test_inline_footnote(): | ||
assert_pixels('span_footnote', 9, 7, ''' | ||
RRRRRRRR_ | ||
RRRRRRRR_ | ||
_________ | ||
_________ | ||
_________ | ||
RRRRRRRR_ | ||
RRRRRRRR_ | ||
''', ''' | ||
<style> | ||
@font-face {src: url(weasyprint.otf); font-family: weasyprint} | ||
@page { | ||
size: 9px 7px; | ||
background: white; | ||
} | ||
div { | ||
color: red; | ||
font-family: weasyprint; | ||
font-size: 2px; | ||
line-height: 1; | ||
} | ||
span { | ||
float: footnote; | ||
} | ||
</style> | ||
<div>abc<span>de</span></div>''') | ||
|
||
|
||
@assert_no_logs | ||
def test_block_footnote(): | ||
assert_pixels('div_footnote', 9, 7, ''' | ||
RRRRRRRR_ | ||
RRRRRRRR_ | ||
_________ | ||
_________ | ||
_________ | ||
RRRRRRRR_ | ||
RRRRRRRR_ | ||
''', ''' | ||
<style> | ||
@font-face {src: url(weasyprint.otf); font-family: weasyprint} | ||
@page { | ||
size: 9px 7px; | ||
background: white; | ||
} | ||
div { | ||
color: red; | ||
font-family: weasyprint; | ||
font-size: 2px; | ||
line-height: 1; | ||
} | ||
div.footnote { | ||
float: footnote; | ||
} | ||
</style> | ||
<div>abc<div class="footnote">de</div></div>''') | ||
|
||
|
||
@assert_no_logs | ||
def test_long_footnote(): | ||
assert_pixels('long_footnote', 9, 7, ''' | ||
RRRRRRRR_ | ||
RRRRRRRR_ | ||
_________ | ||
RRRRRRRR_ | ||
RRRRRRRR_ | ||
RR_______ | ||
RR_______ | ||
''', ''' | ||
<style> | ||
@font-face {src: url(weasyprint.otf); font-family: weasyprint} | ||
@page { | ||
size: 9px 7px; | ||
background: white; | ||
} | ||
div { | ||
color: red; | ||
font-family: weasyprint; | ||
font-size: 2px; | ||
line-height: 1; | ||
} | ||
span { | ||
float: footnote; | ||
} | ||
</style> | ||
<div>abc<span>de f</span></div>''') | ||
|
||
|
||
@assert_no_logs | ||
def test_footnote_margin(): | ||
assert_pixels('footnote_margin', 9, 7, ''' | ||
RRRRRRRR_ | ||
RRRRRRRR_ | ||
_________ | ||
_________ | ||
_RRRRRR__ | ||
_RRRRRR__ | ||
_________ | ||
''', ''' | ||
<style> | ||
@font-face {src: url(weasyprint.otf); font-family: weasyprint} | ||
@page { | ||
size: 9px 7px; | ||
background: white; | ||
@footnote { | ||
margin: 1px; | ||
} | ||
} | ||
div { | ||
color: red; | ||
font-family: weasyprint; | ||
font-size: 2px; | ||
line-height: 1; | ||
} | ||
span { | ||
float: footnote; | ||
} | ||
</style> | ||
<div>abc<span>d</span></div>''') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.