diff --git a/src/calibre/ebooks/epub/__init__.py b/src/calibre/ebooks/epub/__init__.py index 6132505dc2..4f6cc6337f 100644 --- a/src/calibre/ebooks/epub/__init__.py +++ b/src/calibre/ebooks/epub/__init__.py @@ -19,7 +19,7 @@ class DefaultProfile(object): class PRS505(DefaultProfile): - flow_size = 300000 + flow_size = 270000 screen_size = (600, 775) remove_special_chars = re.compile(u'[\u200b\u00ad]') diff --git a/src/calibre/ebooks/html.py b/src/calibre/ebooks/html.py index dc5d33d93a..044c3390df 100644 --- a/src/calibre/ebooks/html.py +++ b/src/calibre/ebooks/html.py @@ -719,6 +719,7 @@ class Processor(Parser): return id self.external_stylesheets, self.stylesheet = [], self.css_parser.parseString('') + self.specified_override_css = [] for link in self.root.xpath('//link'): if 'css' in link.get('type', 'text/css').lower(): file = os.path.join(self.tdir, *(link.get('href', '').split('/'))) @@ -743,6 +744,7 @@ class Processor(Parser): for style in self.root.xpath('//style'): if 'css' in style.get('type', 'text/css').lower(): + override_css = style.get('title', '') == 'override_css' raw = '\n'.join(style.xpath('./text()')) css = self.preprocess_css(raw) try: @@ -751,7 +753,10 @@ class Processor(Parser): self.log_debug('Failed to parse style element') else: for rule in sheet: - self.stylesheet.add(rule) + if override_css: + self.specified_override_css.append(rule) + else: + self.stylesheet.add(rule) style.getparent().remove(style) cache = {} class_counter = 0 @@ -806,6 +811,8 @@ class Processor(Parser): if self.opts.remove_paragraph_spacing: css += '\n\np {text-indent: 2em; margin-top:1pt; margin-bottom:1pt; padding:0pt; border:0pt;}' self.override_css = self.css_parser.parseString(self.preprocess_css(css)) + for rule in reversed(self.specified_override_css): + self.override_css.insertRule(rule, index=0) def config(defaults=None, config_name='html', diff --git a/src/calibre/ebooks/metadata/opf.xml b/src/calibre/ebooks/metadata/opf.xml index 6cb70c5b1e..6bf52a83d3 100644 --- a/src/calibre/ebooks/metadata/opf.xml +++ b/src/calibre/ebooks/metadata/opf.xml @@ -11,7 +11,7 @@ ${'%s (%s)'%(__appname__, __version__)} [http://${__appname__}.kovidgoyal.net] ${mi.application_id} - ${mi.language if mi.language else 'Unknown'} + ${mi.language if mi.language else 'UND'} ${mi.category} ${mi.comments} ${mi.publisher} diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index e40f5beb61..13d7d0eb19 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -474,7 +474,7 @@ class BasicNewsRecipe(object, LoggingInterface): if self.extra_css is not None: head = soup.find('head') if head: - style = BeautifulSoup(u''%self.extra_css).find('style') + style = BeautifulSoup(u''%self.extra_css).find('style') head.insert(len(head.contents), style) if first_fetch and job_info: url, f, a, feed_len = job_info diff --git a/src/calibre/web/feeds/recipes/atlantic.py b/src/calibre/web/feeds/recipes/atlantic.py index 8952698b44..1eb59ddd88 100644 --- a/src/calibre/web/feeds/recipes/atlantic.py +++ b/src/calibre/web/feeds/recipes/atlantic.py @@ -16,8 +16,8 @@ class TheAtlantic(BasicNewsRecipe): INDEX = 'http://www.theatlantic.com/doc/current' remove_tags_before = dict(name='div', id='storytop') - remove_tags = [dict(name='div', id='seealso')] - extra_css = '#bodytext {line-height: 1}' + remove_tags = [dict(name='div', id=['seealso', 'storybottom', 'footer'])] + no_stylesheets = True def parse_index(self): articles = [] diff --git a/upload.py b/upload.py index f5b9d97a32..9797f3dde8 100644 --- a/upload.py +++ b/upload.py @@ -102,7 +102,7 @@ def build_osx(shutdown=True): def build_linux(shutdown=True): installer = installer_name('tar.bz2') vm = '/vmware/linux/libprs500-gentoo.vmx' - start_vm(vm, 'linux', (BUILD_SCRIPT%('sudo python setup.py develop', 'python','installer/linux/freeze.py')).replace('rm ', 'sudo rm '), sleep=100) + start_vm(vm, 'linux', (BUILD_SCRIPT%('sudo python setup.py develop', 'python','installer/linux/freeze.py')).replace('rm ', 'sudo rm '), sleep=120) subprocess.check_call(('scp', 'linux:/tmp/%s'%os.path.basename(installer), 'dist')) if not os.path.exists(installer): raise Exception('Failed to build installer '+installer)