Skip to content

Commit

Permalink
'path_to_pdf' now supports externals URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
timvink committed Jun 12, 2023
1 parent ee13622 commit dfe98f8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mkdocs_print_site_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from mkdocs_print_site_plugin.renderer import Renderer
from mkdocs_print_site_plugin.utils import flatten_nav, get_theme_name
from mkdocs_print_site_plugin.urls import is_external

logger = logging.getLogger("mkdocs.plugins")
logger.addFilter(warning_filter)
Expand Down Expand Up @@ -231,9 +232,14 @@ def on_page_content(self, html, page, config, files, **kwargs):

# Link to the PDF version of the entire site on a page.
if self.config.get("path_to_pdf") != "":
page.url_to_pdf = get_relative_url(
self.config.get("path_to_pdf"), page.file.url
)
pdf_url = self.config.get("path_to_pdf")
if is_external(pdf_url):
page.url_to_pdf = pdf_url
else:
breakpoint()
page.url_to_pdf = get_relative_url(
pdf_url, page.file.url
)

return html

Expand Down

0 comments on commit dfe98f8

Please sign in to comment.