Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in mkpdfs #1

Closed
TimW55 opened this issue Jun 15, 2019 · 5 comments
Closed

Crash in mkpdfs #1

TimW55 opened this issue Jun 15, 2019 · 5 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@TimW55
Copy link

TimW55 commented Jun 15, 2019

I am experiencing a crash in mkpdfs and hope that you can tell me what I am doing wrong.
My environment is:
O/S: Ubuntu 18.04
mkdocs: 1.0.4
mkpdfs-mkdocs: 1.0.0
weasyprint: 47
beautiful soup: 4.7.1

traceback:
File "/home/tjw/.local/lib/python3.6/site-packages/mkdocs/plugins.py", line 94, in run_event
result = method(item, **kwargs)
File "/home/tjw/.local/lib/python3.6/site-packages/mkpdfs_mkdocs/mkpdfs.py", line 58, in on_post_page
pdf_url = self.generator.add_article(output_content, page, base_url)
File "/home/tjw/.local/lib/python3.6/site-packages/mkpdfs_mkdocs/generator.py", line 64, in add_article
article = prep_combined(article, base_url, page.file.url)
File "/home/tjw/.local/lib/python3.6/site-packages/mkpdfs_mkdocs/preprocessor/prep.py", line 9, in get_combined
for id in soup.find_all(id=True):
AttributeError: 'NoneType' object has no attribute 'find_all'

It seems that in Generator.add_article article = soup.find('article') is setting article to None. I have attached a file showing the contents of soup.

soup_contents.txt

mkdocs itself is working well.

Thanks for your help.

Tim

@comwes comwes self-assigned this Jun 19, 2019
@comwes comwes added bug Something isn't working good first issue Good for newcomers labels Jun 19, 2019
@comwes
Copy link
Owner

comwes commented Jun 19, 2019

Hello @TimW55,

I have an Idea about what's the problem. This seems to be a bug in the current version. I'll do my best to work on it asap.
Just to confirm, can you provide the markdown this particular page?

Thanks,
Gerry N.

@comwes
Copy link
Owner

comwes commented Jun 20, 2019

@TimW55, I've found out where was the bug coming from. I'm working on a release for next week. The problem was located to the fact that I was assuming any theme has integrated <article></article> tag as the page content's container. Obviously this is not the case. I've seen that the default theme integrates page content in a <div role="main"></div> . I'll use these two to fetch the page content and integrate PDF link, and if any of them does not exist, the pdf version will not be generated at all.

I hope this will be an acceptable solution. If you do have another Idea just let me know.

@comwes comwes closed this as completed in 67f992f Jun 20, 2019
@comwes comwes added this to the v1.0.1 milestone Jun 20, 2019
comwes added a commit that referenced this issue Jun 21, 2019
- Documentation has been updated
- The version has been updated in the setup
@TimW55
Copy link
Author

TimW55 commented Jun 21, 2019 via email

@comwes
Copy link
Owner

comwes commented Jun 23, 2019

Hello Tim,
This will definitely fix your issue.
I've released version 1.0.1 earlier than planned.
Enjoy, and share with your friends :) !
Gerry N.

@TimW55
Copy link
Author

TimW55 commented Jun 26, 2019 via email

comwes pushed a commit that referenced this issue Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants