diff --git a/html2text.py b/html2text.py index 17528901..0d32f9c8 100755 --- a/html2text.py +++ b/html2text.py @@ -174,9 +174,12 @@ def google_fixed_width_font(style): def list_numbering_start(attrs): """extract numbering from list element attributes""" if 'start' in attrs: - return int(attrs['start']) - 1 - else: - return 0 + try: + return int(attrs['start']) - 1 + except ValueError: + pass + + return 0 class HTML2Text(HTMLParser.HTMLParser): def __init__(self, out=None, baseurl=''): diff --git a/test/invalid_start.html b/test/invalid_start.html new file mode 100644 index 00000000..0e49fe53 --- /dev/null +++ b/test/invalid_start.html @@ -0,0 +1,8 @@ + +
+