diff --git a/doc/Makefile b/doc/Makefile index efc61d8aa3f..c3f55065335 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -27,10 +27,26 @@ Tools_api: Tools_user: rm -f $(SOURCEDIR)/$@/*.rst - rm -f $(SOURCEDIR)/$@/temp_files/*.* + rm -f $(SOURCEDIR)/$@/temp_files/* ./tools_autodoc.py -.PHONY: help Makefile CIME_api Tools_api Tools_user +# It's too easy to forget to run 'make api' before running 'make html', +# so add a rule that ensures that the api documentation is regenerated +# whenever regenerating the html. +html: api + +clean: clean_api + +# Note that all of the files removed here are built using 'make api'; +# these are not - or at least, should not be - files that exist in the +# repository. +clean_api: + rm -f $(SOURCEDIR)/CIME_api/*.rst + rm -f $(SOURCEDIR)/Tools_api/*.rst + rm -f $(SOURCEDIR)/Tools_user/*.rst + rm -f $(SOURCEDIR)/Tools_user/temp_files/* + +.PHONY: help Makefile CIME_api Tools_api Tools_user clean_api # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). diff --git a/doc/README b/doc/README index 52600d2956e..b8e0e530e94 100644 --- a/doc/README +++ b/doc/README @@ -1,12 +1,17 @@ -This requires Sphinx v1.7 or greater. +This requires Sphinx v1.7 or greater, as well as some add-ons, which can +be installed with: + +pip install sphinx +pip install sphinxcontrib-programoutput +pip install git+https://github.com/esmci/sphinx_rtd_theme.git@version-dropdown-with-fixes Check the sphinx version as follows: >sphinx-build --version The documentation source is stored with the CIME master code base. However, -the built html files are stored seperately in the orphan gh-pages branch +the built html files are stored separately in the orphan gh-pages branch and can be viewed from a browser at URL: http://esmci.github.io/cime @@ -19,9 +24,10 @@ https://github.com/ESMCI/cime/wiki/Working-with-Sphinx-and-reStructuredText Use the following commands to auto-build the html documentation from the main cime/doc directory: ->make clean ->make api ->make html - - +make clean +make api +make html +To publish the docs to the orphan gh-pages branch, follow the steps in +https://github.com/ESMCI/cime/wiki/Working-with-Sphinx-and-reStructuredText +to ensure proper versioning of the documentation. diff --git a/doc/source/_static b/doc/source/_static deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/doc/source/_static/pop_ver.js b/doc/source/_static/pop_ver.js new file mode 100644 index 00000000000..b8c58658a82 --- /dev/null +++ b/doc/source/_static/pop_ver.js @@ -0,0 +1,37 @@ +$(document).ready(function() { + /* For a URL that looks like + https://blah.github.io/versions/VERSIONFOO/html/bar/index.html, set cur_version_dir to + 'VERSIONFOO' (i.e., the portion of the path following 'versions'). + */ + var proj_end = document.baseURI.indexOf("versions") + 9; + var end = document.baseURI.indexOf("/", proj_end); + var cur_version_dir = document.baseURI.substring(proj_end, end); + var mylist = $("#version-list"); + mylist.empty(); + $.getJSON(version_json_loc, function(data) { + if (data.hasOwnProperty(cur_version_dir)) { + /* First add the current version so that it appears first in the drop-down + menu and starts as the selected element of the menu. If you click on the + current version, you should stay at the current page. + + The conditional around this block should generally be true, but we check it + just in case the current version is missing from the versions.json file for + some reason. + */ + cur_version_name = data[cur_version_dir]; + mylist.append($("