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__) 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