def process_summary(article):
 summary = article._get_summary()
 summary_parsed = BeautifulSoup(summary, 'html.parser')
 math = summary_parsed.find_all(class_='math')
 if (len(math) > 0):
  last_math_text = math[(-1)].get_text()
  if ((len(last_math_text) > 3) and (last_math_text[(-3):] == '...')):
   content_parsed = BeautifulSoup(article._content, 'html.parser')
   full_text = content_parsed.find_all(class_='math')[(len(math) - 1)].get_text()
   math[(-1)].string = ('%s ...' % full_text)
   summary = summary_parsed.decode()
  article._summary = ("%s<script type='text/javascript'>%s</script>" % (summary, process_summary.mathjax_script))

def process_summary ( article ) : summary = article . _get_summary ( ) summary_parsed = BeautifulSoup ( summary , 'html.parser' ) math = summary_parsed . find_all ( class_ = 'math' ) if ( len ( math ) > 0 ) : last_math_text = math [ ( - 1 ) ] . get_text ( ) if ( ( len ( last_math_text ) > 3 ) and ( last_math_text [ ( - 3 ) : ] == '...' ) ) : content_parsed = BeautifulSoup ( article . _content , 'html.parser' ) full_text = content_parsed . find_all ( class_ = 'math' ) [ ( len ( math ) - 1 ) ] . get_text ( ) math [ ( - 1 ) ] . string = ( '%s ...' % full_text ) summary = summary_parsed . decode ( ) article . _summary = ( "%s<script type='text/javascript'>%s</script>" % ( summary , process_summary . mathjax_script ) )
ensures summaries are not cut off .