Skip to content

Commit

Permalink
Fix the "contents" value of bookmark-label
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Aug 31, 2021
1 parent fc4a771 commit 31cd0d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/test_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ def test_bookmarks_11():
assert re.findall(b'/Title \\((.*)\\)', pdf) == [b'a', b'b']


@assert_no_logs
def test_bookmarks_12():
pdf = FakeHTML(string='''
<div style="bookmark-level:1; bookmark-label:contents">a</div>
''').write_pdf()
# a
counts = re.findall(b'/Count ([0-9-]*)', pdf)
outlines = counts.pop()
assert outlines == b'1'
assert re.findall(b'/Title \\((.*)\\)', pdf) == [b'a']


@assert_no_logs
def test_links_none():
pdf = FakeHTML(string='<body>').write_pdf()
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/css/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def get_content_list_token(token, base_url):

# contents
if get_keyword(token) == 'contents':
return ('content', 'text')
return ('content()', 'text')

# <uri>
url = get_url(token, base_url)
Expand Down

0 comments on commit 31cd0d7

Please sign in to comment.