Skip to content

Commit

Permalink
Remove docker_ file glob from Docker lexer (#1550)
Browse files Browse the repository at this point in the history
In addition to adding the `*.Dockerfile` file glob, #1059 added a file
glob for `Dockerfile_*` to address #1070. However, as noted by #1539,
this causes issues for files that begin with `dockerfile_` but that are
not Dockerfiles.

Adding the `Dockerfile_*` file glob was an error and this commit
removes it. It is a non-standard name and is not recognised by other
syntax highlighting libraries (e.g. Pygments, Chroma, Linguist). The
correct fix for the issue that precipitated #1070 is to use a
`.gitattributes` file.
  • Loading branch information
pyrmont authored Jul 4, 2020
1 parent c96bb98 commit 9872cee
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Docker < RegexLexer
desc "Dockerfile syntax"
tag 'docker'
aliases 'dockerfile'
filenames 'Dockerfile', '*.Dockerfile', '*.docker', 'Dockerfile_*'
filenames 'Dockerfile', '*.Dockerfile', '*.docker'
mimetypes 'text/x-dockerfile-config'

KEYWORDS = %w(
Expand Down
1 change: 0 additions & 1 deletion spec/lexers/docker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
assert_guess :filename => 'Dockerfile'
assert_guess :filename => 'docker.docker'
assert_guess :filename => 'some.Dockerfile'
assert_guess :filename => 'Dockerfile_some_extension'
end

it 'guesses by mimetype' do
Expand Down

0 comments on commit 9872cee

Please sign in to comment.