From 9515ff00be97c1b6d46879d07ccd6bf31c0121e4 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Fri, 6 May 2011 12:42:20 -0500 Subject: [PATCH] Tweak output a bit, allow any 'entry' as epub subject. --- defaults.ini | 8 ++++---- fanficdownloader/epubmerge.py | 4 ---- fanficdownloader/writers/writer_epub.py | 10 ++++++---- fanficdownloader/writers/writer_html.py | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/defaults.ini b/defaults.ini index f0029ad..eea3f4a 100644 --- a/defaults.ini +++ b/defaults.ini @@ -28,7 +28,7 @@ # formatext ## items to include in title page -titlepage_entries: category,genre,status,datePublished,dateUpdated,dateCreated,rating,warnings,numChapters,numWords,site,storyId,authorId,extratags,description +titlepage_entries: category,genre,status,datePublished,dateUpdated,dateCreated,rating,warnings,numChapters,numWords,site,description ## include title page as first page. include_titlepage: true @@ -73,10 +73,10 @@ windows_eol: true ## epub is already a zip file. zip_output: false -# possible subject tags: extratags, genre, category, warnings, lastupdate +# entries tags to make epub subject tags # lastupdate creates two tags: "Last Update Year/Month: %Y/%m" and "Last Update: %Y/%m/%d" -include_subject_tags: extratags, genre, category, lastupdate -include_tocpage: false +include_subject_tags: extratags, genre, category, lastupdate, status +#include_tocpage: false # epub->mobi conversions typically don't like tables. titlepage_use_table: true diff --git a/fanficdownloader/epubmerge.py b/fanficdownloader/epubmerge.py index 88b0bcb..9e51806 100644 --- a/fanficdownloader/epubmerge.py +++ b/fanficdownloader/epubmerge.py @@ -81,10 +81,6 @@ def main(): outputepub = ZipFile(outputopt, "w", compression=ZIP_STORED) outputepub.debug = 3 outputepub.writestr("mimetype", "application/epub+zip") - # declares all the files created by Windows. otherwise, when - # it runs in appengine, windows unzips the files as 000 perms. - for zf in outputepub.filelist: - zf.create_system = 0 outputepub.close() ## Re-open file for content. diff --git a/fanficdownloader/writers/writer_epub.py b/fanficdownloader/writers/writer_epub.py index 150ab7a..52f18dc 100644 --- a/fanficdownloader/writers/writer_epub.py +++ b/fanficdownloader/writers/writer_epub.py @@ -80,7 +80,7 @@ h6 { text-align: center; } -

${title} by ${author}

+

${title} by ${author}

''') @@ -240,8 +240,11 @@ h6 { text-align: center; } metadata.appendChild(newTag(contentdom,"dc:description",text= self.getMetadata('description'))) - metadata.appendChild(newTag(contentdom,"dc:subject",text= - self.getMetadata('status'))) + for entry in self.titleLabels.keys(): + if entry in self.getConfigList("include_subject_tags") and \ + self.story.getMetadata(entry): + metadata.appendChild(newTag(contentdom,"dc:subject",text= + self.getMetadata(entry))) # listables all go into dc:suject tags, but only if they are configured. for (name,lst) in self.story.getLists().iteritems(): if name in self.getConfigList("include_subject_tags"): @@ -394,7 +397,6 @@ h6 { text-align: center; } # declares all the files created by Windows. otherwise, when # it runs in appengine, windows unzips the files as 000 perms. - logging.debug("outputepub create_system") for zf in outputepub.filelist: zf.create_system = 0 outputepub.close() diff --git a/fanficdownloader/writers/writer_html.py b/fanficdownloader/writers/writer_html.py index 0c04008..378fb5b 100644 --- a/fanficdownloader/writers/writer_html.py +++ b/fanficdownloader/writers/writer_html.py @@ -25,7 +25,7 @@ class HTMLWriter(BaseStoryWriter): ${title} by ${author} -

${title} by ${author}

+

${title} by ${author}

''') self.HTML_TITLE_PAGE_START = string.Template('''