It seems docutils does not fill the topic node with the source info when the topic directive has a bullet list.
from docutils.core import publish_doctree # topic directive with a paragraph s = """ .. topic:: 5. Topic Title Paragraph """ (topic,) = publish_doctree(s) print(topic.source, topic.line) # topic directive with a bullet list s = """ .. topic:: 5. Topic Title - Bullet List Item """ (topic,) = publish_doctree(s) print(topic.source, topic.line)
$ python test.py <string> None None None
This is one more instance of feature request [#41].
Is there a use case for the internal source and line attributes for topic nodes?
The interesting point is that in some cases there is a "source" attribute (but no "line" attribute) for the "topic" node. (Tested with
rst2pseudoxml --expose-internal-attributes=source:line
.)Related
Feature Requests: #41