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

Deprecate the custom RTD builders (except local media) #88

Merged
merged 5 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions readthedocs_ext/_static/readthedocs-data.js_t

This file was deleted.

13 changes: 7 additions & 6 deletions readthedocs_ext/_templates/readthedocs-insert.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ http://docs.readthedocs.org/en/latest/canonical.html

<link rel="stylesheet" href="{{ rtd_css_url }}" type="text/css" />

<script type="text/javascript" src="{{ pathto('_static/readthedocs-data.js', 1) }}"></script>
<script type="application/json" id="READTHEDOCS_DATA">{{ rtd_data | tojson }}</script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little worried about this possibly breaking things that users are depending on (eg. they are including this file themselves to get our data back out). I wonder if we should continue to build the file but not link it, at least for some time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is possible that this will break things for some users, I don't think it will do so in a systemic way for many users (say by breaking a theme). We maintain the global variable which was set in readthedocs-data.js for backwards compatibility and given that some page and suffix data was modified in that global below, nobody could correctly read the variable without parsing both the HTML and JS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but only the page was set in the HTML instead of the JS, so if they just were reading eg. the project or version, it would have worked fine. I think continuing to ship the file for now seems easy enough and minimal risk.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will see if it's possibly to produce the file from an extension rather than from a builder. When producing the file, perhaps I'll add a note into the file noting that it is deprecated and will be removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't spend too much time if it's a pain, but shipping static files is pretty standard for extensions, so I think it should be simple enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to use the same function where the inline JSON is generated so they're the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually a little difficult to do this in a consistent way. I might skip it.

  • I want to write that file, but only once per build
  • I need the context which is in the html-page-context but I don't want to rewrite the same file for every page.
  • I can't just detect if the file exists because the file might be there if the environment is re-used.


<!-- Add page-specific data, which must exist in the page js, not global -->
<!--
Using this variable directly instead of using `JSON.parse` is deprecated.
The READTHEDOCS_DATA global variable will be removed in the future.
-->
<script type="text/javascript">
READTHEDOCS_DATA['page'] = {{ pagename|tojson }}
{%- if page_source_suffix %}
READTHEDOCS_DATA['source_suffix'] = {{ page_source_suffix|tojson }}
{%- endif %}
READTHEDOCS_DATA = JSON.parse(document.getElementById('READTHEDOCS_DATA').innerHTML);
</script>

<script type="text/javascript" src="{{ rtd_analytics_url }}" async="async"></script>
<script type="text/javascript" src="{{ rtd_js_url }}" async="async"></script>

<!-- end RTD <extrahead> -->
71 changes: 0 additions & 71 deletions readthedocs_ext/mixins.py

This file was deleted.

Loading