Skip to content

Commit

Permalink
DOC Adds release highlights to front page (#17071)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjpfan committed May 3, 2020
1 parent 04d2e32 commit 5756205
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import warnings
import re
from packaging.version import parse
from pathlib import Path

# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory
Expand Down Expand Up @@ -208,6 +209,23 @@
# If true, the reST sources are included in the HTML build as _sources/name.
html_copy_source = True

# Adds variables into templates
html_context = {}
# finds latest release highlights and places it into HTML context for
# index.html
release_highlights_dir = Path("..") / "examples" / "release_highlights"
# Finds the highlight with the latest version number
latest_highlights = sorted(release_highlights_dir.glob(
"plot_release_highlights_*.py"))[-1]
latest_highlights = latest_highlights.with_suffix('').name
html_context["release_highlights"] = \
f"auto_examples/release_highlights/{latest_highlights}"

# get version from higlight name assuming highlights have the form
# plot_release_highlights_0_22_0
highlight_version = ".".join(latest_highlights.split("_")[-3:-1])
html_context["release_highlights_version"] = highlight_version

# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
Expand Down
4 changes: 2 additions & 2 deletions doc/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<h1 class="sk-landing-header text-white text-monospace">scikit-learn</h1>
<h4 class="sk-landing-subheader text-white font-italic mb-3">Machine Learning in Python</h4>
<a class="btn sk-landing-btn mb-1" href="{{ pathto('getting_started') }}" role="button">Getting Started</a>
<a class="btn sk-landing-btn mb-1" href="whats_new/v{{ version }}.html" role="button">What's New in {{ release }}</a>
<a class="btn sk-landing-btn mb-1" href="{{ pathto(release_highlights) }}" role="button">Release Highlights for {{ release_highlights_version }}</a>
<a class="btn sk-landing-btn mb-1" href="https://github.com/scikit-learn/scikit-learn" role="button">GitHub</a>
</div>
<div class="col-md-6 d-flex">
Expand Down Expand Up @@ -160,7 +160,7 @@ <h4 class="sk-landing-call-header">News</h4>
</li>
<li><strong>March 2020.</strong> scikit-learn 0.22.2 is available for download (<a href="whats_new/v0.22.html#version-0-22-2">Changelog</a>).
<li><strong>January 2020.</strong> scikit-learn 0.22.1 is available for download (<a href="whats_new/v0.22.html#version-0-22-1">Changelog</a>).
<li><strong>December 2019.</strong> scikit-learn 0.22 is available for download (<a href="whats_new/v0.22.html#version-0-22-0">Changelog</a>).
<li><strong>December 2019.</strong> scikit-learn 0.22 is available for download (<a href="whats_new/v0.22.html#version-0-22-0">Changelog</a> and <a href="{{ pathto('auto_examples/release_highlights/plot_release_highlights_0_22_0') }}">Release Highlights</a>).
</li>
<li><strong>Scikit-learn from 0.21 requires Python 3.5 or greater.</strong>
</li>
Expand Down
1 change: 1 addition & 0 deletions doc/themes/scikit-learn-modern/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{%- set drop_down_navigation = [
('Getting Started', pathto('getting_started')),
('Tutorial', pathto('tutorial/index')),
("What's new", 'whats_new/v' + version + '.html'),
('Glossary', pathto('glossary')),
('Development', pathto('developers/index')),
('FAQ', pathto('faq')),
Expand Down

0 comments on commit 5756205

Please sign in to comment.