1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
import re
from pathlib import Path
from packaging.version import parse as _parse
from sphinx import addnodes
import ablog
ablog_builder = "dirhtml"
ablog_website = "_website"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.ifconfig",
"sphinx.ext.extlinks",
"sphinx_automodapi.automodapi",
"ablog",
"alabaster",
"nbsphinx",
"myst_parser",
]
version = str(_parse(ablog.__version__))
project = "ABlog"
copyright = "2014-2022, ABlog Team"
master_doc = "index"
source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}
exclude_patterns = ["_build", "docs/manual/.ipynb_checkpoints"]
html_title = "ABlog"
html_use_index = True
html_domain_indices = False
html_show_sourcelink = True
html_favicon = "_static/ablog.ico"
blog_title = "ABlog"
blog_baseurl = "https://ablog.readthedocs.io/"
blog_locations = {
"Pittsburgh": ("Pittsburgh, PA", "https://en.wikipedia.org/wiki/Pittsburgh"),
"San Fran": ("San Francisco, CA", "https://en.wikipedia.org/wiki/San_Francisco"),
"Denizli": ("Denizli, Turkey", "https://en.wikipedia.org/wiki/Denizli"),
}
blog_languages = {
"en": ("English", None),
"nl": ("Nederlands", None),
"zh_CN": ("Chinese", None),
}
blog_default_language = "en"
language = "en"
blog_authors = {
"Ahmet": ("Ahmet Bakan", "https://ahmetbakan.com"),
"Luc": ("Luc Saffre", "https://saffre-rumma.net/luc/"),
"Mehmet": ("Mehmet Gerçeker", "https://github.com/mehmetg"),
"Libor": ("Libor Jelínek", "https://liborjelinek.github.io/"),
}
blog_feed_archives = True
blog_feed_fulltext = True
blog_feed_templates = {
"atom": {
"content": "{{ title }}{% for tag in post.tags %}" " #{{ tag.name|trim()|replace(' ', '') }}" "{% endfor %}",
},
"social": {
"content": "{{ title }}{% for tag in post.tags %}" " #{{ tag.name|trim()|replace(' ', '') }}" "{% endfor %}",
},
}
disqus_shortname = "https-ablog-readthedocs-io"
disqus_pages = True
fontawesome_link_cdn = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
html_theme = "alabaster"
html_sidebars = {
"**": [
"about.html", # Comes from alabaster
"searchfield.html", # Comes from alabaster
"ablog/postcard.html",
"ablog/recentposts.html",
"ablog/tagcloud.html",
"ablog/categories.html",
"ablog/archives.html",
"ablog/authors.html",
"ablog/languages.html",
"ablog/locations.html",
]
}
html_theme_options = {
"travis_button": False,
"github_user": "sunpy",
"github_repo": "ablog",
"description": "ABlog for blogging with Sphinx",
"logo": "ablog.png",
}
intersphinx_mapping = {
"python": ("https://docs.python.org/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
}
extlinks = {
"wiki": ("https://en.wikipedia.org/wiki/%s", "%s"),
"issue": ("https://github.com/sunpy/ablog/issues/%s", "issue %s"),
"pull": ("https://github.com/sunpy/ablog/pull/%s", "pull request %s"),
}
rst_epilog = """
.. _Sphinx: http://sphinx-doc.org/
.. _Python: https://python.org
.. _Disqus: https://disqus.com/
.. _GitHub: https://github.com/sunpy/ablog
.. _PyPI: https://pypi.python.org/pypi/ablog
.. _Read The Docs: https://readthedocs.org/
.. _Alabaster: https://github.com/bitprophet/alabaster
"""
locale_dirs = [str(Path(ablog.__file__).parent / Path("locales"))]
nitpicky = True
nitpick_ignore = []
for line in open("nitpick-exceptions"):
if line.strip() == "" or line.startswith("#"):
continue
dtype, target = line.split(None, 1)
target = target.strip()
nitpick_ignore.append((dtype, target))
def parse_event(env, sig, signode):
event_sig_re = re.compile(r"([a-zA-Z-]+)\s*\((.*)\)")
m = event_sig_re.match(sig)
if not m:
signode += addnodes.desc_name(sig, sig)
return sig
name, args = m.groups()
signode += addnodes.desc_name(name, name)
plist = addnodes.desc_parameterlist()
for arg in args.split(","):
arg = arg.strip()
plist += addnodes.desc_parameter(arg, arg)
signode += plist
return name
def setup(app):
from sphinx.ext.autodoc import cut_lines
from sphinx.util.docfields import GroupedField
app.connect("autodoc-process-docstring", cut_lines(4, what=["module"]))
app.add_object_type(
"confval",
"confval",
objname="configuration value",
indextemplate="pair: %s; configuration value",
)
fdesc = GroupedField("parameter", label="Parameters", names=["param"], can_collapse=True)
app.add_object_type("event", "event", "pair: %s; event", parse_event, doc_field_types=[fdesc])
|