code: def process_summary(article):
      
  
      summary = article.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()
  
          # clear memoization cache
          import functools
          if isinstance(article.get_summary, functools.partial):
              memoize_instance = article.get_summary.func.__self__
              memoize_instance.cache.clear()
  
          article._summary = "%s<script type='text/javascript'>%s</script>" % (summary, process_summary.mathjax_script)
docs: Ensures summaries are not cut off. Also inserts
      mathjax script so that math will be rendered