Skip to content

Commit

Permalink
Merge pull request #8 from yoctocell/toc
Browse files Browse the repository at this point in the history
修正目录里的页码
  • Loading branch information
rabbull authored Nov 13, 2024
2 parents 7bebbac + e00b4d0 commit 250e949
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ def generate_toc(nodes: List[DocTreeNode], tempdir) -> List[tuple[int, str, int]
toc_no_page_numbers = list(map(lambda node: node.toc_entry, nodes))
toc = []
page_number = 1
if COVER_PDF_PATH:
with pymupdf.open(COVER_PDF_PATH) as cover_page:
page_number += cover_page.page_count
for index, node in enumerate(nodes):
(title, level) = toc_no_page_numbers[index]
path = os.path.join(tempdir, f'{index}.pdf')
Expand Down

0 comments on commit 250e949

Please sign in to comment.