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

Add JavaScript Node.js Console Lexer #1825

Merged
merged 2 commits into from Aug 8, 2021
Merged

Conversation

cltrudeau
Copy link
Contributor

I needed something like pycon for Node in a project I was working on, once written it was easy enough to put in here.

I've tested under py36 - py39. I don't have py35 or pypy installed, hopefully everything will work there.

Drop me a note if you need something formatted differently / more tests / whatever.

Thanks for the great tool!

pygments/lexers/javascript.py Show resolved Hide resolved
pygments/lexers/javascript.py Show resolved Hide resolved
@Mesteery
Copy link
Contributor

I find 'JavaScript Node.js console session' too ambiguous.
Wouldn't talking about 'REPL' and removing 'JavaScript' be better?
Also :

        aliases = ['nodejs', 'nodecon'] <- nodejs alias is false, nodecon is too ambiguous
        mimetypes = ['application/javascript', 'application/x-javascript', ...] <- these mime types are false

@Anteru
Copy link
Collaborator

Anteru commented Jun 20, 2021

I find 'JavaScript Node.js console session' too ambiguous.

Can you please elaborate as to how this is ambiguous? What would you suggest? nodejsrepl?

@Mesteery
Copy link
Contributor

Mesteery commented Jun 20, 2021

Can you please elaborate as to how this is ambiguous? What would you suggest? nodejsrepl?

Yes, something like nodejsrepl.

It's not really ambiguous, but it would be better to have a reference to 'REPL', without 'JavaScript'.

For example: 'Node.js REPL session'.

And the description: For parsing Node.js REPL session, such as:.

    - renamed nodecon to nodejsrepl
    - removed bad mimetypes
@cltrudeau
Copy link
Contributor Author

I find 'JavaScript Node.js console session' too ambiguous.
Wouldn't talking about 'REPL' and removing 'JavaScript' be better?
Also :

        aliases = ['nodejs', 'nodecon'] <- nodejs alias is false, nodecon is too ambiguous
        mimetypes = ['application/javascript', 'application/x-javascript', ...] <- these mime types are false

Alias has been fixed, mimetypes have been reduced to text/x-nodejsrepl.

I tried renaming the Lexer to NodeREPLLexer for consistency with this suggestion, but it breaks the tests cases -- the have a special condition in them for things named Console that seems to be needed here. I didn't dig any further, just put it back to NodeConsoleLexer.

@Anteru Anteru self-assigned this Jul 18, 2021
@Anteru Anteru added A-lexing area: changes to individual lexers changelog-update Items which need to get mentioned in the changelog labels Jul 18, 2021
@Anteru Anteru added this to the 2.10 milestone Jul 18, 2021
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Aug 8, 2021
@Anteru Anteru merged commit b5bf0f1 into pygments:master Aug 8, 2021
@Anteru
Copy link
Collaborator

Anteru commented Aug 8, 2021

Merged, thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lexing area: changes to individual lexers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants