docs: highlight module name to use with register

This commit is contained in:
enkore 2017-05-13 15:58:29 +02:00
parent 2ff5ea0262
commit 5e59081f97
3 changed files with 45 additions and 1 deletions

20
docs/_static/i3pystatus.css vendored Normal file
View File

@ -0,0 +1,20 @@
#module-reference dl.class dt .property,
#module-reference dl.class dt .descclassname,
#module-reference dl.class dt .descname
{
display: none;
}
#module-reference dl.class dd {
margin-top: -1.5em;
}
#module-reference dl.class .modheader {
margin-left: -2em;
margin-bottom: .5em;
}
#module-reference dl.class .modname {
font-weight: bold;
}

View File

@ -163,7 +163,7 @@ html_theme = "haiku"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
@ -344,3 +344,6 @@ epub_copyright = '2013, Author'
# If false, no index is generated.
#epub_use_index = True
def setup(app):
app.add_stylesheet('i3pystatus.css')

View File

@ -80,6 +80,27 @@ def process_docstring(app, what, name, obj, options, lines):
if is_module(obj) and obj.settings:
fail_on_missing_dependency_hints(obj, lines)
if issubclass(obj, i3pystatus.core.modules.Module):
mod = obj.__module__
if mod.startswith("i3pystatus."):
mod = mod[len("i3pystatus."):]
lines[0:0] = [
".. raw:: html",
"",
" <div class='modheader'>" +
"Module name: <code class='modname descclassname'>" + mod + "</code> " +
"(class <code class='descclassname'>" + name + "</code>)" +
"</div>",
"",
]
else:
lines[0:0] = [
".. raw:: html",
"",
" <div class='modheader'>class <code class='descclassname'>" + name + "</code></div>",
"",
]
lines.append(".. rubric:: Settings")
lines.append("")