mirror of
https://github.com/wassname/FanFicFare.git
synced 2026-09-10 11:40:24 +08:00
Add add_chapter_numbers: toconly option.
This commit is contained in:
+9
-6
@@ -184,10 +184,14 @@ keep_summary_html:true
|
||||
## Don't like the numbers at the start of chapter titles on some
|
||||
## sites? You can use strip_chapter_numbers to strip them off. Just
|
||||
## want to make them all look the same? Strip them off, then add them
|
||||
## back on with add_chapter_numbers. Don't like the way it strips
|
||||
## numbers or adds them back? See chapter_title_strip_pattern and
|
||||
## chapter_title_add_pattern.
|
||||
## back on with add_chapter_numbers:true. Only want them added back
|
||||
## on for Table of Contents(toc)? Use add_chapter_numbers:toconly.
|
||||
## (toconly doesn't work on mobi output.) Don't like the way it
|
||||
## strips numbers or adds them back? See chapter_title_strip_pattern
|
||||
## and chapter_title_add_pattern.
|
||||
strip_chapter_numbers:false
|
||||
|
||||
## add_chapter_numbers can be true, false or toconly
|
||||
add_chapter_numbers:false
|
||||
|
||||
## (Two versions of chapter_title_strip_pattern are shown below. You
|
||||
@@ -556,9 +560,8 @@ cliches_label:Character Cliches
|
||||
## specific entries to titlepage/logpage without having to copy the
|
||||
## entire titlepage_entries line. (But if you want them higher than
|
||||
## the end, you will need to copy titlepage_entries.)
|
||||
#extra_titlepage_entries: themes,hermiones,dracos,timeline,cliches
|
||||
|
||||
## adds to include_subject_tags instead of replacing it.
|
||||
#extra_titlepage_entries: themes,timeline,cliches
|
||||
#extra_logpage_entries: themes,timeline,cliches
|
||||
#extra_subject_tags: themes,timeline,cliches
|
||||
|
||||
[erosnsappho.sycophanthex.com]
|
||||
|
||||
@@ -411,11 +411,12 @@ class Story(Configurable):
|
||||
title = re.sub(self.getConfig('chapter_title_strip_pattern'),"",title)
|
||||
self.chapters.append( (title,html) )
|
||||
|
||||
def getChapters(self):
|
||||
def getChapters(self,fortoc=False):
|
||||
"Chapters will be tuples of (title,html)"
|
||||
retval = []
|
||||
if self.getConfig('add_chapter_numbers') and \
|
||||
self.getConfig('chapter_title_add_pattern'):
|
||||
if (self.getConfig('add_chapter_numbers') == "true" \
|
||||
or (self.getConfig('add_chapter_numbers') == "toconly" and fortoc)) \
|
||||
and self.getConfig('chapter_title_add_pattern'):
|
||||
for index, (title,html) in enumerate(self.chapters):
|
||||
retval.append( (string.Template(self.getConfig('chapter_title_add_pattern')).substitute({'index':index+1,'title':title}),html) )
|
||||
else:
|
||||
|
||||
@@ -148,7 +148,7 @@ class BaseStoryWriter(Configurable):
|
||||
if len(self.story.getChapters()) > 1 and self.getConfig("include_tocpage") and not self.metaonly :
|
||||
self._write(out,START.substitute(self.story.getAllMetadata()))
|
||||
|
||||
for index, (title,html) in enumerate(self.story.getChapters()):
|
||||
for index, (title,html) in enumerate(self.story.getChapters(fortoc=True)):
|
||||
if html:
|
||||
self._write(out,ENTRY.substitute({'chapter':title, 'index':"%04d"%(index+1)}))
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ div { margin: 0pt; padding: 0pt; }
|
||||
items.append(("log_page","OEBPS/log_page.xhtml","application/xhtml+xml","Update Log"))
|
||||
itemrefs.append("log_page")
|
||||
|
||||
for index, (title,html) in enumerate(self.story.getChapters()):
|
||||
for index, (title,html) in enumerate(self.story.getChapters(fortoc=True)):
|
||||
if html:
|
||||
i=index+1
|
||||
items.append(("file%04d"%i,
|
||||
|
||||
+7
-6
@@ -168,10 +168,14 @@ keep_summary_html:true
|
||||
## Don't like the numbers at the start of chapter titles on some
|
||||
## sites? You can use strip_chapter_numbers to strip them off. Just
|
||||
## want to make them all look the same? Strip them off, then add them
|
||||
## back on with add_chapter_numbers. Don't like the way it strips
|
||||
## numbers or adds them back? See chapter_title_strip_pattern and
|
||||
## chapter_title_add_pattern.
|
||||
## back on with add_chapter_numbers:true. Only want them added back
|
||||
## on for Table of Contents(toc)? Use add_chapter_numbers:toconly.
|
||||
## (toconly doesn't work on mobi output.) Don't like the way it
|
||||
## strips numbers or adds them back? See chapter_title_strip_pattern
|
||||
## and chapter_title_add_pattern.
|
||||
strip_chapter_numbers:false
|
||||
|
||||
## add_chapter_numbers can be true, false or toconly
|
||||
add_chapter_numbers:false
|
||||
|
||||
## (Two versions of chapter_title_strip_pattern are shown below. You
|
||||
@@ -557,9 +561,6 @@ cliches_label:Character Cliches
|
||||
# themes=>#bcolumn,a
|
||||
# timeline=>#ccolumn,n
|
||||
|
||||
## adds to include_subject_tags instead of replacing it.
|
||||
#extra_subject_tags: themes,timeline,cliches
|
||||
|
||||
[erosnsappho.sycophanthex.com]
|
||||
## Site dedicated to these categories/characters/ships
|
||||
extracategories:Harry Potter
|
||||
|
||||
Reference in New Issue
Block a user