Skip to content
Snippets Groups Projects
Commit 6264950d authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Adding checking if document-list is found in index files

parent bec9268b
No related branches found
No related tags found
No related merge requests found
...@@ -29,11 +29,15 @@ def upgradeIndex(args: argparse.Namespace) -> None: ...@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment