@home.before_app_request
@home.before_app_first_request
def init_help():
    lines = []
    with open('webapp/static/help.txt') as help:
        lines = help.readlines()
    index = 0

    def get_help_item(lines, index):
        id = lines[index].rstrip()
        title = lines[(index + 1)].rstrip()
        content = '<p>'
        index = (index + 2)
        while (index < len(lines)):
            line = lines[index].rstrip('\n')
            index = (index + 1)
            if line.startswith('--------------------'):
                break
            if (len(line) == 0):
                line = '</p><p>'
            content = (content + line)
            if (index >= len(lines)):
                break
        content = (content + '</p>')
        return ((id, title, content), index)
    while (index < len(lines)):
        ((id, title, content), index) = get_help_item(lines, index)
        help_dict[id] = (title, content)
        if (id == 'contents'):
            session[f'__help__{id}'] = (title, content)
@home.before_app_request
@home.before_app_first_request
def init_help():
    lines = []
    with open('webapp/static/help.txt') as help:
        lines = help.readlines()
    index = 0

    def get_help_item(lines, index):
        id = lines[index].rstrip()
        title = lines[(index + 1)].rstrip()
        content = '<p>'
        index = (index + 2)
        while (index < len(lines)):
            line = lines[index].rstrip('\n')
            index = (index + 1)
            if line.startswith('--------------------'):
                break
            if (len(line) == 0):
                line = '</p><p>'
            content = (content + line)
            if (index >= len(lines)):
                break
        content = (content + '</p>')
        return ((id, title, content), index)
    while (index < len(lines)):
        ((id, title, content), index) = get_help_item(lines, index)
        help_dict[id] = (title, content)
        if (id == 'contents'):
            session[f'__help__{id}'] = (title, content)