1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2026-01-08 16:48:24 +01:00

Better fallback for no-title case on chapters

This commit is contained in:
David Lynch 2018-10-01 11:12:52 -05:00
parent f17b040f64
commit 8f8d7b1edd

View file

@ -74,11 +74,12 @@ class CoverOptions:
def chapter_html(story, titleprefix=None):
chapters = []
for i, chapter in enumerate(story):
title = chapter.title or '#{}'.format(i)
if hasattr(chapter, '__iter__'):
# This is a Section
chapters.extend(chapter_html(chapter, titleprefix=chapter.title))
chapters.extend(chapter_html(chapter, titleprefix=title))
else:
title = titleprefix and '{}: {}'.format(titleprefix, chapter.title) or chapter.title
title = titleprefix and '{}: {}'.format(titleprefix, title) or title
chapters.append((
title,
'{}/chapter{}.html'.format(story.id, i + 1),