Better syntax for parsers

This commit is contained in:
Jake Howard 2017-05-10 17:41:49 +01:00
parent 9ea3e8e87a
commit 85f52065bc

View file

@ -5,7 +5,8 @@ import logging
logger = logging.getLogger(__file__)
def fix_references_title(content):
def fix_references_title(content, config):
logger.debug("Adding Reference Title...")
soup = BeautifulSoup(content, 'html.parser')
reference_element = soup.find('div', class_='references')
@ -31,8 +32,13 @@ def render_template(html, config):
def parse_template(doc, config):
doc = fix_references_title(doc)
doc = add_base_tag(doc, config)
return render_template(doc, config)
parsed_doc = doc
for parser in [
fix_references_title,
add_base_tag,
render_template
]:
parsed_doc = parser(parsed_doc, config)
return parsed_doc