def create_index(self):
"""
Creates an HTML index page to redirect to an MkDocs generated page.
"""
from jinja2 import Environment, PackageLoader, select_autoescape
env = Environment(
loader=PackageLoader('wikidoc', 'templates'),
autoescape=select_autoescape(['html', 'xml'])
)
template = env.get_template('redirect.html')
html_code = template.render(target_url=self._index)
file_name = os.path.join(self._out_dir, "index.html")
if not os.path.exists(file_name):
with open(file_name, "w") as index_file:
index_file.write(html_code)
评论列表
文章目录