Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Terminal lexer for console examples #6930

Closed
wants to merge 2 commits into from

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Aug 29, 2016

This allows to fix #6865

@javiereguiluz
Copy link
Member

This seems to work ... but it introduces some issues: comments are now considered prompts. For example, in this page: http://pr-6930-6qmocelev2lwe.eu.platform.sh/setup.html

highlight-error

I'm afraid it's "the curse of Sphinx": when someone tries to fix something ... they end up breaking more things 😭

@stof
Copy link
Member

stof commented Aug 29, 2016

yeah, this is because a shell session does not have comments AFAIK

@wouterj
Copy link
Member Author

wouterj commented Aug 30, 2016

status: needs work

We can quite easily fix this by creating a custom lexer that will call the bash lexer for lines starting with $/C:\> and treats lines starting with # as a comment. Will work on this, as it should not be that hard.

@wouterj
Copy link
Member Author

wouterj commented Aug 31, 2016

Wow, love carsonbot :)

@javiereguiluz I've updated the PR with a very simple custom lexer. As far as I can see, it works. It uses 2 new styles not yet defined by symfony.com: Generic.Prompt ($ and C:\>) and Generic.Output (command output).

Let me know if you like this change.

@@ -108,6 +109,7 @@
lexers['rst'] = RstLexer()
lexers['varnish3'] = CLexer()
lexers['varnish4'] = CLexer()
lexers['terminal'] = TerminalLexer()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javiereguiluz you need to add this to the conf.py used by the doc builder. You probably also have to add sys.path.append(os.path.abspath('_theme/_exts')) (where os.path.abspath('_theme/_exts') should be replaced by the path to the _theme/_exts directory)

@javiereguiluz
Copy link
Member

@wouterj we've updated symfony.com's Sphinx builder to include your TerminalLexer. Changes will be deployed soon and after that, it will be safe to merge this PR and regenerate the docs.

@javiereguiluz javiereguiluz changed the title Use bash session lexer for console examples Use Terminal lexer for console examples Sep 5, 2016
@javiereguiluz
Copy link
Member

The changes have been implemented on symfony.com, so we can merge this PR and see how the new docs are generated. Thanks.

xabbuh added a commit that referenced this pull request Sep 21, 2016
This PR was squashed before being merged into the 2.7 branch (closes #6930).

Discussion
----------

Use Terminal lexer for console examples

This allows to fix #6865

Commits
-------

ecf5d16 Use Terminal lexer for console examples
@xabbuh
Copy link
Member

xabbuh commented Sep 21, 2016

Okay, let's see how this looks like. :)

@xabbuh xabbuh closed this Sep 21, 2016
@wouterj wouterj deleted the issue-6865/2.7 branch October 6, 2016 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants