Skip to content
This repository was archived by the owner on Apr 16, 2022. It is now read-only.

Commit 4e457ef

Browse files
wouterjfabpot
authored andcommitted
Move codeblock to sphinx php repository
1 parent 7467b42 commit 4e457ef

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

sensio/sphinx/codeblock.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
:copyright: (c) 2010-2015 Fabien Potencier
3+
:license: MIT, see LICENSE for more details.
4+
"""
5+
6+
from sphinx.directives.code import CodeBlock
7+
8+
"""
9+
A wrapper around the built-in CodeBlock class to always
10+
enable line numbers.
11+
"""
12+
class NumberedCodeBlock(CodeBlock):
13+
def run(self):
14+
self.options['linenos'] = 'table'
15+
return super(NumberedCodeBlock, self).run();
16+
17+
def setup(app):
18+
app.add_directive('code-block', NumberedCodeBlock)
19+
app.add_directive('sourcecode', NumberedCodeBlock)

0 commit comments

Comments
 (0)