Merge pull request #7145 from tk0miya/7144_styling_desc_by_domainname

Close #7144: Add CSS class indicating its domain for each desc node
This commit is contained in:
Takeshi KOMIYA 2020-02-22 18:37:52 +09:00 committed by GitHub
commit 58a7cd2355
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -73,6 +73,7 @@ Features added
in the documentation. in the documentation.
* #1027: Support backslash line continuation in :rst:dir:`productionlist`. * #1027: Support backslash line continuation in :rst:dir:`productionlist`.
* #7108: config: Allow to show an error message from conf.py via ``ConfigError`` * #7108: config: Allow to show an error message from conf.py via ``ConfigError``
* #7144: Add CSS class indicating its domain for each desc node
Bugs fixed Bugs fixed
---------- ----------

View File

@ -160,6 +160,8 @@ class ObjectDescription(SphinxDirective):
# 'desctype' is a backwards compatible attribute # 'desctype' is a backwards compatible attribute
node['objtype'] = node['desctype'] = self.objtype node['objtype'] = node['desctype'] = self.objtype
node['noindex'] = noindex = ('noindex' in self.options) node['noindex'] = noindex = ('noindex' in self.options)
if self.domain:
node['classes'].append(self.domain)
self.names = [] # type: List[Any] self.names = [] # type: List[Any]
signatures = self.get_signatures() signatures = self.get_signatures()

View File

@ -176,8 +176,8 @@ def test_html4_output(app, status, warning):
r'-| |-'), r'-| |-'),
], ],
'autodoc.html': [ 'autodoc.html': [
(".//dt[@id='autodoc_target.Class']", ''), (".//dl[@class='py class']/dt[@id='autodoc_target.Class']", ''),
(".//dt[@id='autodoc_target.function']/em", r'\*\*kwds'), (".//dl[@class='py function']/dt[@id='autodoc_target.function']/em", r'\*\*kwds'),
(".//dd/p", r'Return spam\.'), (".//dd/p", r'Return spam\.'),
], ],
'extapi.html': [ 'extapi.html': [
@ -279,7 +279,7 @@ def test_html4_output(app, status, warning):
(".//dt/code", r'long\(parameter,\s* list\)'), (".//dt/code", r'long\(parameter,\s* list\)'),
(".//dt/code", 'another one'), (".//dt/code", 'another one'),
(".//a[@href='#mod.Cls'][@class='reference internal']", ''), (".//a[@href='#mod.Cls'][@class='reference internal']", ''),
(".//dl[@class='userdesc']", ''), (".//dl[@class='std userdesc']", ''),
(".//dt[@id='userdesc-myobj']", ''), (".//dt[@id='userdesc-myobj']", ''),
(".//a[@href='#userdesc-myobj'][@class='reference internal']", ''), (".//a[@href='#userdesc-myobj'][@class='reference internal']", ''),
# docfields # docfields