parameters: ()
docstring: Removes empty segments from the end of any text section.
docstring_summary: Removes empty segments from the end of any text section.
docstring_tokens: Removes empty segments from the end of any text section .
function: def remove_trailing_empty_segments():
      """
      Removes empty segments from the end of any text section.
      """
      texts = model.VersionSet()
      for text in texts:
          if not model.Ref.is_ref(text.title):
              continue # Ignore text versions we don't understand
          new_text = rtrim_jagged_string_array(deepcopy(text.chapter))
          if new_text != text.chapter:
              print(text.title + " CHANGED")
              text.chapter = new_text
              text.save()
              model.VersionState(text.title).refresh()
function_tokens: def remove_trailing_empty_segments ( ) : texts = model . VersionSet ( ) for text in texts : if not model . Ref . is_ref ( text . title ) : continue # Ignore text versions we don't understand new_text = rtrim_jagged_string_array ( deepcopy ( text . chapter ) ) if new_text != text . chapter : print ( text . title + " CHANGED" ) text . chapter = new_text text . save ( ) model . VersionState ( text . title ) . refresh ( )