Skip to content

Commit

Permalink
Reorganise documentation (#3165)
Browse files Browse the repository at this point in the history
* Break user guide into parts

* Break up file I missed

* Add basic .gitignore to suit out-of-tree builds in build, build1, build2 ... build9

* Small changes to autonumber.py for doc compilation

This is a small change designed not to fix the incorrect logic of
autonumber.py, but just to get the docs compiling. While assigning
numbers, the code now just ignores the autonumber_by_chapter
setting for a particular object if it can't find the appropriate
section in section_numbers. This is a temporary fix!

* Include part and chapter in autonumbered objects

* Fix autonumber.py to correctly reference autonumber roles in file-level sections

* Unify and simplify styling across documentation

* Break dev docs down into individual chapter-files

* Correct absolute links to relative

* Disable browser suggestions for lunrsearch box in API docs

* Remove part name from chapter 2.1

* Rename ambiguous 'Home' link to OpenMM.org

* Typo

* Minor fixes and reversions

Reverts some changes I had made and later thought better of,
and fixes some recurring typos across the documentation.

* Number developers guide chapters

* Fix responsiveness

* Remove header.rst and center captions

* Add a level of depth to main TOC and styling to accomodate

* Add third level to Part-level TOCs

* Use :numref: instead of :ref: to number links to sections

* Continuously number chapters in user guide

* navbar links to other docs relative, not absolute

* Improve navbar spacing with new template

* Fix sidebar while allowing it to scroll

* Hard -> Soft links for navigation.html template

* Add navigation.html template to cmakelists

* Add another level of .. to relative links

* Fix flex on C++ and remove layer of ..
  • Loading branch information
Yoshanuikabundi committed Jul 16, 2021
1 parent 1344f2e commit f516669
Show file tree
Hide file tree
Showing 58 changed files with 10,594 additions and 9,878 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
__pycache__
build
build?
6 changes: 6 additions & 0 deletions docs-source/api-c++/CMakeLists.txt
Expand Up @@ -4,6 +4,9 @@ file(GLOB STAGING_INPUT_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"*.rst.jinja2"
"*.py"
"_static/logo.png"
"_static/custom.css"
"_templates/lunrsearch.html"
"_templates/navigation.html"
)

set(WRAPPER_DOXYGEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen")
Expand Down Expand Up @@ -51,6 +54,9 @@ add_custom_command(
"${CMAKE_CURRENT_BINARY_DIR}/library.rst"
"${CMAKE_CURRENT_BINARY_DIR}/index.rst"
"${CMAKE_CURRENT_BINARY_DIR}/_static/logo.png"
"${CMAKE_CURRENT_BINARY_DIR}/_static/custom.css"
"${CMAKE_CURRENT_BINARY_DIR}/_templates/lunrsearch.html"
"${CMAKE_CURRENT_BINARY_DIR}/_templates/navigation.html"
"${WRAPPER_DOXYGEN_DIR}/xml/index.xml"
)

Expand Down
1 change: 1 addition & 0 deletions docs-source/api-c++/_static/custom.css
1 change: 1 addition & 0 deletions docs-source/api-c++/_templates/lunrsearch.html
1 change: 1 addition & 0 deletions docs-source/api-c++/_templates/navigation.html
81 changes: 56 additions & 25 deletions docs-source/api-c++/conf.py
@@ -1,42 +1,73 @@
import sys
import os
import sys

extensions = ['sphinx.ext.mathjax','sphinx.ext.autosummary',
'sphinx.ext.autodoc', 'sphinxcontrib.lunrsearch',
'sphinxcontrib.autodoc_doxygen']
extensions = [
"sphinx.ext.mathjax",
"sphinx.ext.autosummary",
"sphinx.ext.autodoc",
"sphinxcontrib.lunrsearch",
"sphinxcontrib.autodoc_doxygen",
]

autosummary_generate = True
autodoc_member_order = 'bysource'
autodoc_member_order = "bysource"

source_suffix = '.rst'
master_doc = 'index'
source_suffix = ".rst"
master_doc = "index"

project = u'OpenMM'
copyright = u'2015, Stanford University and the Authors'
project = u"OpenMM C++ API"
copyright = u"2015, Stanford University and the Authors"

version = '@OPENMM_MAJOR_VERSION@.@OPENMM_MINOR_VERSION@'
release = '@OPENMM_MAJOR_VERSION@.@OPENMM_MINOR_VERSION@'
version = "@OPENMM_MAJOR_VERSION@.@OPENMM_MINOR_VERSION@"
release = "@OPENMM_MAJOR_VERSION@.@OPENMM_MINOR_VERSION@"

exclude_patterns = ['_build', '_templates']
html_static_path = ['_static']
templates_path = ['_templates']
exclude_patterns = ["_build", "_templates"]
html_static_path = ["_static"]
templates_path = ["_templates"]

pygments_style = 'sphinx'
pygments_style = "sphinx"

html_theme = "alabaster"
html_theme_options = {
'description': "High performance molecular simulation on GPUs",
'github_button': False,
# 'github_user': 'pandegroup',
# 'github_repo': 'openmm',
'logo_name': False,
'logo': 'logo.png',
"github_button": False,
"github_user": "openmm",
"github_repo": "openmm",
"logo_name": True,
"logo": "logo.png",
"extra_nav_links": [
{
"title": "OpenMM.org",
"uri": "https://openmm.org",
"relative": False,
},
{
"title": "User's Manual",
"uri": "../userguide/",
"relative": True,
},
{
"title": "Developer Guide",
"uri": "../developerguide/",
"relative": True,
},
{
"title": "Python API reference",
"uri": "../api-python/",
"relative": True,
},
{
"title": "GitHub",
"uri": "https://github.com/openmm",
"relative": False,
},
],
"show_relbar_bottom": True,
}
html_sidebars = {
'**': [
'about.html',
'searchbox.html',
'navigation.html',
"**": [
"about.html",
"lunrsearch.html",
"navigation.html",
]
}

Expand Down
6 changes: 6 additions & 0 deletions docs-source/api-python/CMakeLists.txt
Expand Up @@ -7,7 +7,10 @@ file(GLOB STAGING_INPUT_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"conf.py"
"process-docstring.py"
"_static/logo.png"
"_static/custom.css"
"_templates/class.rst"
"_templates/lunrsearch.html"
"_templates/navigation.html"
)

foreach(INIT_FILE ${STAGING_INPUT_FILES})
Expand Down Expand Up @@ -41,7 +44,10 @@ add_custom_command(
"${CMAKE_CURRENT_BINARY_DIR}/library.rst"
"${CMAKE_CURRENT_BINARY_DIR}/index.rst"
"${CMAKE_CURRENT_BINARY_DIR}/_static/logo.png"
"${CMAKE_CURRENT_BINARY_DIR}/_static/custom.css"
"${CMAKE_CURRENT_BINARY_DIR}/_templates/class.rst"
"${CMAKE_CURRENT_BINARY_DIR}/_templates/lunrsearch.html"
"${CMAKE_CURRENT_BINARY_DIR}/_templates/navigation.html"
PythonInstall
)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/api-python/)
Expand Down
214 changes: 214 additions & 0 deletions docs-source/api-python/_static/custom.css
@@ -0,0 +1,214 @@
/* Reasonable defaults */
html {
overflow-x: hidden;
overflow-y: scroll;
text-rendering: optimizeLegibility;
text-size-adjust: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
}

/* Fix responsiveness */
body {
overflow-x: hidden;
}
div.body {
min-width: unset;
}

@media screen and (max-width: 870px) {
div.sphinxsidebar p.logo {
display: unset;
}
}

@media screen and (max-width: 875px) {
ul {
margin-left: 30px;
}
div.sphinxsidebar {
width: 100vw;
padding: 0;
}
}

@media screen and (min-width: 871px) and (max-width: 940px) {
div.document {
width: 100vw
}
}

/* When search bar is in nav footer, don't let it stretch too far */
.searchformwrapper {
max-width: 250px;
}

/* Fix next/prev links in footer */
/* Don't just float the whole thing right */
nav#rellinks {
float: unset;
}
nav#rellinks ul {
padding-left: 0;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
nav#rellinks li {
line-height: 1.3;
padding: 5px 0px;
}
nav#rellinks li:first-child {
display: block;
text-indent: -17px;
padding-left: 17px;
}
nav#rellinks li + li {
margin-left: auto;
text-align: right;
display: flex;
}
nav#rellinks li + li a {
display: inline-block;
margin-right: 5px;
}
nav#rellinks li + li:before {
content: "";
}

/* Put the title and logo side by side*/
.sphinxsidebarwrapper {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
flex-direction: row-reverse;
justify-content: space-between;
align-content: flex-start;
}

.sphinxsidebar .logo-name {
flex-basis: 140px;
font-size: 20px;
}

.sphinxsidebar p.logo {
flex-basis: 60px;
text-align: right;
display: block;
margin-top: 0 !important;
}

/* Get control over the image */
.sphinxsidebar p.logo a {
height: auto;
display: block;
}

/* Make sure the remaining items use the width of
* the whole navbar and don't get squished together
* by flex.
*/
.sphinxsidebar .logo-name ~ * {
flex-basis: 100%
}
/* Emulate a placeholder rather than a heading for search */
.sphinxsidebar #searchbox form.search input[type="text"] {
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='50px' width='120px'><text x='10' y='17' fill='gray' font-size='15'>Search...</text></svg>");
background-repeat: no-repeat;
}
.sphinxsidebar #searchbox form.search input[type="text"]:focus {
background-image: none;
}

/* Hide unwanted elements*/
.sphinxsidebarwrapper #searchbox h3, /* Search heading */
.sphinxsidebarwrapper > h3, /* Navigation heading */
.sphinxsidebarwrapper p:empty, /* Empty elements taking up space */
.sphinxsidebar .logo-name + a[href], /* Inexplicable but ugly link */
.sphinxsidebarwrapper hr /* Horizontal rules */
{
display: none;
}

/* Hide logo on tiny screens */
@media screen and (max-width: 280px) {
div.sphinxsidebar p.logo {
display: none;
}

.sphinxsidebar .logo-name {
flex-basis: 100%;
}
}

/* Style TOC in sidebar more clearly */
.sphinxsidebarwrapper li.toctree-l1 {
padding: 0.15em 0;
line-height: 1.4;
}

.sphinxsidebarwrapper a.current,
.sphinxsidebarwrapper a.current:hover {
text-decoration: none;
border-bottom: none;
cursor: text;
}
/* Tweak spacing */
div.sphinxsidebarwrapper #searchbox {
margin-bottom: 0;
}
div.sphinxsidebarwrapper .nav-toctree > ul {
margin: 5px 0;
}
/* Enlarge space between toctrees and external links */
div.sphinxsidebarwrapper .nav-toctree {
margin-top: 15px;
margin-bottom: 15px;
}
div.sphinxsidebarwrapper .extra-nav-links {
margin-bottom: 0;
}

/* Custom body styling */
/* Center captions of figures, examples, etc. */
.body .caption {
text-align: center;
}

.body .toctree-l1 {
font-weight: bold;
}

.body .toctree-l2 {
font-weight: normal;
}

.body .toctree-l3 {
font-size: 0.8em;
}

/* Fix navbar to top */
@media screen and (min-width: 875px) {
.sphinxsidebar {
position: fixed;
height: 100vh;
overflow-y: hidden;
top: 0;
float: unset !important;
margin-left: 0 !important;
}

.sphinxsidebarwrapper {
height: calc(100% - 60px);
overflow-y: auto;
padding-top: 30px !important;
padding-bottom: 30px !important;
/* Hide scrollbar */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
/* Hide scrollbar */
.sphinxsidebarwrapper::-webkit-scrollbar {
display: none
}
}

0 comments on commit f516669

Please sign in to comment.