in src/api.py [0:0]
def get_api_page(build_mode: bool, page_path, dir_path=root_folder):
if not page_path.endswith('.html'):
page_path += '.html'
if len(titles) == 0:
try:
load_api_titles(dir_path)
except FileNotFoundError as e:
if build_mode:
raise e
else:
print("API module is not included: ", e)
file_path = path.join(dir_path, '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
}