From d67668de230bcb3e17c388abc4acef4dcd29b112 Mon Sep 17 00:00:00 2001 From: wsuetholz Date: Tue, 9 Nov 2010 18:20:37 -0600 Subject: [PATCH] Changes to the format of the title page. Tried to fix the description field on the title page and the contents.opf page. --- constants.py | 43 ++++++++++++++++--------------------------- output.py | 11 +++++++++-- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/constants.py b/constants.py index 6ea1f08..9f14afb 100644 --- a/constants.py +++ b/constants.py @@ -2,12 +2,14 @@ CSS = '''body { margin-left: 5%; margin-right: 5%; margin-top: 5%; margin-bottom: 5%; text-align: justify; } pre { font-size: x-small; } +sml { font-size: small; } h1 { text-align: center; } h2 { text-align: center; } h3 { text-align: center; } h4 { text-align: center; } h5 { text-align: center; } h6 { text-align: center; } +h7 { text-align: left; font-size: large; font-weight: bold; } .CI { text-align:center; margin-top:0px; @@ -26,34 +28,21 @@ h6 { text-align: center; } MIMETYPE = '''application/epub+zip''' TITLE_PAGE = ''' -%s - %s -
-

%s

-

by %s

-
+%s - %s +

%s by %s

- - - - - - - - - - - - - - - - - - - - -
Category:%s
Genre:%s
Status:%s
Published:%s
Updated:%s
Packaged:%s
Rating Age/User:%s / %s
Chapters/Words:%s / %s
URL:

%s

Summary:
%s
-
+Category:%s +Genre:%s +Status:%s +Published:%s +Updated:%s +Packaged:%s +Rating Age/User:%s / %s +Chapters/Words:%s / %s + +

URL:


%s

+

Summary:
%s

+ ''' CONTAINER = ''' diff --git a/output.py b/output.py index 9ffb150..e756ca5 100644 --- a/output.py +++ b/output.py @@ -236,15 +236,22 @@ class EPubFanficWriter(FanficWriter): updated = self.adapter.getStoryUpdated().strftime("%Y-%m-%d") calibre = self.adapter.getStoryUpdated().strftime("%Y-%m-%dT%H:%M:%S") + description = self.adapter.getStoryDescription() + if hasattr(description, "text"): + description = str(description.text) + else: + description = str(description) + if description is not None and len(description) > 0: + description = removeEntities(description.replace(' ',' ').replace('’','')) ### writing content -- title page titleFilePath = "OEBPS/title_page.xhtml" - self._writeFile(titleFilePath, TITLE_PAGE % (self.authorName, self.storyTitle, self.adapter.getStoryURL(), self.storyTitle, self.adapter.getAuthorURL(), self.authorName, self.adapter.getCategory(), self.adapter.getGenre(), self.adapter.getStoryStatus(), published, updated, createda, self.adapter.getStoryRating(), self.adapter.getStoryUserRating(), self.adapter.getNumChapters(), self.adapter.getNumWords(), self.adapter.getStoryURL(), self.adapter.getStoryURL(), self.adapter.getStoryDescription())) + self._writeFile(titleFilePath, TITLE_PAGE % (self.authorName, self.storyTitle, self.adapter.getStoryURL(), self.storyTitle, self.adapter.getAuthorURL(), self.authorName, self.adapter.getCategory(), self.adapter.getGenre(), self.adapter.getStoryStatus(), published, updated, createda, self.adapter.getStoryRating(), self.adapter.getStoryUserRating(), self.adapter.getNumChapters(), self.adapter.getNumWords(), self.adapter.getStoryURL(), self.adapter.getStoryURL(), description)) ### writing content -- opf file opfFilePath = "OEBPS/content.opf" # opf = open(opfFilePath, 'w') - self._writeFile(opfFilePath, CONTENT_START % (uuid.uuid4().urn, self.storyTitle, self.authorName, self.adapter.getLanguageId(), published, created, updated, calibre, self.adapter.getStoryDescription())) + self._writeFile(opfFilePath, CONTENT_START % (uuid.uuid4().urn, self.storyTitle, self.authorName, self.adapter.getLanguageId(), published, created, updated, calibre, description)) i = 0 subjs = []