Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions sopel/modules/wiktionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def text(html):
text = text.replace('(intransitive', '(intr.')
text = text.replace('(transitive', '(trans.')
text = web.decode(text)
return text
return text.strip()


def wikt(word):
Expand All @@ -73,9 +73,13 @@ def wikt(word):

if not is_new_mode:
if (mode == 'etymology') and ('<p>' in line):
etymology = text(line)
if etymology is not None:
# multi-line etymologies do exist (e.g. see "mayhem")
etymology += ' ' + text(line)
else:
etymology = text(line)
# 'id="' can occur in definition lines <li> when <sup> tag is used for references;
# make sure those are not excluded (see e.g., abecedarian).
# make sure those are not excluded (e.g. see "abecedarian").
elif ('id="' in line) and ('<li>' not in line):
mode = None
elif (mode is not None) and ('<li>' in line):
Expand Down