Skip to content

Conversation

@AA-Turner
Copy link
Member

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

A

@AA-Turner
Copy link
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
Copy link
Member

@pradyunsgpradyunsg left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ezio-melottiezio-melotti left a comment

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.

@hugovk
Copy link
Member

Is this ready to merge?

@hugovk
Copy link
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
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

Copy link
Member

@hugovkhugovk left a comment

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-TurnerAA-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
@JulienPalardJulienPalard merged commit 32115c4 into python:mainApr 13, 2023
@JulienPalard
Copy link
Member

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

@AA-Turner
Copy link
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
Copy link
Member

JulienPalard commented Apr 17, 2023

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