Closed TimW55 closed 5 years ago
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.
@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.
Gerry, Thanks very much for looking into this. I am using the readthedocs theme.
Attached is a short md file and an mkdocs.yml file which illustrate the problem. I think in my case your proposed solution should work but have no idea how generally applicable it will be.
Thanks again for sorting this out. index.md.txt mkdocs.yml.txt
Tim
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.
Gerry,
Thanks a lot. I have just tested version 1.0.1 and it is now working.
Regards
Tim
From: Gerry Ntabuhashe notifications@github.com Sent: 23 June 2019 21:12 To: comwes/mkpdfs-mkdocs-plugin mkpdfs-mkdocs-plugin@noreply.github.com Cc: TimW55 t.willans@ntlworld.com; Mention mention@noreply.github.com Subject: Re: [comwes/mkpdfs-mkdocs-plugin] Crash in mkpdfs (#1)
Hello Tim, This will definitely fix your issue.
Enjoy! Gerry N.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/comwes/mkpdfs-mkdocs-plugin/issues/1?email_source=notifications&email_token=AFOVWKLFQSIVA62Q3F5YSUTP37KKXA5CNFSM4HYPSAF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYLGB6I#issuecomment-504783097 , or mute the thread https://github.com/notifications/unsubscribe-auth/AFOVWKOL5RKADZ4S5QPG4P3P37KKXANCNFSM4HYPSAFQ . https://github.com/notifications/beacon/AFOVWKLWLBSBDYTVGMDY2DDP37KKXA5CNFSM4HYPSAF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYLGB6I.gif
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