mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
app: allow giving the localized object name when adding new object types.
This commit is contained in:
@@ -132,5 +132,6 @@ def setup(app):
|
||||
parse_directive)
|
||||
app.add_description_unit('role', 'role', 'pair: %s; role', parse_role)
|
||||
app.add_description_unit('confval', 'confval',
|
||||
'pair: %s; configuration value')
|
||||
objname='configuration value',
|
||||
indextemplate='pair: %s; configuration value')
|
||||
app.add_description_unit('event', 'event', 'pair: %s; event', parse_event)
|
||||
|
||||
@@ -379,9 +379,10 @@ class Sphinx(object):
|
||||
all_domains[domain].roles[name] = role
|
||||
|
||||
def add_object_type(self, directivename, rolename, indextemplate='',
|
||||
parse_node=None, ref_nodeclass=None):
|
||||
parse_node=None, ref_nodeclass=None, objname=''):
|
||||
# XXX document objname
|
||||
StandardDomain.object_types[directivename] = \
|
||||
ObjType(directivename, rolename)
|
||||
ObjType(objname or directivename, rolename)
|
||||
# create a subclass of GenericObject as the new directive
|
||||
new_directive = type(directivename, (GenericObject, object),
|
||||
{'indextemplate': indextemplate,
|
||||
@@ -394,9 +395,10 @@ class Sphinx(object):
|
||||
add_description_unit = add_object_type
|
||||
|
||||
def add_crossref_type(self, directivename, rolename, indextemplate='',
|
||||
ref_nodeclass=None):
|
||||
ref_nodeclass=None, objname=''):
|
||||
# XXX document objname
|
||||
StandardDomain.object_types[directivename] = \
|
||||
ObjType(directivename, rolename)
|
||||
ObjType(objname or directivename, rolename)
|
||||
# create a subclass of Target as the new directive
|
||||
new_directive = type(directivename, (Target, object),
|
||||
{'indextemplate': indextemplate})
|
||||
|
||||
Reference in New Issue
Block a user