From 96b7aa92d3975334d8ce5b1af61b128ff2b7892e Mon Sep 17 00:00:00 2001 From: Dennis Iversen Date: Wed, 22 Jan 2025 13:47:55 +0100 Subject: [PATCH] tweak getting simple record data a bit --- stadsarkiv_client/core/utils_core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stadsarkiv_client/core/utils_core.py b/stadsarkiv_client/core/utils_core.py index df3d689b..a6ed2626 100644 --- a/stadsarkiv_client/core/utils_core.py +++ b/stadsarkiv_client/core/utils_core.py @@ -59,7 +59,7 @@ def get_record_and_types_as_html(data: Dict[str, Any], keys_to_parse: List[str], return parsed_data -def get_record_and_types_as_strings(data: Dict[str, Any], keys_to_parse: List[str], section_tag: str = "p") -> Dict[str, str]: +def get_record_and_types_as_strings(data: Dict[str, Any], keys_to_parse: List[str]) -> Dict[str, str]: """ Parses specific keys in a JSON dictionary into plain text, removing hyperlinks but keeping structure. """ @@ -112,13 +112,13 @@ def get_parsed_data_as_str(data: Dict[str, Any], keys_to_parse: List[str]) -> st Parses specific keys and returns the data as a single formatted string. """ section_tag = "div" - parsed_data = get_record_and_types_as_strings(data, keys_to_parse, "p") + parsed_data = get_record_and_types_as_strings(data, keys_to_parse) html = "" for key, value in parsed_data.items(): key_translated = translate("label_" + key) - html += f"<{section_tag}>{key_translated}: {value}" + html += f"<{section_tag}>{key_translated} ({key}): {value}" return html