Made chapter/act summaries optional
This commit is contained in:
parent
93b3af2c3b
commit
d79e3f5b80
@ -79,32 +79,34 @@ def main():
|
||||
word_count_by_act[act_heading] += word_count_by_chapter[chapter_heading]
|
||||
total_word_count += word_count_by_chapter[chapter_heading]
|
||||
|
||||
# Print out word counts.
|
||||
for chapter_heading, chapter_word_count in word_count_by_chapter.items():
|
||||
if chapter_heading is None:
|
||||
continue
|
||||
if '-c' in arguments or '--chapter' in arguments:
|
||||
# Print out word counts.
|
||||
for chapter_heading, chapter_word_count in word_count_by_chapter.items():
|
||||
if chapter_heading is None:
|
||||
continue
|
||||
|
||||
if len(status_by_chapter[chapter_heading]) > 1:
|
||||
print(f'chapter {chapter_heading}:')
|
||||
|
||||
if len(status_by_chapter[chapter_heading]) > 1:
|
||||
print(f'chapter {chapter_heading}:')
|
||||
for chapter_status, status_count in status_by_chapter[chapter_heading].items():
|
||||
print(f'\t {status_count:,} ({chapter_status})')
|
||||
print(f'\t {chapter_word_count:,} words (total)')
|
||||
elif len(status_by_chapter[chapter_heading]) == 1:
|
||||
chapter_status = list(status_by_chapter[chapter_heading].keys())[0]
|
||||
print(f'chapter {chapter_heading}: {chapter_word_count:,} ({chapter_status})')
|
||||
else:
|
||||
print(f'chapter {chapter_heading}: {chapter_word_count:,}')
|
||||
|
||||
for chapter_status, status_count in status_by_chapter[chapter_heading].items():
|
||||
print(f'\t {status_count:,} ({chapter_status})')
|
||||
print(f'\t {chapter_word_count:,} words (total)')
|
||||
elif len(status_by_chapter[chapter_heading]) == 1:
|
||||
chapter_status = list(status_by_chapter[chapter_heading].keys())[0]
|
||||
print(f'chapter {chapter_heading}: {chapter_word_count:,} ({chapter_status})')
|
||||
else:
|
||||
print(f'chapter {chapter_heading}: {chapter_word_count:,}')
|
||||
print()
|
||||
|
||||
if '-a' in arguments or '--act' in arguments:
|
||||
for act_heading, act_word_count in word_count_by_act.items():
|
||||
if act_heading is None:
|
||||
continue
|
||||
|
||||
print()
|
||||
print('act {}: {:,} words (~{}%)'.format(act_heading, act_word_count, act_word_count * 100 // total_word_count))
|
||||
|
||||
for act_heading, act_word_count in word_count_by_act.items():
|
||||
if act_heading is None:
|
||||
continue
|
||||
|
||||
print('act {}: {:,} words (~{}%)'.format(act_heading, act_word_count, act_word_count * 100 // total_word_count))
|
||||
print()
|
||||
|
||||
for status, status_word_count in word_count_by_status.items():
|
||||
print('{}: {:,} words (~{}%)'.format(status, status_word_count, status_word_count * 100 // total_word_count))
|
||||
|
Loading…
x
Reference in New Issue
Block a user