added emdash prefix code to fix latexml bug

This commit is contained in:
Juicysteak117
2025-10-11 13:43:15 -07:00
parent 0aff9b7280
commit 05aaf36127
3 changed files with 30 additions and 23 deletions

10
soup.py
View File

@@ -18,6 +18,11 @@ header.append(menu)
# Extract nav
toc = soup.body.find('div', class_='ltx_page_main').nav.extract()
# correcting a bug in latexml that drops em dash prefixes on toc in html output
toc_emdashes = toc.select('a[href*="SSx"] > span')
for line in toc_emdashes:
line.string.insert_before('')
# adding a toast
toast = soup.new_tag (
"div",
@@ -29,6 +34,7 @@ toast = soup.new_tag (
soup.body.insert(0, toast, header, toc)
# Add header info tags
# i don't know if there's a better way to do all of these in a batch but like eh w/e
head_meta = soup.new_tag(
'meta',
@@ -97,7 +103,7 @@ head_meta = soup.new_tag(
soup.head.append(head_meta)
soup.head.append("\n")
# find all the section and question headers then add a click to copy
# find all the section and question headers then add a click to copy icon
for element in soup.find_all(["h2", "h3"]):
#find the id of its section
hash = element.parent['id']
@@ -113,7 +119,7 @@ for element in soup.find_all(["h2", "h3"]):
element.append(new_chain)
# i'm at soup
print("soup")
# Write the updated soup back out to the file