Closed ErikThorsell closed 3 years ago
In addition, I think the plugin is not compatible with literate-nav
. Specifically, I have added a set of nav
entries together with an automatic entry for "anything in this folder". There's over a hundred files in there, so managing them with a complete nav is infeasible, but leaving out the nav
option orders the sections incorrectly.
Would definitely like to see these add-ons supported in this plugin! :smiley:
Hi @ErikThorsell. Sorry for the late reply.
The exclude_pages
option does not support partial URLs.
Please set.
- with-pdf:
verbose: true
exclude_pages:
- a_folder/file_in_folder_1/
# - a_folder/file_in_folder_2/
and check logs:
DEBUG - (post: [Overview]()
DEBUG - (post: [Back](back/)
INFO - Page skipped: [File 1 in a folder](a_folder/file_in_folder_1/) <--- MATCH exclude_pages URL
DEBUG - (post: [File in folder 2](a_folder/file_in_folder_2/) <--- UN-MATCH
INFO - Number headings up to level 3.
Hi @orzih, thank you for getting back to me.
I tested your proposal and it does indeed achieve the wanted result. However, in my actual use case I maintain ~10 projects, each project with directories like (a_folder/
) which in turn contain ~20 files, and the number of files keeps growing every week. Keeping the mkdocs.yml
file up-to-date with each file will simply not be feasible.
Would it be possible to extend the plugin to support ignoring directories (and the content of the directory)? If you are willing to point me in the right direction I can start a PR and help out with the implementation.
The code related to this issue can be found here: https://github.com/orzih/mkdocs-with-pdf/blob/65f36ba383b022627df54db00d885d9e06dedd09/mkdocs_with_pdf/generator.py#L43-L53
and, Welcome to submit a PR.
@ErikThorsell, PR Thanks.
As a result of checking, it was not possible to support 'use_directory_urls: false'
, so I changed it to pattern matching.
Please check it.
@orzih, I see good that you caught it.
For the future, there are no tests anywhere that tests all combinations of settings, right?
Regarding your change (using re.Pattern
); I have tested v.0.9.0 on the following Python versions:
❌ Python 3.6.10
✅ Python 3.7.10
✅ Python 3.9.4
In the release notes for v0.9.0 you wrote Drop support for Python 3.5., but it seems like it should really be: Drop support for Python < 3.7.
When I try to generate the .pdf-file with Python 3.6.10 I get the following error:
AttributeError: module 're' has no attribute 'Pattern'
I skimmed through the src difference between 3.6 and 3.7 and they have added line 264 to 3.7: Pattern = type(sre_compile.compile('', 0))
.
I leave to you to decide whether you want the plugin to drop support for 3.6 as well.
@ErikThorsell Thank you for your reporting.
For the future, there are no tests anywhere that tests all combinations of settings, right?
Yes. (...please anyone help ^^;)
I fixed a runtime bug in Python 3.6.x in v0.9.2.
@orzih, I verified 0.9.2 with 3.6.10, I think we can conclude this issue :)
GG WP 🤜🤛
I have run into an issue which might be related to https://github.com/orzih/mkdocs-with-pdf/issues/46.
The problem is that I am unable to use
exclude_pages
together withawesome-pages
. Basically, if I use the...
in my mkdocs.yaml file, to have awesome-pages automatically add pages tonav
, theexclude_pages
functionality stops working.I have created MWE in this repository: https://github.com/ErikThorsell/mkdocs_with_pdf-exclude_pages-bug. The key thing is Line 26 in the mkdocs.yaml (link), please see the inline comment.
Please let me know if there's anything I can do to assist you further in debugging the issue.