diff --git a/defaults.ini b/defaults.ini index 566581e..575b039 100644 --- a/defaults.ini +++ b/defaults.ini @@ -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: ...,
,summary,
,... ## 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 diff --git a/fanficdownloader/configurable.py b/fanficdownloader/configurable.py index a9be13e..d5fee5d 100644 --- a/fanficdownloader/configurable.py +++ b/fanficdownloader/configurable.py @@ -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: diff --git a/fanficdownloader/writers/base_writer.py b/fanficdownloader/writers/base_writer.py index f386ef3..7f23084 100644 --- a/fanficdownloader/writers/base_writer.py +++ b/fanficdownloader/writers/base_writer.py @@ -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)) diff --git a/plugin-defaults.ini b/plugin-defaults.ini index eab030e..3c4e093 100644 --- a/plugin-defaults.ini +++ b/plugin-defaults.ini @@ -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: ...,
,summary,
,... ## 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