-
-
Notifications
You must be signed in to change notification settings - Fork 37
Move codeblock to sphinx php repository #30
Conversation
Isn't it possible to reuse some code of the |
|
||
""" | ||
The only change with the built-in CodeBlock class that comes with Sphinx | ||
is that linenos is always on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's not true. this is the only change compared to Sphinx 1.2. But compared to Sphinx 1.3, it also removes all new features
I think I have an idea how to make this much better, will test & commit when I'm home |
Updated with a much better implementation, it works locally. |
👍 looks good |
class NumberedCodeBlock(CodeBlock): | ||
def run(self): | ||
literal = super(NumberedCodeBlock, self).run()[0]; | ||
literal['linenos'] = 'linenos' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be a boolean value ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but linenos is not correct as well:
linenos
If set to'table'
, output line numbers as a table with two cells,
one containing the line numbers, the other the whole code. This is
copy-and-paste-friendly, but may cause alignment problems with some
browsers or fonts. If set to'inline'
, the line numbers will be
integrated in the<pre>
tag that contains the code (that setting
is new in Pygments 0.8).For compatibility with Pygments 0.7 and earlier, every true value
except'inline'
means the same as'table'
(in particular, that
means alsoTrue
).The default value is
False
, which means no line numbers at all.
I'll change it to table, as that seems what is used by symfony.com.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codebase of Sphinx seems to set the value to True
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, true is supported by Pygments 0.7 - 2.0 (for BC reasons). Not sure if we want that.
I've now made the code even more simple (and changed the value). Didn't test it yet, will test it this afternoon. |
👍 |
Tested and seem to work perfect. Can be merged @fabpot |
Thank you @wouterj. |
This PR was submitted for the 2.8 branch but it was merged into the 2.3 branch instead (closes #5606). Discussion ---------- Use symfony.com theme on Platform.sh builds Requires fabpot/sphinx-php#30 to be merged first. Commits ------- ebc0e0b Reset some more pygments styles 62a99b3 Use pip instead of submodules c70e132 Use numbered code block 01dd675 Add demo warning a10683b Move Sphinx files to _theme f931d83 Update config bafc2ec Use a more recent version of Sphinx 3e82945 Temporary disable codeblock 9d2bc8f Use symfony.com theme on Platform.sh builds
No description provided.