diff --git a/.travis.yml b/.travis.yml index 6a4e6d0..823cc71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ python: - 3.4 - 3.5 - 3.6 + - 3.7 script: true @@ -11,15 +12,6 @@ branches: - master - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ # version tags -deploy: - provider: pypi - distributions: sdist bdist_wheel - user: $PYPI_USER - password: $PYPI_PASSWORD - on: - tags: true - python: 3.6 - notifications: email: on_success: never diff --git a/mkdocs_pdf_export_plugin/plugin.py b/mkdocs_pdf_export_plugin/plugin.py index daf1c5c..271213e 100644 --- a/mkdocs_pdf_export_plugin/plugin.py +++ b/mkdocs_pdf_export_plugin/plugin.py @@ -6,7 +6,6 @@ from mkdocs.plugins import BasePlugin from mkdocs import utils - class PdfExportPlugin(BasePlugin): DEFAULT_MEDIA_TYPE = 'print' diff --git a/mkdocs_pdf_export_plugin/preprocessor/links.py b/mkdocs_pdf_export_plugin/preprocessor/links.py index 60a0f79..f5219d0 100644 --- a/mkdocs_pdf_export_plugin/preprocessor/links.py +++ b/mkdocs_pdf_export_plugin/preprocessor/links.py @@ -78,6 +78,11 @@ def transform_href(href: str, rel_url: str): elif num_hashtags is 1: section, ext = tuple(os.path.splitext(tail)) id = str.split(ext, '#')[1] + + if head == '..': + href = normalize_href(href, rel_url) + return '#{}:{}'.format(href, id) + elif num_hashtags is 0: if not is_doc(href): return href @@ -85,8 +90,6 @@ def transform_href(href: str, rel_url: str): href = normalize_href(href, rel_url) return '#{}:'.format(href) - elif num_hashtags > 1: - raise RuntimeError('Why are there so many hashtags in {}!?!?'.format(href)) return '#{}/{}:{}'.format(head, section, id) @@ -96,7 +99,10 @@ def transform_id(id: str, rel_url: str): head, tail = os.path.split(rel_url) section, _ = os.path.splitext(tail) - return '{}/{}:{}'.format(head, section, id) + if len(head) > 0: + head += '/' + + return '{}{}:{}'.format(head, section, id) def inject_body_id(url: str): section, _ = os.path.splitext(url) diff --git a/setup.py b/setup.py index c52efa7..de81103 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='mkdocs-pdf-export-plugin', - version='0.5.2', + version='0.5.3', description='An MkDocs plugin to export content pages as PDF files', long_description='The pdf-export plugin will export all markdown pages in your MkDocs repository as PDF files' 'using WeasyPrint. The exported documents support many advanced features missing in most other'