Bläddra i källkod

Add a warning that docs are WIP and a status flag for articles

By default (no flag) articles are considered up-to-date, with the end goal to have no
articles marked as outdated.
Use `:article_outdated: True` at the top of an article to mark it as being outdated.
Yuri Sizov 2 år sedan
förälder
incheckning
ff4f111677
3 ändrade filer med 67 tillägg och 13 borttagningar
  1. 27 0
      _static/css/custom.css
  2. 35 11
      _templates/layout.html
  3. 5 2
      conf.py

+ 27 - 0
_static/css/custom.css

@@ -936,11 +936,24 @@ code,
 }
 
 /* Admonition tweaks */
+.rst-content .admonition-grid {
+    display: grid;
+    grid-template-columns: 4fr 5fr;
+    gap: 20px;
+}
+@media screen and (max-width: 1020px) {
+    .rst-content .admonition-grid {
+        grid-template-columns: 1fr;
+        gap: 12px;
+    }
+}
 
 .rst-content .admonition,
 .rst-content .admonition.note,
 .rst-content .admonition.seealso {
     background-color: var(--admonition-note-background-color);
+    border-radius: 4px;
+    box-shadow: 0px 3px 9px 0px rgb(0 0 0 / 29%);
     color: var(--admonition-note-color);
 }
 
@@ -948,7 +961,17 @@ code,
 .rst-content .admonition.note .admonition-title,
 .rst-content .admonition.seealso .admonition-title {
     background-color: var(--admonition-note-title-background-color);
+    border-radius: 4px 4px 0 0;
     color: var(--admonition-note-title-color);
+    font-weight: 600;
+    font-size: 105%;
+    line-height: 120%;
+    padding: 6px 16px;
+    text-align: right;
+}
+
+.rst-content .admonition .admonition-title:before {
+    margin-right: 9px;
 }
 
 .rst-content .admonition.attention,
@@ -987,6 +1010,10 @@ code,
     color: var(--admonition-tip-title-color);
 }
 
+.article-status strong {
+    color: var(--body-color);
+}
+
 /* Keyboard shortcuts tweaks */
 kbd, .kbd,
 .rst-content :not(dl.option-list) > :not(dt):not(kbd):not(.kbd) > kbd,

+ 35 - 11
_templates/layout.html

@@ -26,17 +26,41 @@
 
 {%- block document %}
 <div itemprop="articleBody">
-  {% if godot_is_latest %}
-  <div class="admonition attention latest-notice">
-    <p class="first admonition-title">Attention</p>
-    <p>
-      You are reading the <code class="docutils literal notranslate"><span class="pre">latest</span></code>
-      (unstable) version of this documentation, which may document features not available
-      or compatible with Godot 3.x.
-    </p>
-    <p class="last latest-notice-link">
-      Checking the stable version of the documentation...
-    </p>
+  {% if godot_is_latest or godot_show_article_status %}
+  <div class="admonition-grid">
+    {% if godot_is_latest %}
+    <div class="admonition attention latest-notice">
+      <p class="first admonition-title">Attention</p>
+      <p>
+        You are reading the <code class="docutils literal notranslate"><span class="pre">latest</span></code>
+        (unstable) version of this documentation, which may document features not available
+        or compatible with Godot 3.x.
+      </p>
+      <p class="last latest-notice-link">
+        Checking the stable version of the documentation...
+      </p>
+    </div>
+    {% endif %}
+
+    {% if godot_show_article_status %}
+    <div class="admonition tip article-status">
+      <p class="first admonition-title">Work in progress</p>
+      <p>
+        Godot documentation is being updated to reflect the latest changes in version
+        <code class="docutils literal notranslate">{{ godot_version }}</code>. Some documentation pages may
+        still state outdated information. This banner will tell you if you're reading one of such pages.
+      </p>
+      <p>
+        {% if meta and meta.get('article_outdated') == 'True' %}
+          The contents of this page can be <strong>outdated</strong>. If you know how to improve this page or you can confirm
+          that it's up to date, feel free to <a href="https://github.com/godotengine/godot-docs">open a pull request</a>.
+        {% else %}
+          The contents of this page are <strong>up to date</strong>. If you can still find outdated information, please
+          <a href="https://github.com/godotengine/godot-docs">open an issue</a>.
+        {% endif %}
+      </p>
+    </div>
+    {% endif %}
   </div>
   {% endif %}
 

+ 5 - 2
conf.py

@@ -178,6 +178,9 @@ html_context = {
     # Set this to `True` when in the `latest` branch to clearly indicate to the reader
     # that they are not reading the `stable` documentation.
     "godot_is_latest": True,
+    "godot_version": "4.0",
+    # Enables a banner that displays the up-to-date status of each article.
+    "godot_show_article_status": True,
 }
 
 html_logo = "img/docs_logo.svg"
@@ -192,14 +195,14 @@ html_extra_path = ["robots.txt"]
 html_css_files = [
     'css/algolia.css',
     'https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css',
-    "css/custom.css?7", # Increment the number at the end when the file changes to bust the cache.
+    "css/custom.css?8", # Increment the number at the end when the file changes to bust the cache.
 ]
 
 if not on_rtd:
     html_css_files.append("css/dev.css")
 
 html_js_files = [
-    "js/custom.js?4", # Increment the number at the end when the file changes to bust the cache.
+    "js/custom.js?5", # Increment the number at the end when the file changes to bust the cache.
     ('https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js', {'defer': 'defer'}),
     ('js/algolia.js', {'defer': 'defer'})
 ]