Spaces:
Sleeping
Sleeping
Update TLDR.py
Browse files45 unmodified lines464748495051525354555612 unmodified lines697071727374754 unmodified lines8081828384858687888990919293949545 unmodified linesdef update_mainTLDR(buttons_to_add, paper_list):main_tldr = []table_of_contents = [] # List to store the table of contents entriesif buttons_to_add:for i in range(len(buttons_to_add)):category_content = []for paper in paper_list[i]:# Create the HTML content for both links with line breaks12 unmodified linescategory_content.append(paper_content)category_column = pn.Column(pn.pane.Markdown(f"# [{buttons_to_add[i]}](#{buttons_to_add[i]}) <a id='{buttons_to_add[i]}'></a>"),pn.layout.Spacer(height=20),*category_content,pn.layout.Spacer(height=10),4 unmodified linesmain_tldr.append(category_column)# Add entry to the table of contentstable_of_contents.append(f"- [{buttons_to_add[i]}](#{buttons_to_add[i]})")else:main_tldr.append(pn.pane.Markdown("# Please select some tags!"))# Create the table of contents Markdown texttoc_text = "\n".join(table_of_contents)# Prepend the table of contents to the main contentmain_tldr.insert(0, pn.pane.Markdown(f"## Table of Contents\n{toc_text}\n"))return main_tldr45 unmodified lines4647484950515253545556575812 unmodified lines717273747576774 unmodified lines8283848586878889909192939445 unmodified linesdef update_mainTLDR(buttons_to_add, paper_list):main_tldr = []if buttons_to_add:table_of_contents = []for i in range(len(buttons_to_add)):category_content = []category_title = f"{buttons_to_add[i]}"table_of_contents.append(f"- [{category_title}](#{category_title.lower().replace(' ', '-')})")for paper in paper_list[i]:# Create the HTML content for both links with line breaks12 unmodified linescategory_content.append(paper_content)category_column = pn.Column(pn.pane.Markdown(f"# {category_title}"),pn.layout.Spacer(height=20),*category_content,pn.layout.Spacer(height=10),4 unmodified linesmain_tldr.append(category_column)# Create the table of contents Markdown texttoc_text = "\n".join(table_of_contents)# Insert the table of contents at the beginning of the main contentmain_tldr.insert(0, pn.pane.Markdown(f"## Table of Contents\n{toc_text}\n"))else:main_tldr.append(pn.pane.Markdown("# Please select some tags!"))return main_tldr
TLDR.py+10-11