def rst_nodes(self):
"""Render into RST nodes a thing shaped like a function, having a name
and arguments.
Fill in args, docstrings, and info fields from stored JSDoc output.
"""
try:
# Get the relevant documentation together:
doclet, full_path = self._app._sphinxjs_doclets_by_path.get_with_path(self._partial_path)
except SuffixNotFound as exc:
raise SphinxError('No JSDoc documentation was found for object "%s" or any path ending with that.'
% ''.join(exc.segments))
except SuffixAmbiguous as exc:
raise SphinxError('More than one JS object matches the path suffix "%s". Candidate paths have these segments in front: %s'
% (''.join(exc.segments), exc.next_possible_keys))
else:
rst = self.rst(self._partial_path,
full_path,
doclet,
use_short_name='short-name' in self._options)
# Parse the RST into docutils nodes with a fresh doc, and return
# them.
#
# Not sure if passing the settings from the "real" doc is the right
# thing to do here:
meta = doclet['meta']
doc = new_document('%s:%s(%s)' % (meta['filename'],
doclet['longname'],
meta['lineno']),
settings=self._directive.state.document.settings)
RstParser().parse(rst, doc)
return doc.children
return []
评论列表
文章目录