Skip to content

Commit

Permalink
Fix bug where mkdocs build could have wrong path to print-site CSS an…
Browse files Browse the repository at this point in the history
…d JS, see #62
  • Loading branch information
timvink committed Jan 12, 2022
1 parent 450e087 commit c042b24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions mkdocs_print_site_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ def on_template_context(self, context, template_name, config, **kwargs):
# print(f"\nName: {template_name}\nContext: {context.get('extra_css')}")
if template_name == "404.html":
self.context = context
# Make sure paths are OK
if config.get('extra_css'):
self.context['extra_css'] = [get_relative_url(f, self.print_page.file.url) for f in config.get('extra_css')]
if config.get('extra_javascript'):
self.context['extra_javascript'] = [get_relative_url(f, self.print_page.file.url) for f in config.get('extra_javascript')]


def on_post_build(self, config, **kwargs):
"""
Expand Down Expand Up @@ -297,6 +303,7 @@ def on_post_build(self, config, **kwargs):

# Get the info for MkDocs to be able to apply a theme template on our print page
env = config["theme"].get_env()
# env.list_templates()
template = env.get_template("main.html")
self.context["page"] = self.print_page
# Render the theme template for the print page
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="mkdocs-print-site-plugin",
version="2.2.2",
version="2.2.3",
description="MkDocs plugin that combines all pages into one, allowing for easy export to PDF and standalone HTML.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit c042b24

Please sign in to comment.