Skip to content

Update python-docs-theme to work with Sphinx 5 & 6 - #99

Merged
JulienPalard merged 9 commits into
python:mainfrom
AA-Turner:sphinx-6
Apr 13, 2023
Merged

Update python-docs-theme to work with Sphinx 5 & 6#99
JulienPalard merged 9 commits into
python:mainfrom
AA-Turner:sphinx-6

Conversation

@AA-Turner

Copy link
Copy Markdown
Member

Updated remaining jQuery scripts to standard JavaScript, and a few fixes for CSS changes.

A

@AA-Turner

Copy link
Copy Markdown
MemberAuthor

Turns out this is required for Sphinx 5... python/cpython#99381

A

@AA-TurnerAA-Turner changed the title Update for Sphinx 6Update for Sphinx 5 and 6Nov 11, 2022

@pradyunsgpradyunsg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ezio-melottiezio-melotti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In addition to the inline comments, I have two generic comments:

  • The use of semicolons at the end of the line seems inconsistent. Unless there is a specific reason to keep them, I would just remove them all.
  • I would avoid the use of if (...) return; or if (...) break; or even if (...) some_functions(). The expression after the condition should go on a new line, and it should be surrounded by { }, e.g.:
    if(...){
    ...
    }

Fun fact: I originally implemented both the collapsible sidebar (~12 years ago in python/cpython#47393) and the copybutton (~11 years ago in python/cpython@59dba38) and since then they have traveled around a number of dirs and repos. It's nice to see that in the meanwhile things got standardized and JS evolved to the point that JQuery is no longer needed.

Comment thread.github/workflows/tests.yml
Comment threadpython_docs_theme/static/copybutton.js Outdated
Comment threadpython_docs_theme/static/copybutton.js Outdated
Comment threadpython_docs_theme/static/copybutton.js Outdated
@hugovk

Copy link
Copy Markdown
Member

Is this ready to merge?

@hugovk

Copy link
Copy Markdown
Member

Rebased on main to build RTD preview:

And there's an error in the console:

sidebar.js:34 Uncaught TypeError: Cannot read properties of null (reading 'querySelector')
at HTMLDocument.initialiseSidebar (sidebar.js:34:38)

From the last line of:

constbodyWrapper=document.getElementsByClassName("bodywrapper")[0]constsidebar=document.getElementsByClassName("sphinxsidebar")[0]constsidebarWrapper=document.getElementsByClassName('sphinxsidebarwrapper')[0]constsidebarButton=document.getElementById("sidebarbutton")constsidebarArrow=sidebarButton.querySelector('span')

@m-aciekm-aciek mentioned this pull request Mar 13, 2023
@AA-Turner

Copy link
Copy Markdown
MemberAuthor

Updated the JavaScript, the previous version was attempting to access an element that had yet to be created. Thank you for the review!

A

@hugovkhugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Working fine now, thanks!

@AA-Turner
AA-Turner requested review from JulienPalard and ezio-melotti and removed request for JulienPalardApril 11, 2023 20:27
@AA-TurnerAA-Turner changed the title Update for Sphinx 5 and 6Update python-docs-theme to work with Sphinx 5 & 6Apr 12, 2023
@JulienPalard
JulienPalard merged commit 32115c4 into python:mainApr 13, 2023
@JulienPalard

Copy link
Copy Markdown
Member

I just built https://docs.python.org/3.12/ after merging this PR.

@AA-Turner

Copy link
Copy Markdown
MemberAuthor

I just built docs.python.org/3.12 after merging this PR.

Working for me in Firefox 112 on Windows! If you have time over the next few weeks, please would we be able to make a 2023.4 release, to unblock python/cpython#99381?

A

@JulienPalard

JulienPalard commented Apr 17, 2023

Copy link
Copy Markdown
Member

Releasing: #126

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AA-Turner@hugovk@JulienPalard@pradyunsg@ezio-melotti