Close #267: html: Eliminate prompt characters of doctest block from copyable text

This commit is contained in:
Takeshi KOMIYA 2019-10-10 22:42:17 +09:00
parent d6334e74c8
commit 6b9e0cbd70
3 changed files with 16 additions and 0 deletions

View File

@ -17,6 +17,7 @@ Features added
--------------
* #6707: C++, support bit-fields.
* #267: html: Eliminate prompt characters of doctest block from copyable text
Bugs fixed
----------

View File

@ -672,6 +672,10 @@ div.code-block-caption + div > div.highlight > pre {
margin-top: 0;
}
div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
}
div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;

View File

@ -283,6 +283,16 @@ class UnreferencedFootnotesDetector(SphinxTransform):
location=node)
class DoctestTransform(SphinxTransform):
"""Set "doctest" style to each doctest_block node"""
default_priority = 500
def apply(self, **kwargs):
# type: (Any) -> None
for node in self.document.traverse(nodes.doctest_block):
node['classes'].append('doctest')
class FigureAligner(SphinxTransform):
"""
Align figures to center by default.
@ -425,6 +435,7 @@ def setup(app):
app.add_transform(MoveModuleTargets)
app.add_transform(HandleCodeBlocks)
app.add_transform(SortIds)
app.add_transform(DoctestTransform)
app.add_transform(FigureAligner)
app.add_transform(AutoNumbering)
app.add_transform(AutoIndexUpgrader)