mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
d713638245
@ -101,7 +101,7 @@ class EbookIterator(object):
|
||||
'''
|
||||
for item in self.opf.manifest:
|
||||
if item.mime_type and 'css' in item.mime_type.lower():
|
||||
css = open(item.path, 'rb').read().decode('utf-8')
|
||||
css = open(item.path, 'rb').read().decode('utf-8', 'replace')
|
||||
for match in re.compile(r'@font-face\s*{([^}]+)}').finditer(css):
|
||||
block = match.group(1)
|
||||
family = re.compile(r'font-family\s*:\s*([^;]+)').search(block)
|
||||
|
BIN
src/calibre/gui2/images/news/carta.png
Normal file
BIN
src/calibre/gui2/images/news/carta.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
@ -44,6 +44,7 @@ recipe_modules = ['recipe_' + r for r in (
|
||||
'stackoverflow', 'telepolis_artikel', 'zaobao', 'usnews',
|
||||
'straitstimes', 'index_hu', 'pcworld_hu', 'hrt', 'rts',
|
||||
'h1', 'h2', 'h3', 'phd_comics', 'woz_die', 'elektrolese',
|
||||
'climate_progress', 'carta',
|
||||
)]
|
||||
|
||||
import re, imp, inspect, time, os
|
||||
|
45
src/calibre/web/feeds/recipes/recipe_carta.py
Normal file
45
src/calibre/web/feeds/recipes/recipe_carta.py
Normal file
@ -0,0 +1,45 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
'''
|
||||
Fetch Carta.info.
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
|
||||
class Carta(BasicNewsRecipe):
|
||||
|
||||
title = u'Carta'
|
||||
description = 'News about electronic publishing'
|
||||
__author__ = 'Oliver Niesner'
|
||||
use_embedded_content = False
|
||||
timefmt = ' [%a %d %b %Y]'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 50
|
||||
no_stylesheets = True
|
||||
remove_javascript = True
|
||||
#html2epub_options = 'linearize_tables = True\nbase_font_size2=14'
|
||||
encoding = 'utf-8'
|
||||
language = _('German')
|
||||
|
||||
|
||||
remove_tags_after = [dict(name='p', attrs={'class':'tags-blog'})]
|
||||
|
||||
remove_tags = [dict(name='p', attrs={'class':'print'}),
|
||||
dict(name='p', attrs={'class':'tags-blog'}),
|
||||
dict(name='p', attrs={'class':'mail'}),
|
||||
dict(name='p', attrs={'style':'text-align: center;'}),
|
||||
dict(name='p', attrs={'align':'left'}),
|
||||
dict(name='p', attrs={'class':'date'}),
|
||||
dict(id='comments'),
|
||||
dict(id='headerleft'),
|
||||
dict(id='subnav'),
|
||||
dict(id='headerright')]
|
||||
|
||||
|
||||
feeds = [ (u'Carta', u'http://feeds2.feedburner.com/carta-standard-rss') ]
|
||||
|
||||
|
||||
def print_version(self, url):
|
||||
return url + 'print/'
|
47
src/calibre/web/feeds/recipes/recipe_climate_progress.py
Normal file
47
src/calibre/web/feeds/recipes/recipe_climate_progress.py
Normal file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
climateprogress.org
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
|
||||
|
||||
class ClimateProgress(BasicNewsRecipe):
|
||||
title = 'Climate Progress'
|
||||
__author__ = 'Darko Miletic'
|
||||
description = "An insider's view of climate science, politics and solutions"
|
||||
publisher = 'Climate Progress'
|
||||
category = 'news, ecology, climate, blog'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = True
|
||||
encoding = 'utf-8'
|
||||
language = _("English")
|
||||
lang = 'en-US'
|
||||
direction = 'ltr'
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment', description
|
||||
, '--category', category
|
||||
, '--publisher', publisher
|
||||
]
|
||||
|
||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
||||
|
||||
remove_tags = [dict(name='a', attrs={'rel':'bookmark'})]
|
||||
|
||||
feeds = [(u'Posts', u'http://feeds.feedburner.com/climateprogress/lCrX')]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
soup.html['lang'] = self.lang
|
||||
soup.html['dir' ] = self.direction
|
||||
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
|
||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
||||
soup.head.insert(0,mlang)
|
||||
soup.head.insert(1,mcharset)
|
||||
return self.adeify_images(soup)
|
||||
|
Loading…
x
Reference in New Issue
Block a user