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)
def get_kotlin_features(): features_dir = path.join(os.path.dirname(__file__), "kotlin-features") features = [] for feature_meta in yaml.load(open(path.join(features_dir, "kotlin-features.yml"))): file_path = path.join(features_dir, feature_meta['content_file']) with open(file_path, encoding='utf-8') as f: content = f.read() content = content.replace("\r\n", "\n") if file_path.endswith(".md"): html_content = BeautifulSoup(jinja_aware_markdown(content, pages), 'html.parser') content = process_code_blocks(html_content) features.append(Feature(content, feature_meta)) return features
def get_kotlin_features(): features_dir = path.join(os.path.dirname(__file__), "kotlin-features") features = [] for feature_meta in yaml.load(open(path.join(features_dir, "kotlin-features.yml"))): file_path = path.join(features_dir, feature_meta['content_file']) with open(file_path, encoding='utf-8') as f: content = f.read() content = content.replace("\r\n", "\n") if file_path.endswith(".md"): html_content = BeautifulSoup(jinja_aware_markdown(content, pages), 'html.parser') content = process_code_blocks(html_content) features.append(Feature(content, feature_meta)) return features
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 }
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}
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 }
def parsed_html(self): return process_code_blocks( BeautifulSoup(self.unprocessed_html, 'html.parser'))
def parsed_html(self): return process_code_blocks(BeautifulSoup(self.unprocessed_html, 'html.parser'))