This commit is contained in:
mrT23
2023-12-10 17:46:49 +02:00
parent 654938f27c
commit a247fc3263

View File

@ -64,9 +64,9 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
markdown_text += f"\n\n- **{emoji} Code feedback:**\n\n" markdown_text += f"\n\n- **{emoji} Code feedback:**\n\n"
else: else:
markdown_text += f"- {emoji} **{key}:**\n\n" markdown_text += f"- {emoji} **{key}:**\n\n"
for item in value: for i, item in enumerate(value):
if isinstance(item, dict) and key.lower() == 'code feedback': if isinstance(item, dict) and key.lower() == 'code feedback':
markdown_text += parse_code_suggestion(item, gfm_supported) markdown_text += parse_code_suggestion(item, i, gfm_supported)
elif item: elif item:
markdown_text += f" - {item}\n" markdown_text += f" - {item}\n"
if key.lower() == 'code feedback': if key.lower() == 'code feedback':
@ -80,7 +80,7 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
return markdown_text return markdown_text
def parse_code_suggestion(code_suggestions: dict, gfm_supported: bool=True) -> str: def parse_code_suggestion(code_suggestions: dict, i:int, gfm_supported: bool=True) -> str:
""" """
Convert a dictionary of data into markdown format. Convert a dictionary of data into markdown format.
@ -91,6 +91,8 @@ def parse_code_suggestion(code_suggestions: dict, gfm_supported: bool=True) -> s
str: A string containing the markdown formatted text generated from the input dictionary. str: A string containing the markdown formatted text generated from the input dictionary.
""" """
markdown_text = "" markdown_text = ""
if i == 0:
markdown_text += "<hr>"
if gfm_supported and 'relevant line' in code_suggestions: if gfm_supported and 'relevant line' in code_suggestions:
# markdown_text=markdown_text.strip() # markdown_text=markdown_text.strip()
markdown_text += '<table>' markdown_text += '<table>'