New template
Some checks are pending
gl/check check status: pending (756aac375024350ccf5cb0d6a39f3149510213c3)

This commit is contained in:
2023-04-18 09:53:29 +00:00
parent c597690ecd
commit 756aac3750
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,7 @@
{{ sbv_title }}
.. directive_wrapper::
:class: container-sbv
.. service_card::
:service_type: {{ service_type }}

View File

@ -48,8 +48,10 @@ def process_repositories(args, service):
env = Environment( env = Environment(
loader=PackageLoader("otc_metadata"), autoescape=select_autoescape() loader=PackageLoader("otc_metadata"), autoescape=select_autoescape()
) )
print(env.list_templates())
conf_py_template = env.get_template("conf.py.j2") conf_py_template = env.get_template("conf.py.j2")
tox_ini_template = env.get_template("tox.ini.j2") tox_ini_template = env.get_template("tox.ini.j2")
index_sbv_template = env.get_template("index_sbv.rst.j2")
doc_requirements_template = env.get_template("doc_requirements.txt.j2") doc_requirements_template = env.get_template("doc_requirements.txt.j2")
for repo in service["repositories"]: for repo in service["repositories"]:
@ -162,6 +164,7 @@ def process_repositories(args, service):
project=service["service_title"], project=service["service_title"],
# pdf_name=doc["pdf_name"], # pdf_name=doc["pdf_name"],
title=f"{service['service_title']} - Service Based View", title=f"{service['service_title']} - Service Based View",
service_type=service["service_type"]
) )
copy_path = pathlib.Path(copy_to, 'doc', 'source') copy_path = pathlib.Path(copy_to, 'doc', 'source')
if not copy_path.exists(): if not copy_path.exists():
@ -178,13 +181,22 @@ def process_repositories(args, service):
site_name="Internal Documentation Portal", site_name="Internal Documentation Portal",
logo_url="https://docs-int.otc-service.com", logo_url="https://docs-int.otc-service.com",
) )
sbv_title = (service["service_title"] + "\n" + ('=' * len(service["service_title"])))
content["sbv_title"] = sbv_title
conf_py_content = conf_py_template.render(**context) conf_py_content = conf_py_template.render(**context)
index_sbv_content = index_sbv_template.render(**content)
with open( with open(
pathlib.Path(copy_path, "conf.py"), pathlib.Path(copy_path, "conf.py"),
"w", "w",
encoding="utf-8") as out: encoding="utf-8") as out:
out.write(conf_py_content) out.write(conf_py_content)
with open(
pathlib.Path(copy_path, "index.rst"),
"w",
encoding="utf-8") as out:
out.write(index_sbv_content)
repo_to.index.add(pathlib.Path(copy_path, "conf.py")) repo_to.index.add(pathlib.Path(copy_path, "conf.py"))
repo_to.index.add(pathlib.Path(copy_path, "index.rst"))
if args.update_tox: if args.update_tox:
context = dict(docs=[]) context = dict(docs=[])