]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
doc: check "release" context variable for #dev-warning 38366/head
authorKefu Chai <kchai@redhat.com>
Tue, 1 Dec 2020 07:16:15 +0000 (15:16 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 1 Dec 2020 16:25:16 +0000 (00:25 +0800)
if $release is "dev", then the release being built is not a stable
version.

drop ceph.js, as the web page is generated at build time.

since the last user of "releases.json" is gone, now we can
drop the hooks preparing "releases.json" in conf.py as well.

Signed-off-by: Kefu Chai <kchai@redhat.com>
doc/_static/js/ceph.js [deleted file]
doc/_templates/page.html
doc/conf.py

diff --git a/doc/_static/js/ceph.js b/doc/_static/js/ceph.js
deleted file mode 100644 (file)
index 1d22a8b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-$(function() {
-  var releases_url = DOCUMENTATION_OPTIONS.URL_ROOT + '_static/releases.json';
-
-  function get_branch() {
-    var pathname = window.location.pathname;
-    var res = pathname.match(/en\/([a-z]+)\/?/i)
-    if (res) {
-      return res[1]
-    }
-    return null;
-  }
-
-  $.getJSON(releases_url, function(data) {
-    var branch = get_branch();
-    if (branch === "master") {
-      $("#dev-warning").show();
-    } else if (data && data.releases && branch in data.releases) {
-      return;
-    } else {
-      $("#dev-warning").show();
-    }
-  });
-});
index a4d4236a3c273437197bf3d787dbdf3424d632e7..3923975d78f025e8e300293da41a8c6189424212 100644 (file)
@@ -1,10 +1,12 @@
 {% extends "!page.html" %}
 {% block body %}
 
-<div id="dev-warning" class="admonition note" style="display:none;">
+{%- if release == 'dev' %}
+<div id="dev-warning" class="admonition note">
   <p class="first admonition-title">Notice</p>
   <p class="last">This document is for a development version of Ceph.</p>
 </div>
+{%- endif %}
 
 {%- if is_release_eol %}
 <div id="eol-warning" class="admonition warning">
index 953e7dd779a77198dcbc4720d5832f48e5743fad..8565abde46b7d89fceb0aeeffc0f299ab6c87b03 100644 (file)
@@ -1,6 +1,4 @@
-import datetime
 import fileinput
-import json
 import os
 import shutil
 import sys
@@ -222,27 +220,6 @@ for c in pybinds:
         sys.path.insert(0, pybind)
 
 
-# build the releases.json. this reads in the yaml version and dumps
-# out the json representation of the same file. the resulting releases.json
-# should be served from '/_static/releases.json' of hosted site.
-def yaml_to_json(input_path, output_path):
-    def json_serialize(obj):
-        if isinstance(obj, datetime.date):
-            return obj.isoformat()
-
-    yaml_fn = os.path.join(top_level, input_path)
-    json_fn = os.path.join(top_level, output_path)
-
-    def process(app):
-        with open(yaml_fn) as input:
-            with open(json_fn, 'w') as output:
-                releases = yaml.safe_load(input)
-                s = json.dumps(releases, indent=2, default=json_serialize)
-                output.write(s)
-
-    return process
-
-
 # handles edit-on-github and old version warning display
 def setup(app):
     app.add_js_file('js/ceph.js')
@@ -254,6 +231,3 @@ def setup(app):
                 generate_state_diagram(['src/osd/PeeringState.h',
                                         'src/osd/PeeringState.cc'],
                                        'doc/dev/peering_graph.generated.dot'))
-    app.connect('builder-inited',
-                yaml_to_json('doc/releases/releases.yml',
-                             'doc/_static/releases.json'))