Fix chapter excerpting to look for any Heading, not just Heading 2.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Dan Helfman 2024-01-06 10:44:23 -08:00
parent 89faad1b2b
commit 6b5dac57ff
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ $ format-novel manuscript.docx --chapters 5 6 7
This will only include chapters 5, 6, and 7 in the output file, excluding all This will only include chapters 5, 6, and 7 in the output file, excluding all
other chapters. For this to work, the input document must indicate chapter other chapters. For this to work, the input document must indicate chapter
titles with the "Heading 2" style. titles with a "Heading" style.
## Page header ## Page header

View File

@ -29,7 +29,7 @@ def filter_chapters(document, chapter_requests):
current_chapter_number = 0 current_chapter_number = 0
for paragraph in document.paragraphs: for paragraph in document.paragraphs:
if paragraph.style.name == 'Heading 2': if paragraph.style.name.startswith('Heading'):
current_chapter_number += 1 current_chapter_number += 1
if current_chapter_number not in chapter_numbers: if current_chapter_number not in chapter_numbers: