Split collection and injection of footnotes into two functions.
This commit is contained in:
parent
4c5f416e2c
commit
5195b3a560
1 changed files with 3 additions and 1 deletions
|
@ -96,7 +96,7 @@ def remove_empty_elements(html):
|
||||||
return html
|
return html
|
||||||
|
|
||||||
@soup_cleaner
|
@soup_cleaner
|
||||||
def inject_footnotes(soup):
|
def collect_footnotes(soup):
|
||||||
footnotes = soup.find_all('blockquote', {'class': 'gcufootnote_content'})
|
footnotes = soup.find_all('blockquote', {'class': 'gcufootnote_content'})
|
||||||
for footnote in footnotes:
|
for footnote in footnotes:
|
||||||
try:
|
try:
|
||||||
|
@ -111,6 +111,8 @@ def inject_footnotes(soup):
|
||||||
|
|
||||||
global_footnotes[footnote_id] = footnote
|
global_footnotes[footnote_id] = footnote
|
||||||
|
|
||||||
|
@soup_cleaner
|
||||||
|
def inject_footnotes(soup):
|
||||||
footnote_links = soup.find_all('span', {'class': 'gcufootnote_link'})
|
footnote_links = soup.find_all('span', {'class': 'gcufootnote_link'})
|
||||||
for footnote_link in reversed(footnote_links):
|
for footnote_link in reversed(footnote_links):
|
||||||
if len(footnote_link.contents) != 1:
|
if len(footnote_link.contents) != 1:
|
||||||
|
|
Loading…
Reference in a new issue