From d03f00e87baea91caffa4867b84c7b10e83e45e7 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 11 Apr 2024 11:23:34 -0700 Subject: [PATCH 01/20] Removes custom sphinx-rtd-theme uses rst-versions in the sidebar for versions --- doc/requirements.txt | 2 +- doc/source/_templates/layout.html | 3 -- doc/source/_templates/versions.html | 53 +++++++++++++++++++++++++++++ doc/source/conf.py | 52 +++++++++++++++++++++------- 4 files changed, 93 insertions(+), 17 deletions(-) delete mode 100644 doc/source/_templates/layout.html create mode 100644 doc/source/_templates/versions.html diff --git a/doc/requirements.txt b/doc/requirements.txt index f04797d5331..b26df2f09ee 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,5 @@ sphinx sphinxcontrib-programoutput sphinx-rtd-theme -# git+https://github.com/esmci/sphinx_rtd_theme.git@version-dropdown-with-fixes +gitpython evv4esm diff --git a/doc/source/_templates/layout.html b/doc/source/_templates/layout.html deleted file mode 100644 index af14da01ced..00000000000 --- a/doc/source/_templates/layout.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends "!layout.html" %} - -{% set script_files = script_files + ["_static/pop_ver.js"] %} diff --git a/doc/source/_templates/versions.html b/doc/source/_templates/versions.html new file mode 100644 index 00000000000..2be6e580953 --- /dev/null +++ b/doc/source/_templates/versions.html @@ -0,0 +1,53 @@ +{% if READTHEDOCS or display_lower_left %} +{# Add rst-badge after rst-versions for small badge style. #} +
+ + Read the Docs + v: {{ current_version }} + + +
+ {% if languages|length >= 1 %} +
+
{{ _('Languages') }}
+ {% for slug, url in languages %} + {% if slug == current_language %} {% endif %} +
{{ slug }}
+ {% if slug == current_language %}
{% endif %} + {% endfor %} +
+ {% endif %} + {% if versions|length >= 1 %} +
+
{{ _('Versions') }}
+ {% for slug, url in versions %} + {% if slug == current_version %} {% endif %} +
{{ slug }}
+ {% if slug == current_version %}
{% endif %} + {% endfor %} +
+ {% endif %} + {% if downloads|length >= 1 %} +
+
{{ _('Downloads') }}
+ {% for type, url in downloads %} +
{{ type }}
+ {% endfor %} +
+ {% endif %} + {% if READTHEDOCS %} +
+
{{ _('On Read the Docs') }}
+
+ {{ _('Project Home') }} +
+
+ {{ _('Builds') }} +
+
+ {% endif %} +
+ {% trans %}Free document hosting provided by Read the Docs.{% endtrans %} +
+
+{% endif %} diff --git a/doc/source/conf.py b/doc/source/conf.py index d4b8d6755a2..3e8e04e90a2 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -62,25 +62,25 @@ master_doc = "index" # General information about the project. -project = u"CIME" -copyright = u"2017, U.S. National Science Foundation and U.S. Department of Energy" -author = u"Staff of the NSF/CESM and DOE/E3SM projects" +project = "CIME" +copyright = "2017, U.S. National Science Foundation and U.S. Department of Energy" +author = "Staff of the NSF/CESM and DOE/E3SM projects" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u"master" +version = "master" # The full version, including alpha/beta/rc tags. -release = u"master" +release = "master" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -156,8 +156,8 @@ ( master_doc, "on.tex", - u"on Documentation", - u"Staff of the NSF/CESM and DOE/E3SM projects", + "on Documentation", + "Staff of the NSF/CESM and DOE/E3SM projects", "manual", ), ] @@ -167,7 +167,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, "on", u"on Documentation", [author], 1)] +man_pages = [(master_doc, "on", "on Documentation", [author], 1)] # -- Options for Texinfo output ------------------------------------------- @@ -179,7 +179,7 @@ ( master_doc, "on", - u"on Documentation", + "on Documentation", author, "on", "One line description of project.", @@ -192,8 +192,34 @@ pdf_documents = [ ( master_doc, - u"CIME_Users_Guide", - u"CIME Users Guide (PDF)", - u"Staff of the NSF/CESM and DOE/E3SM projects", + "CIME_Users_Guide", + "CIME Users Guide (PDF)", + "Staff of the NSF/CESM and DOE/E3SM projects", ), ] + +try: + html_context +except NameError: + html_context = dict() + +html_context["display_lower_left"] = True + +html_context["current_language"] = language + +from git import Repo + +repo = Repo(search_parent_directories=True) + +current_version = repo.active_branch.name + +html_context["current_version"] = current_version +html_context["version"] = current_version + +html_context["versions"] = ( + ("master", "versions/master"), + ("CESM2.2", "versions/cesm2.2"), + ("CESM2.1 (cime5.6)", "versions/maint-5.6"), + ("ufs_release_v1.1", "versions/ufs_release_v1.1"), + ("ufs_release_v1.0", "versions/ufs_release_v1.0"), +) From 4d9fb04589058cc44770d058f6a8626733564354 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 11 Apr 2024 13:29:12 -0700 Subject: [PATCH 02/20] Removes gitpython usage --- doc/requirements.txt | 1 - doc/source/conf.py | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index b26df2f09ee..956df97689b 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,4 @@ sphinx sphinxcontrib-programoutput sphinx-rtd-theme -gitpython evv4esm diff --git a/doc/source/conf.py b/doc/source/conf.py index 3e8e04e90a2..ce027828d9a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -207,11 +207,7 @@ html_context["current_language"] = language -from git import Repo - -repo = Repo(search_parent_directories=True) - -current_version = repo.active_branch.name +current_version = "master" html_context["current_version"] = current_version html_context["version"] = current_version From f3aacd16104fc8b3b48ab086e6191d13aa610bc3 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 11 Apr 2024 15:32:04 -0700 Subject: [PATCH 03/20] Fixes relative paths to document versions --- doc/source/conf.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index ce027828d9a..4e34347792d 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -212,10 +212,18 @@ html_context["current_version"] = current_version html_context["version"] = current_version -html_context["versions"] = ( - ("master", "versions/master"), - ("CESM2.2", "versions/cesm2.2"), - ("CESM2.1 (cime5.6)", "versions/maint-5.6"), - ("ufs_release_v1.1", "versions/ufs_release_v1.1"), - ("ufs_release_v1.0", "versions/ufs_release_v1.0"), +# List of name pairs (display, directory) +versions = ( + ("master", "master"), + ("CESM2.2", "cesm2.2."), + ("CESM2.1 (cime5.6)", "maint-5.6"), + ("ufs_release_v1.1", "ufs_release_v1.1"), + ("ufs_release_v1.0", "ufs_release_v1.0"), ) + +html_context["versions"] = list() + +for display, directory in versions: + html_context["versions"].append( + (display, "../../../versions/" + directory + "/html") + ) From c214b223f545880249d2f31182e9e705be54fb96 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 11 Apr 2024 15:38:41 -0700 Subject: [PATCH 04/20] Fixes cesm2.2 directory name --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 4e34347792d..cadd2f86cf6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -215,7 +215,7 @@ # List of name pairs (display, directory) versions = ( ("master", "master"), - ("CESM2.2", "cesm2.2."), + ("CESM2.2", "cesm2.2"), ("CESM2.1 (cime5.6)", "maint-5.6"), ("ufs_release_v1.1", "ufs_release_v1.1"), ("ufs_release_v1.0", "ufs_release_v1.0"), From 165b177ffe37b81b474abc99ad3bd2308f667b90 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Fri, 12 Apr 2024 13:04:07 -0700 Subject: [PATCH 05/20] Removes readthedocs text --- doc/source/_templates/versions.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/source/_templates/versions.html b/doc/source/_templates/versions.html index 2be6e580953..d43c43a8485 100644 --- a/doc/source/_templates/versions.html +++ b/doc/source/_templates/versions.html @@ -46,8 +46,6 @@ {% endif %} -
- {% trans %}Free document hosting provided by Read the Docs.{% endtrans %} {% endif %} From 8f9de2b488d4955a4a8fff4963529e4ac7383afc Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 16 Apr 2024 18:45:14 -0700 Subject: [PATCH 06/20] Test jquery --- doc/source/_templates/versions.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/source/_templates/versions.html b/doc/source/_templates/versions.html index d43c43a8485..30f92d8e866 100644 --- a/doc/source/_templates/versions.html +++ b/doc/source/_templates/versions.html @@ -1,5 +1,10 @@ {% if READTHEDOCS or display_lower_left %} {# Add rst-badge after rst-versions for small badge style. #} +
Read the Docs From 53a5473b239f278ad11f5a22d1e2ce44c49d367d Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 16 Apr 2024 18:53:19 -0700 Subject: [PATCH 07/20] Fixes path --- doc/source/_templates/versions.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/_templates/versions.html b/doc/source/_templates/versions.html index 30f92d8e866..ba13202920d 100644 --- a/doc/source/_templates/versions.html +++ b/doc/source/_templates/versions.html @@ -1,7 +1,7 @@ {% if READTHEDOCS or display_lower_left %} {# Add rst-badge after rst-versions for small badge style. #} From 341b329ac0810a60ac5d12e2e1d522f2d043307c Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 16 Apr 2024 19:02:09 -0700 Subject: [PATCH 08/20] Another test --- doc/source/_templates/versions.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/source/_templates/versions.html b/doc/source/_templates/versions.html index ba13202920d..1a9dfdf1d5d 100644 --- a/doc/source/_templates/versions.html +++ b/doc/source/_templates/versions.html @@ -2,7 +2,11 @@ {# Add rst-badge after rst-versions for small badge style. #}
@@ -22,6 +26,7 @@ {% endfor %} {% endif %} +
{% if versions|length >= 1 %}
{{ _('Versions') }}
From 4b9708f5269d6c7c80dbe00f77f787d1f466f9d9 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 16 Apr 2024 19:08:51 -0700 Subject: [PATCH 09/20] Another test --- doc/source/_templates/versions.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/_templates/versions.html b/doc/source/_templates/versions.html index 1a9dfdf1d5d..c7593d15e16 100644 --- a/doc/source/_templates/versions.html +++ b/doc/source/_templates/versions.html @@ -3,9 +3,13 @@ @@ -26,7 +30,9 @@ {% endfor %}
{% endif %} -
+
+
Versions
+
{% if versions|length >= 1 %}
{{ _('Versions') }}
From c376959503c03fb168d15a7d29f88cf1e57009b6 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 16 Apr 2024 19:19:37 -0700 Subject: [PATCH 10/20] Test bad load --- doc/source/_templates/versions.html | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/doc/source/_templates/versions.html b/doc/source/_templates/versions.html index c7593d15e16..cb7251f9c4b 100644 --- a/doc/source/_templates/versions.html +++ b/doc/source/_templates/versions.html @@ -1,7 +1,7 @@ {% if READTHEDOCS or display_lower_left %} {# Add rst-badge after rst-versions for small badge style. #}
From 5e31e25a5972dc0b8eb6a68f58797d9770bddb49 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 16 Apr 2024 20:43:37 -0700 Subject: [PATCH 20/20] Fixe regex and parsed index --- doc/source/_templates/versions.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/_templates/versions.html b/doc/source/_templates/versions.html index c4519fca00a..b97bea56e39 100644 --- a/doc/source/_templates/versions.html +++ b/doc/source/_templates/versions.html @@ -1,11 +1,11 @@ {% if READTHEDOCS or display_lower_left %} {# Add rst-badge after rst-versions for small badge style. #}