Skip to content

Commit

Permalink
reverted to on_page_markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
stard0g committed Jun 24, 2020
1 parent 35e9128 commit 536896d
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions markdownextradata/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,8 @@ def on_pre_build(self, config):
),
)

def on_page_read_source(self, page, config, **kwargs):
def on_page_markdown(self, markdown, config, **kwargs):
context = {key: config.get(key) for key in CONFIG_KEYS if key in config}
context.update(config.get("extra", {}))
try:
with open(page.file.abs_src_path, 'r', encoding='utf-8-sig', errors='strict') as f:
md_template = Template(f.read())
return md_template.render(**config.get("extra"))
except OSError:
log.error('File not found: {}'.format(self.file.src_path))
raise
except ValueError:
log.error('Encoding error reading file: {}'.format(self.file.src_path))
raise
md_template = Template(markdown)
return md_template.render(**config.get("extra"))

0 comments on commit 536896d

Please sign in to comment.