Exemple #1
0
def process_api_page(page_path):
    file_path = path.join(root_folder, 'api', page_path)
    if not path.exists(file_path):
        return make_response("Api page " + page_path + " not found", 404)
    with open(file_path) as html_file:
        html_content = BeautifulSoup(html_file.read(), 'html.parser')
        html_content = process_code_blocks(html_content)
        html_content = process_header_ids(html_content)
        return render_template('api.html', page_content=html_content)
Exemple #2
0
def get_api_page(page_path):
    if not page_path.endswith('.html'):
        page_path += '.html'
    if len(titles) == 0:
        load_api_titles()
    file_path = path.join(root_folder, 'api', page_path)
    if not path.exists(file_path):
        return None
    with open(file_path) as html_file:
        html_content = BeautifulSoup(html_file.read(), 'html.parser')
        html_content = process_code_blocks(html_content)
        html_content = process_header_ids(html_content)
        return {
            "title": titles[page_path],
            "content": html_content
        }
Exemple #3
0
def get_api_page(build_mode: bool, page_path):
    if not page_path.endswith('.html'):
        page_path += '.html'
    if len(titles) == 0:
        try:
            load_api_titles()
        except FileNotFoundError as e:
            if build_mode:
                raise e
            else:
                print("API module is not included: ", e)

    file_path = path.join(root_folder, 'api', page_path)
    if not path.exists(file_path):
        return None
    with open(file_path) as html_file:
        html_content = BeautifulSoup(html_file.read(), 'html.parser')
        html_content = process_code_blocks(html_content)
        html_content = process_header_ids(html_content)
        return {"title": titles[page_path], "content": html_content}
Exemple #4
0
def get_api_page(build_mode: bool, page_path):
    if not page_path.endswith('.html'):
        page_path += '.html'
    if len(titles) == 0:
        try:
            load_api_titles()
        except FileNotFoundError as e:
            if build_mode:
                raise e
            else:
                print("API module is not included: ", e)

    file_path = path.join(root_folder, 'api', page_path)
    if not path.exists(file_path):
        return None
    with open(file_path) as html_file:
        html_content = BeautifulSoup(html_file.read(), 'html.parser')
        html_content = process_code_blocks(html_content)
        html_content = process_header_ids(html_content)
        return {
            "title": titles[page_path],
            "content": html_content
        }