Skip to content

Download role not appearing with Sphinx 1.8 #4765

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

Closed
aradi opened this issue Oct 16, 2018 · 8 comments
Closed

Download role not appearing with Sphinx 1.8 #4765

aradi opened this issue Oct 16, 2018 · 8 comments
Labels
Support Support question

Comments

@aradi
Copy link

aradi commented Oct 16, 2018

Details

Expected Result

  • Generating an HTML document with working download links.

Actual Result

*Download links are missing in the HTML output.

@stsewd
Copy link
Member

stsewd commented Oct 16, 2018

I can see the download links here https://readthedocs.org/projects/aradi-rtdtest/downloads/ and
screenshot_2018-10-16 test chapter rtd test documentation

@stsewd stsewd added the Needed: more information A reply from issue author is required label Oct 16, 2018
@aradi
Copy link
Author

aradi commented Oct 17, 2018

Sorry, my formulation was misleading. If you look at the generated HTML document https://aradi-rtdtest.readthedocs.io/en/latest/rtdtest.html, the links for the two files are missing, which were added via the :download: role to the RST-source. The original RST-source is:

Test chapter
============

Download button for some input file:

.. only :: builder_html

   See :download:`full input 1 <_downloads/md1/dftb_in.hsd>` and
   :download:`full input 2 <_downloads/md2/dftb_in.hsd>`

Finished.

@stsewd
Copy link
Member

stsewd commented Oct 17, 2018

The links are relative to the current file or if you want to put absolute links, it need to begin with /

http://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-download

@stsewd stsewd added the Support Support question label Oct 17, 2018
@aradi
Copy link
Author

aradi commented Oct 18, 2018

As the _downloads folder is in the same folder as the RST-source file (in docs/) it should work in my opinion. If I build the HTML locally using sphinx 1.8, the download links in the generated HTML appear as expected. Further the build log on Readthedocs seems also to indicate, that the :download: role was used correctly, as the referenced files are copied:

copying downloadable files... [ 50%] _downloads/md1/dftb_in.hsd
copying downloadable files... [100%] _downloads/md2/dftb_in.hsd

@stsewd
Copy link
Member

stsewd commented Oct 18, 2018

I guess the _downloads folder is colliding somehow with the folder from sphinx?

@aradi
Copy link
Author

aradi commented Oct 19, 2018

I don't think so:

  • On my local system, building with Sphinx 1.8 produces the right HTML page.
  • I've renamed _downloads into _mydownloads. On my local system, it still works. On readthedocs it's still broken. Although Sphinx apparently recognizes the :download: role and the associated files
copying downloadable files... [ 50%] _mydownloads/md1/dftb_in.hsd
copying downloadable files... [100%] _mydownloads/md2/dftb_in.hsd

the appropriate links in the HTML page still do not show up.

@stsewd
Copy link
Member

stsewd commented Oct 22, 2018

I was looking a little more into this issue, I realized that you are using .. only :: builder_html, rtd uses a custom builder called readthedocs. So, you should use .. only :: builder_html or readthedocs. I tested this locally and it works

screenshot_2018-10-22 test chapter rtd test documentation

@stsewd stsewd removed the Needed: more information A reply from issue author is required label Oct 22, 2018
@aradi
Copy link
Author

aradi commented Oct 23, 2018

Works perfectly, thank you very much for your time! 😄

@aradi aradi closed this as completed Oct 23, 2018
sdhiscocks added a commit to sdhiscocks/sphinx-gallery that referenced this issue Jun 4, 2020
larsoner pushed a commit to sphinx-gallery/sphinx-gallery that referenced this issue Jun 5, 2020
* Enable html to be rendered on readthedocs

Per comment: readthedocs/readthedocs.org#4765 (comment)

* Remove `only` directive for raw html

The `raw` directive already covers the case for non-html builders to
ignore raw html block

* Fix tests for raw html in gen_rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support Support question
Projects
None yet
Development

No branches or pull requests

2 participants