Skip to content

Commit 94751ff

Browse files
committed
DOC: Tweaks to banner handling
Allow controlling theming in the renamed banner.html file. Also tweak the theme for the notice about the version.
1 parent 385f3e0 commit 94751ff

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

docs/_static/doc_shared.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const proj = "MetPy";
1+
const project = "MetPy";
22

33
$(document).ready(function() {
44
cur_ver = DOCUMENTATION_OPTIONS.VERSION;
@@ -8,15 +8,15 @@ $(document).ready(function() {
88
}
99
console.log('cur_ver: ' + cur_ver);
1010

11-
$.getJSON('/' + proj + '/versions.json', function(data) {
11+
$.getJSON('/' + project + '/versions.json', function(data) {
1212
if (cur_ver !== data.latest) {
1313
let msg;
1414
if (cur_ver.includes('dev') || data.prereleases.indexOf(cur_ver) > -1) {
1515
msg = 'development / pre-release';
1616
} else {
1717
msg = 'previous';
1818
}
19-
content = $('<div class="alert alert-warning alert-version" role="alert">This documentation page is for a ' + msg +
19+
content = $('<div class="alert alert-secondary alert-version" role="alert">This documentation page is for a ' + msg +
2020
' version. For the latest release version, go to <a class="alert-link" href="https://unidata.github.io/MetPy/latest/">https://unidata.github.io/MetPy/latest/</a>');
2121
$('#banner').append(content);
2222
}
@@ -31,13 +31,13 @@ $(document).ready(function() {
3131
});
3232
});
3333

34-
// Borrowed from Bokeh docs to look for an alert.html at the base of the
35-
// docs repo and add that to the banner if present.
34+
// Borrowed from Bokeh docs to look for a banner.html at the base of the docs repo and add that
35+
// to the banner if present.
3636
$(document).ready(function () {
37-
$.get('/' + proj + '/alert.html', function (data) {
38-
if (data.length > 0) {
39-
content = $('<div class="alert alert-primary alert-news" role="alert">' + data + '</div>')
40-
$('#banner').prepend(content);
41-
}
37+
$.get('/' + project + '/banner.html', function (data) {
38+
if (data.length > 0) {
39+
console.log(data);
40+
$('#banner').prepend(data);
41+
}
4242
})
4343
})

docs/doc-server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class Server(http.server.SimpleHTTPRequestHandler):
2020

2121
def translate_path(self, path):
2222
"""Translate a request path to the proper path into the built docs."""
23-
if path == '/MetPy/alert.html':
24-
return str(TEST_FILES_DIR / 'alert.html')
23+
if path == '/MetPy/banner.html':
24+
return str(TEST_FILES_DIR / 'banner.html')
2525
elif path == '/MetPy/versions.json':
2626
return str(TEST_FILES_DIR / 'versions.json')
2727
elif path.startswith('/MetPy/'):

docs/test-server/alert.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/test-server/banner.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="alert alert-warning alert-news" role="alert">
2+
MetPy 1.0 changed how some functions behave and might require updating your code. See the
3+
<a class="alert-link" href="userguide/upgradeguide.html">1.0 Upgrade Guide</a> for more information.
4+
</div>

0 commit comments

Comments
 (0)