Add background_color for html/epub, change notice, bump to 4-1-1.

This commit is contained in:
Jim Miller
2011-12-14 11:54:28 -06:00
parent f9f7c6ea2a
commit 6e41e5d59a
5 changed files with 23 additions and 13 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# ffd-retief-hrd fanfictiondownloader
application: fanfictiondownloader
version: 4-1-0
version: 4-1-1
runtime: python27
api_version: 1
threadsafe: true
+4
View File
@@ -113,6 +113,10 @@ extratags: FanFiction
## Primarily for commandline.
#slow_down_sleep_time:0.5
## output background color--only used by html and epub (and ignored in
## epub by many readers). Must be hex code, # will be added.
background_color: ffffff
## Each output format has a section that overrides [defaults]
[html]
+6 -3
View File
@@ -41,7 +41,10 @@ class EpubWriter(BaseStoryWriter):
def __init__(self, config, story):
BaseStoryWriter.__init__(self, config, story)
self.EPUB_CSS='''body { margin-left: 2%; margin-right: 2%; margin-top: 2%; margin-bottom: 2%; text-align: justify; }
self.EPUB_CSS = string.Template('''
body { margin: 2%;
text-align: justify;
background-color: #${background_color}; }
pre { font-size: x-small; }
sml { font-size: small; }
h1 { text-align: center; }
@@ -63,7 +66,7 @@ h6 { text-align: center; }
.smcap {font-variant: small-caps;}
.u {text-decoration: underline;}
.bold {font-weight: bold;}
'''
''')
self.EPUB_TITLE_PAGE_START = string.Template('''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@@ -376,7 +379,7 @@ h6 { text-align: center; }
del tocncxdom
# write stylesheet.css file.
outputepub.writestr("OEBPS/stylesheet.css",self.EPUB_CSS)
outputepub.writestr("OEBPS/stylesheet.css",self.EPUB_CSS.substitute({"background_color":self.getConfig("background_color")}))
# write title page.
if self.getConfig("titlepage_use_table"):
+4
View File
@@ -39,6 +39,7 @@ class HTMLWriter(BaseStoryWriter):
<head>
<title>${title} by ${author}</title>
<style type="text/css">
body { background-color: #${background_color}; }
.CI {
text-align:center;
margin-top:0px;
@@ -94,6 +95,9 @@ class HTMLWriter(BaseStoryWriter):
def writeStoryImpl(self, out):
# minor cheat, tucking bg into metadata.
if self.getConfig("background_color"):
self.story.metadata["background_color"] = self.getConfig("background_color")
self._write(out,self.HTML_FILE_START.substitute(self.story.metadata))
self.writeTitlePage(out,
+8 -9
View File
@@ -55,21 +55,20 @@
</div>
<!-- put announcements here, h3 is a good title size. -->
<h3>This is the Official Multithreading Version</h3>
<p>
Google has changed their quota limits for free
applications using their AppEngine system, like this one.
</p>
<p>
This version of the application uses Python 2.7 and
multithreading to try and reduce our usage. Google
considers Python 2.7 Experimental still, so there may be issues.
</p>
<p>
One issue that has already cropped up is an AppEngine/Python 2.7 bug with
fetching large results from datastore. For very large
stories (~>270k words), you'll need to use
the <a href="http://4-0-7.fanfictiondownloader.appspot.com">Previous
Version</a> until this bug is fixed.
<b>Good news!</b><br />
The issue that was causing problems with downloading large stories
has been fixed.
</p>
<p>
<b>New Feature</b><br /> You can now set a custom
parameter for background_color that will be used with html
and epub output. (Note: many epub readers ignore the bg color.)
</p>
<p>
If you have any problems with this application, please