Skip to content

Commit

Permalink
Merge pull request #311 from WindSoilder/master
Browse files Browse the repository at this point in the history
fit new stackoverflow css class
  • Loading branch information
gleitz committed Sep 13, 2020
2 parents 793b7ef + 4a6bab4 commit 0372788
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions howdoi/howdoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,18 @@ def _get_answer(args, links):
instructions = first_answer.find('pre') or first_answer.find('code')
args['tags'] = [t.text for t in html('.post-tag')]

# make decision on answer body class.
if first_answer.find(".js-post-body"):
answer_body_cls = ".js-post-body"
else:
# rollback to post-text class
answer_body_cls = ".post-text"

if not instructions and not args['all']:
text = get_text(first_answer.find('.post-text').eq(0))
text = get_text(first_answer.find(answer_body_cls).eq(0))
elif args['all']:
texts = []
for html_tag in first_answer.items('.post-text > *'):
for html_tag in first_answer.items('{} > *'.format(answer_body_cls)):
current_text = get_text(html_tag)
if current_text:
if html_tag[0].tag in ['pre', 'code']:
Expand Down

0 comments on commit 0372788

Please sign in to comment.