Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobettini committed Jun 17, 2024
1 parent 11c55c2 commit d860a17
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/source/_static/js/version_alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*
*/

function warnOnLatestVersion() {
if (!window.READTHEDOCS_DATA || window.READTHEDOCS_DATA.version !== "latest") {
return; // not on ReadTheDocs and not latest.
}

var note = document.createElement('div');
note.setAttribute('class', 'admonition note');
note.innerHTML = "<p class='first admonition-title'>Note</p> " +
"<p> " +
"This documentation is for an <b>unreleased development version</b>. " +
"Click <a href='/en/stable'><b>here</b></a> to access the documentation of the current stable release." +
"</p>";

var parent = document.querySelector('#pyg-documentation');
if (parent)
parent.insertBefore(note, parent.querySelector('h1'));
}

document.addEventListener('DOMContentLoaded', warnOnLatestVersion);
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ def rst_jinja_render(app, _, source):
source[0] = app.builder.templates.render_string(source[0], rst_context)

app.connect("source-read", rst_jinja_render)
app.add_js_file("js/version_alert.js")

0 comments on commit d860a17

Please sign in to comment.