Better syntax for parsers
This commit is contained in:
parent
9ea3e8e87a
commit
85f52065bc
1 changed files with 10 additions and 4 deletions
|
@ -5,7 +5,8 @@ import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__file__)
|
logger = logging.getLogger(__file__)
|
||||||
|
|
||||||
def fix_references_title(content):
|
|
||||||
|
def fix_references_title(content, config):
|
||||||
logger.debug("Adding Reference Title...")
|
logger.debug("Adding Reference Title...")
|
||||||
soup = BeautifulSoup(content, 'html.parser')
|
soup = BeautifulSoup(content, 'html.parser')
|
||||||
reference_element = soup.find('div', class_='references')
|
reference_element = soup.find('div', class_='references')
|
||||||
|
@ -31,8 +32,13 @@ def render_template(html, config):
|
||||||
|
|
||||||
|
|
||||||
def parse_template(doc, config):
|
def parse_template(doc, config):
|
||||||
doc = fix_references_title(doc)
|
parsed_doc = doc
|
||||||
doc = add_base_tag(doc, config)
|
for parser in [
|
||||||
return render_template(doc, config)
|
fix_references_title,
|
||||||
|
add_base_tag,
|
||||||
|
render_template
|
||||||
|
]:
|
||||||
|
parsed_doc = parser(parsed_doc, config)
|
||||||
|
return parsed_doc
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue