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

✨ adds a lexer for systemd unit files #1568

Merged
merged 3 commits into from
Sep 8, 2020
Merged

✨ adds a lexer for systemd unit files #1568

merged 3 commits into from
Sep 8, 2020

Conversation

jljouannic
Copy link
Contributor

This lexer is pretty basic. It is inspired from an existing lexer found in Chroma.

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Sep 8, 2020
@pyrmont pyrmont self-assigned this Sep 8, 2020
Copy link
Contributor

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

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

Thanks for submitting the PR and I'm sorry it took a bit of time to respond. There's a comment below.

lib/rouge/lexers/systemd.rb Outdated Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Sep 8, 2020
Copy link
Contributor Author

@jljouannic jljouannic left a comment

Choose a reason for hiding this comment

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

The test seems too simple now as it does not contain any comment nor section ([Service], [Unit]…)

Only `.service` file extension would be supported for now
@jljouannic
Copy link
Contributor Author

The test seems too simple now as it does not contain any comment nor section ([Service], [Unit]…)

Never mind, this test is not the visual one. It does not really matter if the sample file is not complete.

@pyrmont pyrmont merged commit f039145 into rouge-ruby:master Sep 8, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Sep 8, 2020

@jljouannic Thanks for this! I'm about to start the release process for v3.23.0. Once that's complete, this will be part of the gem available from RubyGems. Thanks for helping to improve Rouge!

@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Sep 8, 2020
@iBug
Copy link

iBug commented Sep 10, 2020

Why not use INI / dosini directly? As per the systemd syntax, it's almost compatible with INI.

Here's my blog post which uses dosini for systemd unit files. As can be seen, it renders perfectly.

(source code plus Wayback Machine in case my blog disappears later)

@jljouannic
Copy link
Contributor Author

This is a first basic implementation, which, I agree, gives a pretty similar result as the INI lexer.
However, in the near future I plan to improve this systemd lexer by adding support for systemd specifiers.

@jljouannic jljouannic deleted the systemd branch January 5, 2021 15:15
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
This commit adds a lexer for systemd unit files. These unit files can
have multiple extensions but this commit only supports the `*.service`
file glob at this stage.

Co-authored-by: Michael Camilleri <mike@inqk.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants