mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-05-03 04:14:35 +02:00
Fix for fallback metadata labels, plus allow other text in titlepage_entries.
This commit is contained in:
parent
b8bc2cecb6
commit
57dc8eb12e
4 changed files with 23 additions and 4 deletions
|
|
@ -66,7 +66,9 @@ extratags_label:Extra Tags
|
|||
version_label:FFDL Version
|
||||
|
||||
## items to include in the title page
|
||||
## Empty entries will *not* appear, even if in the list.
|
||||
## Empty metadata entries will *not* appear, even if in the list.
|
||||
## You can include extra text or HTML that will be included as-is in
|
||||
## the title page. Eg: titlepage_entries: ...,<br />,summary,<br />,...
|
||||
## All current formats already include title and author.
|
||||
titlepage_entries: series,category,genre,language,characters,status,datePublished,dateUpdated,dateCreated,rating,warnings,numChapters,numWords,site,description
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,17 @@ class Configurable(object):
|
|||
def addConfigSection(self,section):
|
||||
self.sectionslist.insert(0,section)
|
||||
|
||||
def hasConfig(self, key):
|
||||
for section in self.sectionslist:
|
||||
try:
|
||||
self.config.get(section,key)
|
||||
print("found %s in section [%s]"%(key,section))
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
def getConfig(self, key):
|
||||
val = ""
|
||||
for section in self.sectionslist:
|
||||
|
|
|
|||
|
|
@ -149,18 +149,22 @@ class BaseStoryWriter(Configurable):
|
|||
TEMPLATE=WIDE_ENTRY
|
||||
else:
|
||||
TEMPLATE=ENTRY
|
||||
if self.getConfigList(entry):
|
||||
|
||||
if self.hasConfig(entry+"_label"):
|
||||
label=self.getConfig(entry+"_label")
|
||||
else:
|
||||
print("Using fallback label for %s_label"%entry)
|
||||
label=self.titleLabels[entry]
|
||||
|
||||
# If the label for the title entry is empty, use the
|
||||
# 'no title' option if there is one.
|
||||
# 'no title' option if there is one.
|
||||
if label == "" and NO_TITLE_ENTRY:
|
||||
TEMPLATE= NO_TITLE_ENTRY
|
||||
|
||||
self._write(out,TEMPLATE.substitute({'label':label,
|
||||
'value':self.story.getMetadata(entry)}))
|
||||
else:
|
||||
self._write(out, entry)
|
||||
|
||||
self._write(out,END.substitute(self.story.metadata))
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,9 @@ extratags_label:Extra Tags
|
|||
version_label:FFDL Version
|
||||
|
||||
## items to include in the title page
|
||||
## Empty entries will *not* appear, even if in the list.
|
||||
## Empty metadata entries will *not* appear, even if in the list.
|
||||
## You can include extra text or HTML that will be included as-is in
|
||||
## the title page. Eg: titlepage_entries: ...,<br />,summary,<br />,...
|
||||
## All current formats already include title and author.
|
||||
titlepage_entries: series,category,genre,language,characters,status,datePublished,dateUpdated,dateCreated,rating,warnings,numChapters,numWords,site,description
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue