def remove_libraries()

in check-release-notes/main.py [0:0]


def remove_libraries(html):
    """
    Remove the libraries section (e.g. <h3>Libraries</h3>...) from the release notes
    because this section tends to be very verbose and doesn't display well in Chat.
    Replace it with a generic <h3>Libraries Updated</h3> section.
    Args:
        html: The html from which to remove the libraries section
    Returns:
        The html with the libraries section removed
    """
    if re.search(r"<h3>Libraries</h3>(.|\n)*?<h3>", html):
        html = re.sub(
            r"<h3>Libraries</h3>(.|\n)*?<h3>", "<h3>Libraries Updated</h3>\n<h3>", html
        )
    elif "<h3>Libraries</h3>" in html:
        # This is the case where the libraries section is the last section
        # so there won't be a <h3> tag after it
        html = re.sub(r"<h3>Libraries</h3>(.|\n)*", "<h3>Libraries Updated</h3>", html)
    return html