From b839fe28ee574c9dd362484a9648dee06a2d0101 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 4 Apr 2017 22:04:25 +0100 Subject: [PATCH] Add more logging --- md_pdf/build/__init__.py | 2 +- md_pdf/build/cover.py | 2 +- md_pdf/build/pandoc.py | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/md_pdf/build/__init__.py b/md_pdf/build/__init__.py index ce2b772..2774aab 100644 --- a/md_pdf/build/__init__.py +++ b/md_pdf/build/__init__.py @@ -9,7 +9,7 @@ logger = logging.getLogger(__file__) def build(config): - logger.info("Starting Build...") + logger.debug("Starting Build...") data = read_files(os.path.abspath(config['input'])) doc = build_document(data, config.get('bibliography'), config.get('context')) if 'html' in config['output_formats']: diff --git a/md_pdf/build/cover.py b/md_pdf/build/cover.py index 7856f2e..d0a8b5c 100644 --- a/md_pdf/build/cover.py +++ b/md_pdf/build/cover.py @@ -11,7 +11,7 @@ OUTPUT_COVER_FILE = os.path.join(ASSET_DIR, 'cover.html') def render_cover(config): - logger.info("Rendering Cover...") + logger.debug("Rendering Cover...") context = config['context'].copy() context['title'] = config['title'] with open(COVER_TEMPLATE) as f: diff --git a/md_pdf/build/pandoc.py b/md_pdf/build/pandoc.py index 5921578..984a631 100644 --- a/md_pdf/build/pandoc.py +++ b/md_pdf/build/pandoc.py @@ -9,6 +9,7 @@ logger = logging.getLogger(__file__) def fix_references_title(content): + logger.debug("Adding Reference Title...") soup = BeautifulSoup(content, 'html.parser') reference_element = soup.find('div', class_='references') if reference_element is not None: @@ -19,11 +20,13 @@ def fix_references_title(content): def output_html(html, out_dir): + logger.info("Outputting HTML...") with open(os.path.join(out_dir, 'output.html'), 'w') as f: f.write(html) def parse_template(html, context): + logger.debug("Rendering Template...") template = Template(html) return template.render(context) @@ -39,7 +42,7 @@ def build_document(files_content, bibliography, context): '--csl={}'.format(os.path.join(CSL_DIR, "{}.csl".format(bibliography['csl']))) ] filters.append('pandoc-citeproc') - logger.info("Rendering HTML...") + logger.info("Rendering Document...") html = fix_references_title(pypandoc.convert_text( files_content, 'html',