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

Move codeblock to sphinx php repository #30

Closed
wants to merge 2 commits into from

Conversation

wouterj
Copy link
Contributor

@wouterj wouterj commented Aug 8, 2015

No description provided.

@xabbuh
Copy link
Contributor

xabbuh commented Aug 17, 2015

Isn't it possible to reuse some code of the CodeBlock class from the Sphinx core?


"""
The only change with the built-in CodeBlock class that comes with Sphinx
is that linenos is always on.
Copy link
Contributor

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

@wouterj
Copy link
Contributor Author

wouterj commented Aug 18, 2015

I think I have an idea how to make this much better, will test & commit when I'm home

@wouterj
Copy link
Contributor Author

wouterj commented Aug 18, 2015

Updated with a much better implementation, it works locally.

@xabbuh
Copy link
Contributor

xabbuh commented Aug 18, 2015

👍 looks good

class NumberedCodeBlock(CodeBlock):
def run(self):
literal = super(NumberedCodeBlock, self).run()[0];
literal['linenos'] = 'linenos'
Copy link
Contributor

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 ?

Copy link
Contributor Author

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 also True).

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@wouterj
Copy link
Contributor Author

wouterj commented Aug 19, 2015

I've now made the code even more simple (and changed the value). Didn't test it yet, will test it this afternoon.

@stof
Copy link
Contributor

stof commented Aug 19, 2015

👍

@wouterj
Copy link
Contributor Author

wouterj commented Aug 19, 2015

Tested and seem to work perfect. Can be merged @fabpot

@fabpot
Copy link
Owner

fabpot commented Aug 19, 2015

Thank you @wouterj.

@fabpot fabpot closed this in 1b7c4b7 Aug 19, 2015
@wouterj wouterj deleted the add_codeblock branch August 19, 2015 20:23
weaverryan added a commit to symfony/symfony-docs that referenced this pull request Aug 21, 2015
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants