8000 Debugging improvements. Bump to 0.6.0.5 · AramZS/python-readability@8ff11e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8ff11e6

Browse files
committed
Debugging improvements. Bump to 0.6.0.5
1 parent fcdbe56 commit 8ff11e6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

readability/debug.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def describe_node(node):
1515
name = node.tag
1616
if node.get('id', ''):
1717
name += '#' + node.get('id')
18-
if node.get('class', ''):
19-
name += '.' + node.get('class').replace(' ', '.')
18+
if node.get('class', '').strip():
19+
name += '.' + '.'.join(node.get('class').split())
2020
if name[:4] in ['div#', 'div.']:
2121
name = name[3:]
2222
if name in ['tr', 'td', 'div', 'p']:
@@ -27,7 +27,7 @@ def describe_node(node):
2727
return name
2828

2929

30-
def describe(node, depth=2):
30+
def describe(node, depth=1):
3131
global uids, uids_document
3232
doc = node.getroottree().getroot()
3333
if doc != uids_document:
@@ -37,8 +37,8 @@ def describe(node, depth=2):
3737
#return repr(NodeRepr(node))
3838
parent = ''
3939
if depth and node.getparent() is not None:
40-
parent = describe(node.getparent(), depth=depth - 1)
41-
return parent + '/' + describe_node(node)
40+
parent = describe(node.getparent(), depth=depth - 1) + '>'
41+
return parent + describe_node(node)
4242

4343

4444
RE_COLLAPSE_WHITESPACES = re.compile('\s+', re.U)

readability/readability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#'trimRe': re.compile('^\s+|\s+$/'),
3434
#'normalizeRe': re.compile('\s{2,}/'),
3535
#'killBreaksRe': re.compile('(<br\s*\/?>(\s|&nbsp;?)*){1,}/'),
36-
'videoRe': re.compile('http:\/\/(www\.)?(youtube|vimeo)\.com', re.I),
36+
'videoRe': re.compile('https?:\/\/(www\.)?(youtube|vimeo)\.com', re.I),
3737
#skipFootnoteLink: /^\s*(\[?[a-z0-9]{1,2}\]?|^|edit|citation needed)\s*$/i,
3838
}
3939

0 commit comments

Comments
 (0)
0