1 from docutils
import nodes
2 from docutils
import transforms
4 #class index_entry(nodes.Inline, nodes.TextElement): pass
6 class Index(transforms
.Transform
):
10 pending
= self
.startnode
11 curr_index
= pending
.parent
.index(pending
)
13 error
= self
.document
.reporter
.error(
14 'Index directive must follow a text node',
15 nodes
.literal_block(pending
.rawsource
, pending
.rawsource
),
17 pending
.parent
.replace(pending
, error
)
20 for entry
in pending
.details
['entries']:
22 sibling
= pending
.parent
[curr_index
-1]
23 sibling
.children
[0:0] = entries
24 pending
.parent
.remove(pending
)