DocTitle does not apply when there is a decoration in the tree. The proper test is there, but there's a typo or an surpluss condititional i think..
DocTtitle's apply() bails out when candidate_index() is none.
node.first_child_not_matching_class gives that index, which is none or an index within the bounds of the node.
So the test
len(node) > (index + 1)
can go I'd think (see patch). And otherwise it should be
len(node) <= (index + 1)