From 5e4746f67c3b3e79db14d8928c2af1ccab9dbd06 Mon Sep 17 00:00:00 2001 From: Youen Date: Wed, 10 May 2023 22:30:50 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20des=20bookmarks=20avant=20la=20tab?= =?UTF-8?q?le=20des=20mati=C3=A8res?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sphinx-tools/update_pdf_bookmarks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sphinx-tools/update_pdf_bookmarks.py b/sphinx-tools/update_pdf_bookmarks.py index 3465a3a..e70125d 100644 --- a/sphinx-tools/update_pdf_bookmarks.py +++ b/sphinx-tools/update_pdf_bookmarks.py @@ -18,7 +18,8 @@ with open(bookmarks_filename) as bookmarks_file: # Offset page numbers def replaceBookmarkPageNumber(match): initial_page = int(match.group(1)) - return 'BookmarkPageNumber: ' + str(initial_page + 2) + final_page = initial_page + 2 if initial_page > 1 else initial_page + return 'BookmarkPageNumber: ' + str(final_page) metadata = re.sub('BookmarkPageNumber:\s+([0-9]+)', replaceBookmarkPageNumber, metadata) with open(bookmarks_filename, 'w') as bookmarks_file: