Commit 474510f2 authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Fix documentation (#2407)

Summary:
This commit fixes multiple issues with documentation.

https://output.circle-artifacts.com/output/job/23245537-e57b-4b9d-9b81-b3df20996d1f/artifacts/0/docs/tutorials/audio_resampling_tutorial.html

1. Duplicated requirejs
The nbsphinx extension introduced in https://github.com/pytorch/audio/pull/2393 pulled a requirejs
which caused the initialization script to halt.
As a result, the right side bar was left uninitialized.

2. Undefined variable error
It turned out that PyTorch's theme expected the downstream projects
to define `collapsedSections` variable.
Currently console log shows `collapsedSections is not defined`.
As a result of this fix, we start to see the + symbol on left side.

3. Fix the behavior of default expand
Tweaks the right-side bar initialization behavior
so that expand-all only happens once, not at every resize.

4. Overwrite the link to GitHub
The `GitHub` tab in main-menu always linked PyTorch core.
This commit adds overwrite to torchaudio page

Pull Request resolved: https://github.com/pytorch/audio/pull/2407

Reviewed By: carolineechen

Differential Revision: D36612904

Pulled By: mthrok

fbshipit-source-id: 56aa7623a8925a241cf4790ac77a87424ad9237c
parent 38e530d7
...@@ -54,7 +54,9 @@ ...@@ -54,7 +54,9 @@
#} #}
{%- block footer %} {%- block footer %}
<script type="text/javascript">
var collapsedSections = []
</script>
{{ super() }} {{ super() }}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
...@@ -69,8 +71,17 @@ ...@@ -69,8 +71,17 @@
$(".pytorch-call-to-action-links a[data-response='Run in Google Colab']").attr("href", colabLink); $(".pytorch-call-to-action-links a[data-response='Run in Google Colab']").attr("href", colabLink);
$(".pytorch-call-to-action-links a[data-response='View on Github']").attr("href", githubLink); $(".pytorch-call-to-action-links a[data-response='View on Github']").attr("href", githubLink);
} }
var overwrite = function(_) {
if ($(this).length > 0) {
$(this)[0].href = "https://github.com/pytorch/audio"
}
}
// PC
$(".main-menu a:contains('GitHub')").each(overwrite);
// Mobile
$(".main-menu a:contains('Github')").each(overwrite);
}); });
</script>
{% if 'tutorial' in pagename %} {% if 'tutorial' in pagename %}
{# {#
...@@ -79,11 +90,12 @@ ...@@ -79,11 +90,12 @@
# Based off of # Based off of
# https://github.com/pytorch/pytorch_sphinx_theme/blob/b4d00058a48604d8fb63771b513a50450f0ee188/pytorch_sphinx_theme/static/js/theme.js#L568-L579 # https://github.com/pytorch/pytorch_sphinx_theme/blob/b4d00058a48604d8fb63771b513a50450f0ee188/pytorch_sphinx_theme/static/js/theme.js#L568-L579
#} #}
<script type="text/javascript">
$(window).ready(function() { $(window).ready(function() {
var original = window.sideMenus.bind; var original = window.sideMenus.bind;
var startup = true;
window.sideMenus.bind = function() { window.sideMenus.bind = function() {
original(); original();
if (startup) {
$("#pytorch-right-menu a.reference.internal").each(function(i) { $("#pytorch-right-menu a.reference.internal").each(function(i) {
if (this.classList.contains("not-expanded")) { if (this.classList.contains("not-expanded")) {
this.nextElementSibling.style.display = "block"; this.nextElementSibling.style.display = "block";
...@@ -91,6 +103,8 @@ ...@@ -91,6 +103,8 @@
this.classList.add("expanded"); this.classList.add("expanded");
} }
}); });
startup = false;
}
}; };
}); });
</script> </script>
......
...@@ -54,6 +54,8 @@ extensions = [ ...@@ -54,6 +54,8 @@ extensions = [
"nbsphinx", "nbsphinx",
] ]
nbsphinx_requirejs_path = ""
autodoc_member_order = "bysource" autodoc_member_order = "bysource"
# katex options # katex options
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment