Parse RST in plug-in class docs
In order to make the generated documentation for resource plug-ins more readable, parse the class comments as RST and append to the section. Change-Id: Icb37344c64c21bcac536e8f2916b102eb9754851
This commit is contained in:
parent
1a2747c5e3
commit
6367aab293
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
|
from docutils import core
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
import pydoc
|
import pydoc
|
||||||
from sphinx.util.compat import Directive
|
from sphinx.util.compat import Directive
|
||||||
|
@ -66,8 +67,9 @@ class ResourcePages(Directive):
|
||||||
|
|
||||||
cls_doc = pydoc.getdoc(resource_class)
|
cls_doc = pydoc.getdoc(resource_class)
|
||||||
if cls_doc:
|
if cls_doc:
|
||||||
para = nodes.paragraph('', cls_doc)
|
# allow for rst in the class comments
|
||||||
section.append(para)
|
cls_nodes = core.publish_doctree(cls_doc).children
|
||||||
|
section.extend(cls_nodes)
|
||||||
|
|
||||||
self.contribute_properties(section)
|
self.contribute_properties(section)
|
||||||
self.contribute_attributes(section)
|
self.contribute_attributes(section)
|
||||||
|
|
Loading…
Reference in New Issue