New template and options for Service-Based-View #61

Merged
zuul merged 15 commits from template_sbv into main 2023-04-20 13:10:19 +00:00
3 changed files with 76 additions and 1 deletions
Showing only changes of commit 389bc4bdaa - Show all commits

View File

@ -181,7 +181,8 @@ 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"]))) sbv_title = (service["service_title"] + "\n"
+ ('=' * len(service["service_title"])))
context["sbv_title"] = sbv_title context["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(**context) index_sbv_content = index_sbv_template.render(**context)
@ -192,7 +193,8 @@ def process_repositories(args, service):
out.write(conf_py_content) out.write(conf_py_content)
repo_to.index.add(pathlib.Path(copy_path, "conf.py")) repo_to.index.add(pathlib.Path(copy_path, "conf.py"))
if not args.overwrite_index_sbv and pathlib.Path(copy_path, "index.rst").exists(): if (not args.overwrite_index_sbv
and pathlib.Path(copy_path, "index.rst").exists()):
logging.info("File index.rst for sbv exists. Skipping") logging.info("File index.rst for sbv exists. Skipping")
else: else:
with open( with open(
@ -201,7 +203,11 @@ def process_repositories(args, service):
encoding="utf-8") as out: encoding="utf-8") as out:
out.write(index_sbv_content) out.write(index_sbv_content)
repo_to.index.add(pathlib.Path(copy_path, "index.rst")) repo_to.index.add(pathlib.Path(copy_path, "index.rst"))
placeholder_path = pathlib.Path(copy_path, "_static")
if not placeholder_path.exists():
placeholder_path.mkdir(parents=True, exist_ok=True)
open(pathlib.Path(placeholder_path, ".placeholder"), 'a').close()
if args.update_tox: if args.update_tox:
context = dict(docs=[]) context = dict(docs=[])