Skip to content

Commit

Permalink
#3909 table popups updated to have unique ids
Browse files Browse the repository at this point in the history
  • Loading branch information
StephDriver authored and ajrbyers committed May 16, 2024
1 parent 9f9eb31 commit 8e89eea
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/journal/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,19 @@ def get_all_tables_from_html(content):
tables = []

for table in soup.findAll('div', attrs={'class': 'table-expansion'}):
original_id = table.get("id")
if original_id:
table["id"] = "copy-of-" + original_id
for child in table.descendants:
# try / except because .decendants sometimes returns a string, sometimes an object
try:
if child.get("id"):
child["id"] = "copy-of-" + child["id"]
except AttributeError:
pass
tables.append(
{
'id': table.get('id'),
'id': original_id,
'content': str(table)
}
)
Expand Down

0 comments on commit 8e89eea

Please sign in to comment.