mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1669 (xkcd recipe improvement: bubble help)
This commit is contained in:
parent
2eb29ed5ca
commit
e32744eb6d
@ -5,7 +5,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
Fetch xkcd.
|
Fetch xkcd.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import time
|
import time, re
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class XkcdCom(BasicNewsRecipe):
|
class XkcdCom(BasicNewsRecipe):
|
||||||
@ -17,6 +17,11 @@ class XkcdCom(BasicNewsRecipe):
|
|||||||
keep_only_tags = [dict(id='middleContent')]
|
keep_only_tags = [dict(id='middleContent')]
|
||||||
remove_tags = [dict(name='ul'), dict(name='h3'), dict(name='br')]
|
remove_tags = [dict(name='ul'), dict(name='h3'), dict(name='br')]
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
# turn image bubblehelp into a paragraph
|
||||||
|
preprocess_regexps = [
|
||||||
|
(re.compile(r'(<img.*title=")([^"]+)(".*>)'),
|
||||||
|
lambda m: '%s%s<p>%s</p>' % (m.group(1), m.group(3), m.group(2)))
|
||||||
|
]
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
INDEX = 'http://xkcd.com/archive/'
|
INDEX = 'http://xkcd.com/archive/'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user