From a0547227782bb9ff0aec6afc92b56d6edd92c987 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 22 Oct 2009 11:01:46 +0000 Subject: [PATCH] Make it more robust. --- Doc/tools/sphinxext/pyspecific.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py index bdb6c225727..e639782d5fd 100644 --- a/Doc/tools/sphinxext/pyspecific.py +++ b/Doc/tools/sphinxext/pyspecific.py @@ -58,8 +58,14 @@ class ImplementationDetail(Directive): def run(self): pnode = nodes.compound(classes=['impl-detail']) content = self.content - content[0] = '**CPython implementation detail:** ' + content[0] + add_text = nodes.strong('CPython implementation detail:', + 'CPython implementation detail:') self.state.nested_parse(content, self.content_offset, pnode) + if pnode.children and isinstance(pnode[0], nodes.paragraph): + pnode[0].insert(0, add_text) + pnode[0].insert(1, nodes.Text(' ')) + else: + pnode.insert(0, nodes.paragraph('', '', add_text)) return [pnode]