Skip to content

Commit

Permalink
Improve table formatting, and increase content width for model doc pages
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Jul 4, 2021
1 parent 96d4b40 commit 86a1f9e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 31 deletions.
54 changes: 30 additions & 24 deletions docs/_static/table.css
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
/* Styles for tables. For sphinx-material, requires docutils class to be in 'table_classes' */
.docutils table {
box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);
display:inline-block;
border-radius:.1rem;
font-size:.64rem;
margin-top:1.5em;
max-width:100%;
overflow:auto;
-webkit-overflow-scrolling:touch
/* Slightly modified table styles from Furo theme*/

table.docutils {
border-radius: 0.2rem;
border-spacing: 0;
border-collapse: collapse;
box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);
}
.docutils th {
min-width:5rem;
padding:.6rem .8rem;
background-color: #ecf0f3;
border-top: 3px solid #00bfa5;
vertical-align:top

table.docutils th {
background: #63ccff;
border-bottom: 3px solid #006db3;
}
.docutils td {
padding:.6rem .8rem;
border-top:.05rem solid rgba(0,1,0,.07);
vertical-align:top

/* TODO: Use variables for light/med/dark variants */
@media (prefers-color-scheme: dark) {
table.docutils th {
background: #006db3;
border-bottom: 3px solid #63ccff;
}

}
.docutils tr{transition:background-color .125s}
.docutils tr:hover{

table.docutils tr{transition:background-color .125s}
table.docutils tr:hover{
background-color:rgba(0,0,0,.035);
box-shadow:inset 0 .05rem 0 #fff
}
.docutils tr:first-child td{border-top:0}
.docutils table a {word-break:normal}


/* table.docutils td, th {
padding: 0 0.25rem;
border-left: 1px solid var(--color-background-border);
border-right: 1px solid var(--color-background-border);
border-bottom: 1px solid var(--color-background-border);
} */
7 changes: 6 additions & 1 deletion docs/_templates/autosummary_core/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
{{ objname }}
{{ underline }}

{# Increase the max content width, since we won't have a local ToC to the right #}
.. raw:: html

<style>div.content{width: 60em}</style>

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
Expand All @@ -15,7 +20,7 @@
.. csv-table::
:class: docutils
:header: "Name", "Type", "Description"
:widths: 10, 12, 30
:widths: 12 12 76
:file: {{ '../models/' + objname + '.csv' }}

{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,12 @@
html_theme = 'furo'
html_theme_options = {
'light_css_variables': {
'color-brand-primary': '#436500', # Dark green
# 'color-brand-content': 'teal',
'color-brand-primary': '#00766c', # MD light-blue-600; light #64d8cb | med #26a69a
'color-brand-content': '#006db3', # MD teal-400; light #63ccff | med #039be5
},
'dark_css_variables': {
'color-brand-primary': '#74AC00', # Yellow-green
'color-brand-primary': '#64d8cb',
'color-brand-content': '#63ccff',
},
'sidebar_hide_name': True,
}
Expand Down
4 changes: 1 addition & 3 deletions pyinaturalist/api_docs/forge_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
from inspect import cleandoc, ismethod, signature
from logging import getLogger
from typing import Callable, List
from typing import Callable, List, get_type_hints

from requests import Session

Expand Down Expand Up @@ -72,8 +72,6 @@ def wrapper(func):
# Alias specifically for API functions
document_request_params = copy_doc_signature

from typing import get_type_hints


def copy_annotations(target_function: Callable, template_functions: List[TemplateFunction]) -> Callable:
"""Copy type annotations from one or more template functions to a target function"""
Expand Down

0 comments on commit 86a1f9e

Please sign in to comment.