()
Removes empty segments from the end of any text section.
Removes empty segments from the end of any text section.
Removes empty segments from the end of any text section .
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()
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 ( )