File tree Expand file tree Collapse file tree 6 files changed +29
-15
lines changed Expand file tree Collapse file tree 6 files changed +29
-15
lines changed Original file line number Diff line number Diff line change 99.. _demo : http://docs.readthedocs.org
1010.. _hidden : http://sphinx-doc.org/markup/toctree.html
1111
12+ .. image :: https://img.shields.io/pypi/v/sphinx_rtd_theme.svg
13+ :target: https://pypi.python.org/pypi/sphinx_rtd_theme
14+ .. image :: https://travis-ci.org/rtfd/sphinx_rtd_theme.svg?branch=master
15+ :target: https://travis-ci.org/rtfd/sphinx_rtd_theme
16+ .. image :: https://img.shields.io/pypi/l/sphinx_rtd_theme.svg
17+ :target: https://pypi.python.org/pypi/sphinx_rtd_theme/
18+ :alt: license
19+
1220**************************
1321Read the Docs Sphinx Theme
1422**************************
Original file line number Diff line number Diff line change @@ -108,13 +108,15 @@ function ThemeNav () {
108108 // Try again with the closest section entry.
109109 link = $ ( '.wy-menu-vertical' )
110110 . find ( '[href="#' + closest_section . attr ( "id" ) + '"]' ) ;
111-
112111 }
113- $ ( '.wy-menu-vertical li.toctree-l1 li.current' )
114- . removeClass ( 'current' ) ;
115- link . closest ( 'li.toctree-l2' ) . addClass ( 'current' ) ;
116- link . closest ( 'li.toctree-l3' ) . addClass ( 'current' ) ;
117- link . closest ( 'li.toctree-l4' ) . addClass ( 'current' ) ;
112+ // If we found a matching link then reset current and re-apply
113+ // otherwise retain the existing match
114+ if ( link . length > 0 ) {
115+ $ ( '.wy-menu-vertical li.toctree-l1 li.current' ) . removeClass ( 'current' ) ;
116+ link . closest ( 'li.toctree-l2' ) . addClass ( 'current' ) ;
117+ link . closest ( 'li.toctree-l3' ) . addClass ( 'current' ) ;
118+ link . closest ( 'li.toctree-l4' ) . addClass ( 'current' ) ;
119+ }
118120 }
119121 catch ( err ) {
120122 console . log ( "Error expanding nav for anchor" , err ) ;
Original file line number Diff line number Diff line change 3535 ]
3636 },
3737 classifiers = [
38+ 'Framework :: Sphinx' ,
39+ 'Framework :: Sphinx :: Theme' ,
3840 'Development Status :: 5 - Production/Stable' ,
3941 'License :: OSI Approved :: MIT License' ,
4042 'Environment :: Console' ,
Original file line number Diff line number Diff line change @@ -109,13 +109,15 @@ function ThemeNav () {
109109 // Try again with the closest section entry.
110110 link = $ ( '.wy-menu-vertical' )
111111 . find ( '[href="#' + closest_section . attr ( "id" ) + '"]' ) ;
112-
113112 }
114- $ ( '.wy-menu-vertical li.toctree-l1 li.current' )
115- . removeClass ( 'current' ) ;
116- link . closest ( 'li.toctree-l2' ) . addClass ( 'current' ) ;
117- link . closest ( 'li.toctree-l3' ) . addClass ( 'current' ) ;
118- link . closest ( 'li.toctree-l4' ) . addClass ( 'current' ) ;
113+ // If we found a matching link then reset current and re-apply
114+ // otherwise retain the existing match
115+ if ( link . length > 0 ) {
116+ $ ( '.wy-menu-vertical li.toctree-l1 li.current' ) . removeClass ( 'current' ) ;
117+ link . closest ( 'li.toctree-l2' ) . addClass ( 'current' ) ;
118+ link . closest ( 'li.toctree-l3' ) . addClass ( 'current' ) ;
119+ link . closest ( 'li.toctree-l4' ) . addClass ( 'current' ) ;
120+ }
119121 }
120122 catch ( err ) {
121123 console . log ( "Error expanding nav for anchor" , err ) ;
You can’t perform that action at this time.
0 commit comments