Loading updateIndex.py +8 −4 Original line number Original line Diff line number Diff line Loading @@ -29,11 +29,15 @@ def upgradeIndex(args: argparse.Namespace) -> None: dest_soup = BeautifulSoup(dest_html, 'html.parser') dest_soup = BeautifulSoup(dest_html, 'html.parser') # Find the <ul> element in both the source and destination HTML # Find the <ul> element in both the source and destination HTML source_ul = source_soup.find('ul') source_ul = source_soup.find('ul', id='document-list') dest_ul = dest_soup.find('ul') dest_ul = dest_soup.find('ul', id='document-list') # Copy the contents of the source <ul> to the destination <ul> # Copy the contents of the source <ul> to the destination <ul> if dest_ul and source_ul: dest_ul.extend(source_ul.contents) dest_ul.extend(source_ul.contents) else: print("ERROR: List not found in source and destination index files...") exit(1) # Save the updated destination HTML # Save the updated destination HTML with open('public/index.html', 'w', encoding='utf-8') as dest_updated_file: with open('public/index.html', 'w', encoding='utf-8') as dest_updated_file: Loading Loading
updateIndex.py +8 −4 Original line number Original line Diff line number Diff line Loading @@ -29,11 +29,15 @@ def upgradeIndex(args: argparse.Namespace) -> None: dest_soup = BeautifulSoup(dest_html, 'html.parser') dest_soup = BeautifulSoup(dest_html, 'html.parser') # Find the <ul> element in both the source and destination HTML # Find the <ul> element in both the source and destination HTML source_ul = source_soup.find('ul') source_ul = source_soup.find('ul', id='document-list') dest_ul = dest_soup.find('ul') dest_ul = dest_soup.find('ul', id='document-list') # Copy the contents of the source <ul> to the destination <ul> # Copy the contents of the source <ul> to the destination <ul> if dest_ul and source_ul: dest_ul.extend(source_ul.contents) dest_ul.extend(source_ul.contents) else: print("ERROR: List not found in source and destination index files...") exit(1) # Save the updated destination HTML # Save the updated destination HTML with open('public/index.html', 'w', encoding='utf-8') as dest_updated_file: with open('public/index.html', 'w', encoding='utf-8') as dest_updated_file: Loading