@@ -69,6 +69,29 @@ def set_description(
6969 context ["description" ] = "Python Enhancement Proposals (PEPs)"
7070
7171
72+ class ImplementationDetail (SphinxDirective ):
73+
74+ has_content = True
75+ final_argument_whitespace = True
76+
77+ # This text is copied to templates/dummy.html
78+ label_text = sphinx_gettext ('CPython implementation detail:' )
79+
80+ def run (self ):
81+ self .assert_has_content ()
82+ pnode = nodes .compound (classes = ['impl-detail' ])
83+ content = self .content
84+ add_text = nodes .strong (self .label_text , self .label_text )
85+ self .state .nested_parse (content , self .content_offset , pnode )
86+ content = nodes .inline (pnode [0 ].rawsource , translatable = True )
87+ content .source = pnode [0 ].source
88+ content .line = pnode [0 ].line
89+ content += pnode [0 ].children
90+ pnode [0 ].replace_self (nodes .paragraph (
91+ '' , '' , add_text , nodes .Text (' ' ), content , translatable = False ))
92+ return [pnode ]
93+
94+
7295def setup (app : Sphinx ) -> dict [str , bool ]:
7396 """Initialize Sphinx extension."""
7497
@@ -101,6 +124,8 @@ def setup(app: Sphinx) -> dict[str, bool]:
101124 app .add_directive ("superseded" , pep_banner_directive .SupersededBanner )
102125 app .add_directive ("withdrawn" , pep_banner_directive .WithdrawnBanner )
103126
127+ app .add_directive ('impl-detail' , ImplementationDetail )
128+
104129 # Register event callbacks
105130 app .connect ("builder-inited" , _update_config_for_builder ) # Update configuration values for builder used
106131 app .connect ("env-before-read-docs" , create_pep_zero ) # PEP 0 hook
0 commit comments