@@ -735,13 +735,13 @@ def convert_figcaption(self, el, text, parent_tags):
735735 def convert_td (self , el , text , parent_tags ):
736736 colspan = 1
737737 if 'colspan' in el .attrs and el ['colspan' ].isdigit ():
738- colspan = int (el ['colspan' ])
738+ colspan = max ( 1 , min ( 1000 , int (el ['colspan' ])) )
739739 return ' ' + text .strip ().replace ("\n " , " " ) + ' |' * colspan
740740
741741 def convert_th (self , el , text , parent_tags ):
742742 colspan = 1
743743 if 'colspan' in el .attrs and el ['colspan' ].isdigit ():
744- colspan = int (el ['colspan' ])
744+ colspan = max ( 1 , min ( 1000 , int (el ['colspan' ])) )
745745 return ' ' + text .strip ().replace ("\n " , " " ) + ' |' * colspan
746746
747747 def convert_tr (self , el , text , parent_tags ):
@@ -762,7 +762,7 @@ def convert_tr(self, el, text, parent_tags):
762762 full_colspan = 0
763763 for cell in cells :
764764 if 'colspan' in cell .attrs and cell ['colspan' ].isdigit ():
765- full_colspan += int (cell [" colspan" ] )
765+ full_colspan += max ( 1 , min ( 1000 , int (cell [' colspan' ])) )
766766 else :
767767 full_colspan += 1
768768 if ((is_headrow
0 commit comments