From ed5668e10fcd29cacd145c6afbf97bba9e0d6142 Mon Sep 17 00:00:00 2001 From: FlorianJacta <98709993+FlorianJacta@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:31:55 +0200 Subject: [PATCH] Fix image links and rest refman --- .../extension/dynamic_element/scalar_props.md | 8 ++--- tools/_setup_generation/step_rest_refman.py | 36 +++++++++++++------ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/docs/userman/gui/extension/dynamic_element/scalar_props.md b/docs/userman/gui/extension/dynamic_element/scalar_props.md index b029ebfb7..c4cf9196e 100644 --- a/docs/userman/gui/extension/dynamic_element/scalar_props.md +++ b/docs/userman/gui/extension/dynamic_element/scalar_props.md @@ -118,8 +118,8 @@ We can see how the *label* property of the control is bound to the Python variab When you run this application, the page displays the element like this:
- - + +
Colored Label
@@ -142,7 +142,7 @@ def on_action(state, id): If the user click the button a few times, this is what the page would look like:
- - + +
With trailing random characters
diff --git a/tools/_setup_generation/step_rest_refman.py b/tools/_setup_generation/step_rest_refman.py index 8fa38ed9d..a1ab5834e 100644 --- a/tools/_setup_generation/step_rest_refman.py +++ b/tools/_setup_generation/step_rest_refman.py @@ -100,7 +100,7 @@ def get_property_type(property_desc, from_schemas): if dest_path in enterprise_paths: file.write(Setup.ENTERPRISE_BANNER) file.write(f"{dest_path_desc}\n\n") - self.navigation += f"- \"Paths for {dest_path}\": {REST_REF_DIR_PATH}/apis_{dest_path}.md\n" + self.navigation += f'- "Paths for {dest_path}": refmans/reference_rest/apis_{dest_path}.md\n' path_files[dest_path] = file file.write(f"# `{path}`\n\n") @@ -122,10 +122,16 @@ def get_property_type(property_desc, from_schemas): file.write("\n") request_body = method_desc.get("requestBody") if request_body is not None: - file.write(f'

Request body:

\n') - schema = request_body["content"]["application/json"]["schema"]["$ref"] + file.write( + f'

Request body:

\n' + ) + schema = request_body["content"]["application/json"]["schema"][ + "$ref" + ] schema = schema[schema.rfind("/") + 1 :] - file.write(f'{schema}
\n\n') + file.write( + f'{schema}
\n\n' + ) responses = method_desc.get("responses") if responses is not None: file.write(f"

Responses

\n\n") @@ -147,11 +153,17 @@ def get_property_type(property_desc, from_schemas): file.write(" |Name|Type|\n") file.write(" |---|---|\n") for property, property_desc in properties.items(): - file.write(f" |{property}|{get_property_type(property_desc, False)}|\n") + file.write( + f" |{property}|{get_property_type(property_desc, False)}|\n" + ) else: - print(f"No properties in content in response {response} in method {method} of {path}") + print( + f"No properties in content in response {response} in method {method} of {path}" + ) elif response != "404": - print(f"No content in response {response} in method {method} of {path}") + print( + f"No content in response {response} in method {method} of {path}" + ) file.write("\n") for f in path_files.values(): @@ -165,12 +177,14 @@ def get_property_type(property_desc, from_schemas): file.write("|Name|Type|Description|\n") file.write("|---|---|---|\n") for property, property_desc in properties.items(): - file.write(f"|{property}|{get_property_type(property_desc, True)}|-|\n") + file.write( + f"|{property}|{get_property_type(property_desc, True)}|-|\n" + ) file.write("\n") - self.navigation += "- \"Schemas\": " + REST_REF_DIR_PATH + "/schemas.md\n" - + self.navigation += '- "Schemas": ' + "refmans/reference_rest/schemas.md\n" def exit(self, setup: Setup): setup.update_mkdocs_yaml_template( - r"^\s*\[REST_REFERENCE_CONTENT\]\s*\n", self.navigation if self.navigation else "" + r"^\s*\[REST_REFERENCE_CONTENT\]\s*\n", + self.navigation if self.navigation else "", )