diff --git a/app.yaml b/app.yaml index fc1d1eb..852b064 100644 --- a/app.yaml +++ b/app.yaml @@ -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 diff --git a/defaults.ini b/defaults.ini index d591fb0..713caff 100644 --- a/defaults.ini +++ b/defaults.ini @@ -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] diff --git a/fanficdownloader/writers/writer_epub.py b/fanficdownloader/writers/writer_epub.py index ec9b11d..7b3fac2 100644 --- a/fanficdownloader/writers/writer_epub.py +++ b/fanficdownloader/writers/writer_epub.py @@ -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(''' @@ -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"): diff --git a/fanficdownloader/writers/writer_html.py b/fanficdownloader/writers/writer_html.py index 32d27d6..cec520a 100644 --- a/fanficdownloader/writers/writer_html.py +++ b/fanficdownloader/writers/writer_html.py @@ -39,6 +39,7 @@ class HTMLWriter(BaseStoryWriter):