import string


def text_to_id(text: str) -> str:
    """Convert a text (section title or similar) into an ID.

    * Punctuation and outer whitespace is stripped.
    * Each inner whitespace sequence is converted to a hyphen.
    * Letters are converted to lowercase.
    """
    text = text.strip().lower()
    text = text.translate(str.maketrans('', '', string.punctuation))
    return '-'.join(text.split())