Spaces:
Sleeping
Sleeping
Update TLDR.py
Browse files
TLDR.py
CHANGED
|
@@ -46,6 +46,8 @@ def run_code(category, loaded_dict, event = None):
|
|
| 46 |
def update_mainTLDR(buttons_to_add, paper_list):
|
| 47 |
main_tldr = []
|
| 48 |
|
|
|
|
|
|
|
| 49 |
if buttons_to_add:
|
| 50 |
for i in range(len(buttons_to_add)):
|
| 51 |
category_content = []
|
|
@@ -78,7 +80,16 @@ def update_mainTLDR(buttons_to_add, paper_list):
|
|
| 78 |
|
| 79 |
main_tldr.append(category_column)
|
| 80 |
|
|
|
|
|
|
|
|
|
|
| 81 |
else:
|
| 82 |
main_tldr.append(pn.pane.Markdown("# Please select some tags!"))
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
return main_tldr
|
|
|
|
| 46 |
def update_mainTLDR(buttons_to_add, paper_list):
|
| 47 |
main_tldr = []
|
| 48 |
|
| 49 |
+
table_of_contents = [] # List to store the table of contents entries
|
| 50 |
+
|
| 51 |
if buttons_to_add:
|
| 52 |
for i in range(len(buttons_to_add)):
|
| 53 |
category_content = []
|
|
|
|
| 80 |
|
| 81 |
main_tldr.append(category_column)
|
| 82 |
|
| 83 |
+
# Add entry to the table of contents
|
| 84 |
+
table_of_contents.append(f"- [{buttons_to_add[i]}](#{buttons_to_add[i]})")
|
| 85 |
+
|
| 86 |
else:
|
| 87 |
main_tldr.append(pn.pane.Markdown("# Please select some tags!"))
|
| 88 |
|
| 89 |
+
# Create the table of contents Markdown text
|
| 90 |
+
toc_text = "\n".join(table_of_contents)
|
| 91 |
+
|
| 92 |
+
# Prepend the table of contents to the main content
|
| 93 |
+
main_tldr.insert(0, pn.pane.Markdown(f"## Table of Contents\n{toc_text}\n"))
|
| 94 |
+
|
| 95 |
return main_tldr
|