import re


def parse_event_file(event_path):
    """Parse event file for compact display

    **Event format:**

    - Section ::

        [9H30] rdv with truc <---- will be displayed
        Some text
        Some text again
        [14H30] rdv with muche <----- will be displayed
        Some text again again

    - header ::

        # Note Title  <---- only first line is displayed
        Some text
        Some text again...

    Parameters
    ----------
    event_path : str
        A text file path

    Returns
    -------
    str
        Parsed lines
    """

    with open(event_path, "r") as f:
        note_txt = f.read()

    # get lines with [section]
    head = list(re.findall('\[.*\].*', note_txt))

    if head: # if sections
        return '\n' + '\n'.join(head) # join them into multilines
    else: # otherwise
        return '\n' + note_txt.split("\n")[0]