-
Notifications
You must be signed in to change notification settings - Fork 2k
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
#5460 Make JS refactoring compatible with old templates #5500
#5460 Make JS refactoring compatible with old templates #5500
Conversation
* Inject ``documentation_options.js`` script as part of HTML build * Set attributes of the script accordingly * Remove script reference from basic template (would be duplication) * Add fallback for URL_ROOT variable
Codecov Report
@@ Coverage Diff @@
## master #5500 +/- ##
==========================================
+ Coverage 83.08% 83.08% +<.01%
==========================================
Files 289 289
Lines 38795 38801 +6
Branches 5842 5843 +1
==========================================
+ Hits 32231 32237 +6
Misses 5200 5200
Partials 1364 1364
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would not work with old themes. Because they has not used js_tag()
function. It was added in 1.8.
To support them, we need to modify #5207. They did not read documentation_options.js
.
Thanks for reviewing, @tk0miya. The idea of the change is the following:
Or am I missing something? |
I just tested this commit with sphinx-rtd-theme 0.4.1 tag, and it seems to work. Maybe you can change the base branch from master to 1.8 (and rebase accordingly)? |
Great, I'll wait for feedback from @tk0miya and rebase then. |
@tk0miya Sorry for pinging you again, but could you take a look at my justification above? |
We have four generations for searching mechanism:
I think current I think reverting #5207 would fix the situation. |
@@ -87,7 +87,6 @@ <h3>{{ _('Navigation') }}</h3> | |||
{%- endmacro %} | |||
|
|||
{%- macro script() %} | |||
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As commented above, 3rd generation themes does not use js_tag()
helper. So this would not be moved.
In addition, to support this tag by js_tag()
, we have to give a special code for this like you modified. I feel it is too much.
How about moving stemmer, scorer, word-splitter and SEARCH_LANGUAGE_STOP_WORDS to a separate JS file (e.g. @tk0miya Will you accept a pull request implementing such a change? |
Merged #5590 instead. So I'm closing this now. |
Subject: Make JS refactoring compatible with old templates
Feature or Bugfix
Purpose
Detail
This is my attempt of fixing this issue.
Feedback on implementation details are appreciated.
documentation_options.js
script as part of HTML buildRelates