Browse Source

[DOC] use napoleon to parse numpy-style doc string

pull/1/head
Gao Enhao 1 year ago
parent
commit
dc9c36f2f5
2 changed files with 37 additions and 45 deletions
  1. +2
    -1
      .gitignore
  2. +35
    -44
      docs/conf.py

+ 2
- 1
.gitignore View File

@@ -8,4 +8,5 @@
results
raw/
abl.egg-info/
.idea/
.idea/
build/

+ 35
- 44
docs/conf.py View File

@@ -2,52 +2,51 @@ import sys
import os
import re

if not 'READTHEDOCS' in os.environ:
sys.path.insert(0, os.path.abspath('..'))
sys.path.append(os.path.abspath('./ABL/'))
if not "READTHEDOCS" in os.environ:
sys.path.insert(0, os.path.abspath(".."))
sys.path.append(os.path.abspath("./ABL/"))

# from sphinx.locale import _
from sphinx_rtd_theme import __version__


project = u'ABL'
slug = re.sub(r'\W+', '-', project.lower())
project = 'ABL-Package'
copyright = '2023, Author'
author = 'Author'
project = "ABL"
slug = re.sub(r"\W+", "-", project.lower())
project = "ABL-Package"
copyright = "2023, Author"
author = "Author"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.intersphinx',
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx_rtd_theme',
'recommonmark',
'sphinx_markdown_tables',
"sphinx.ext.intersphinx",
"sphinx.ext.autodoc",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx_rtd_theme",
"recommonmark",
"sphinx_markdown_tables",
"sphinx.ext.napoleon",
]

templates_path = ['_templates']
source_suffix = ['.rst', '.md']
templates_path = ["_templates"]
source_suffix = [".rst", ".md"]
exclude_patterns = []
# locale_dirs = ['locale/']
gettext_compact = False

master_doc = 'index'
suppress_warnings = ['image.nonlocal_uri']
pygments_style = 'default'
master_doc = "index"
suppress_warnings = ["image.nonlocal_uri"]
pygments_style = "default"

# intersphinx_mapping = {
# 'rtd': ('https://docs.readthedocs.io/en/latest/', None),
# 'sphinx': ('http://www.sphinx-doc.org/en/stable/', None),
# }

html_theme = 'sphinx_rtd_theme'
html_theme_options = {
'display_version': True
}
html_theme = "sphinx_rtd_theme"
html_theme_options = {"display_version": True}
# html_theme_path = ["../.."]
# html_logo = "demo/static/logo-wordmark-light.svg"
# html_show_sourcelink = True
@@ -58,12 +57,10 @@ htmlhelp_basename = slug
# ('index', '{0}.tex'.format(slug), project, author, 'manual'),
# ]

man_pages = [
('index', slug, project, [author], 1)
]
man_pages = [("index", slug, project, [author], 1)]

texinfo_documents = [
('index', slug, project, author, slug, project, 'Miscellaneous'),
("index", slug, project, author, slug, project, "Miscellaneous"),
]


@@ -73,23 +70,17 @@ def setup(app):
from sphinx.util.docfields import Field

app.add_object_type(
'confval',
'confval',
objname='configuration value',
indextemplate='pair: %s; configuration value',
"confval",
"confval",
objname="configuration value",
indextemplate="pair: %s; configuration value",
doc_field_types=[
PyField(
'type',
label=('Type'),
has_arg=False,
names=('type',),
bodyrolename='class'
),
PyField("type", label=("Type"), has_arg=False, names=("type",), bodyrolename="class"),
Field(
'default',
label=('Default'),
"default",
label=("Default"),
has_arg=False,
names=('default',),
names=("default",),
),
]
)
],
)

Loading…
Cancel
Save