doc: Replace custom domain with add_object_type
Less overhead and doesn't require a new dependency
This commit is contained in:
parent
c48aa1998c
commit
234e606b41
37
doc/conf.py
37
doc/conf.py
@ -13,12 +13,14 @@
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import datetime
|
||||
import sphinx
|
||||
import packaging.version
|
||||
|
||||
from sphinx.util.docfields import Field
|
||||
from sphinx.locale import _
|
||||
|
||||
|
||||
def get_version(root_path):
|
||||
"""
|
||||
@ -113,8 +115,6 @@ highlight_language = 'none'
|
||||
|
||||
smartquotes = False
|
||||
|
||||
primary_domain = 'polybar'
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
||||
@ -240,9 +240,34 @@ suppress_warnings = ['app.add_directive']
|
||||
|
||||
|
||||
def setup(app):
|
||||
sys.path.insert(0, os.path.abspath(doc_path))
|
||||
from configdomain import myDomain
|
||||
app.add_domain(myDomain)
|
||||
app.add_object_type(
|
||||
'poly-setting',
|
||||
'poly-setting',
|
||||
objname='configuration value',
|
||||
indextemplate='pair: %s; configuration value',
|
||||
doc_field_types=[
|
||||
Field('type',
|
||||
label=_("Type"),
|
||||
names=['type'],
|
||||
has_arg=False,
|
||||
),
|
||||
Field('tags',
|
||||
label=_("Available Tags"),
|
||||
names=['tags'],
|
||||
has_arg=False,
|
||||
),
|
||||
Field('tokens',
|
||||
label=_("Supported Tokens"),
|
||||
names=['tokens'],
|
||||
has_arg=False,
|
||||
),
|
||||
Field('default',
|
||||
label=_("Default Value"),
|
||||
names=['default'],
|
||||
has_arg=False,
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
try:
|
||||
inject_version_directives(app)
|
||||
|
@ -1,48 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
configdomain
|
||||
~~~~~~~~~~~~
|
||||
|
||||
TODO document
|
||||
"""
|
||||
|
||||
from sphinxcontrib.domaintools import custom_domain
|
||||
from sphinx.util.docfields import Field, GroupedField
|
||||
|
||||
__version__ = "0.1.0"
|
||||
# for this module's sphinx doc
|
||||
release = __version__
|
||||
version = release.rsplit('.', 1)[0]
|
||||
|
||||
|
||||
myDomain = custom_domain('PolybarConfigDomain',
|
||||
name='polybar',
|
||||
label="Polybar Configuration",
|
||||
|
||||
elements=dict(
|
||||
setting=dict(
|
||||
objname="Config Setting",
|
||||
fields=[
|
||||
Field('type',
|
||||
label="Type",
|
||||
names=['type'],
|
||||
has_arg=False,
|
||||
),
|
||||
Field('tags',
|
||||
label="Available Tags",
|
||||
names=['tags'],
|
||||
has_arg=False,
|
||||
),
|
||||
Field('tokens',
|
||||
label="Supported Tokens",
|
||||
names=['tokens'],
|
||||
has_arg=False,
|
||||
),
|
||||
Field('default',
|
||||
label="Default Value",
|
||||
names=['default'],
|
||||
has_arg=False,
|
||||
),
|
||||
]
|
||||
),
|
||||
))
|
@ -1 +0,0 @@
|
||||
sphinxcontrib-domaintools
|
@ -33,7 +33,7 @@ Formats
|
||||
|
||||
The module only has a single format:
|
||||
|
||||
.. setting:: format
|
||||
.. poly-setting:: format
|
||||
|
||||
:type: |type-format|
|
||||
:tags: ``<tray>``: Shows tray icons
|
||||
@ -42,21 +42,21 @@ The module only has a single format:
|
||||
Settings
|
||||
--------
|
||||
|
||||
.. setting:: tray-spacing
|
||||
.. poly-setting:: tray-spacing
|
||||
|
||||
Space added between tray icons
|
||||
|
||||
:type: |type-extent|, non-negative
|
||||
:default: ``0px``
|
||||
|
||||
.. setting:: tray-padding
|
||||
.. poly-setting:: tray-padding
|
||||
|
||||
Space added before and after each tray icon
|
||||
|
||||
:type: |type-extent|, non-negative
|
||||
:default: ``0px``
|
||||
|
||||
.. setting:: tray-size
|
||||
.. poly-setting:: tray-size
|
||||
|
||||
Size of individual tray icons
|
||||
|
||||
@ -65,7 +65,7 @@ Settings
|
||||
:type: |type-pwo|, non-negative
|
||||
:default: 66%
|
||||
|
||||
.. setting:: tray-background
|
||||
.. poly-setting:: tray-background
|
||||
|
||||
Background color of tray icons
|
||||
|
||||
@ -76,7 +76,7 @@ Settings
|
||||
:type: |type-color|
|
||||
:default: ``${root.background}``
|
||||
|
||||
.. setting:: tray-foreground
|
||||
.. poly-setting:: tray-foreground
|
||||
|
||||
Tray icon color hint
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user