Spaces:
Runtime error
Runtime error
config_list = [ | |
{ | |
"type": "Doism", | |
"source": "Tao Te Ching", | |
"URL": "https://www.with.org/tao_te_ching_en.pdf", | |
}, | |
{ | |
"type": "Confucianism", | |
"source": "The Analects of Confucius", | |
"URL": "https://chinatxt.sitehost.iu.edu/Analects_of_Confucius_(Eno-2015).pdf", | |
}, | |
# Add more dictionaries as needed | |
] | |
def generate_source_table(): | |
# Define the headers for the table | |
headers = ["Type", "Name", "URL"] | |
# Create the Markdown string for the headers | |
header_str = " | ".join(headers) | |
# Create the Markdown string for the header separator | |
separator_str = " | ".join(["---"] * len(headers)) | |
# Initialize an empty list to hold the rows | |
rows = [] | |
# Add each row to the list | |
for config in config_list: | |
row = [ | |
config.get("type", ""), | |
config.get("source", ""), | |
config.get("URL", ""), | |
] | |
row_str = " | ".join(row) | |
rows.append(row_str) | |
# Combine all the parts into the final Markdown table | |
markdown_table = header_str + "\n" + separator_str + "\n" + "\n".join(rows) | |
return markdown_table | |