html2text: Skip generating footnotes for self-links.

Fixes the issue described at
https://www.wireshark.org/lists/wireshark-users/201912/msg00003.html

Change-Id: Ie3fd338ab1c6b216b05eeca002545868d3474bbb
Reviewed-on: https://code.wireshark.org/review/35426
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2019-12-12 09:27:03 -08:00 committed by Anders Broman
parent 64e5ae4b9d
commit 31414484d4
1 changed files with 4 additions and 0 deletions

View File

@ -118,6 +118,10 @@ class TextHTMLParser(HTMLParser):
elif self.skip_wrap:
block = data
else:
if self.href and data == self.href:
# This is a self link. Don't create a footnote.
self.href = None
# For normal text, fold multiple whitespace and strip
# leading and trailing spaces for the whole block (but
# keep spaces in the middle).