Fix api-ref parsing

openstackdocstheme changes got merged and we need to adopt to it.

Change-Id: I4781e311e332d0837036eb4225a3fcca2116572c
This commit is contained in:
Artem Goncharov 2025-04-10 17:28:31 +02:00
parent 2c5a228684
commit 4e919bf8c0

View File

@ -78,9 +78,9 @@ def merge_api_ref_doc(
ep = op.find("div", class_="endpoint-container")
ep_divs = ep.find_all("div")
url = doc_url_prefix + "".join(ep_divs[0].strings)
summary = "".join(ep_divs[1].strings)
summary = "".join(ep_divs[1].strings).strip("\n")
method_span = op.find("div", class_="operation").find(
"span", class_="label"
"span", class_=lambda tag: tag.startswith("label")
)
method = method_span.string
@ -173,7 +173,9 @@ def merge_api_ref_doc(
# Find the button in the operaion container to get ID of the
# details section
details_button = op.find("button")
details_section_id = details_button["data-target"].strip("#")
details_section_id = details_button.get(
"data-target", details_button.get("data-bs-target")
).lstrip("#")
details_section = section.find(
"section", id=details_section_id
)
@ -550,4 +552,6 @@ def rst_to_md(content: str) -> str:
def get_sanitized_description(descr: str) -> LiteralScalarString:
return LiteralScalarString(md(descr, escape_underscores=False).rstrip())
return LiteralScalarString(
md(descr.strip("\n"), escape_underscores=False).rstrip()
)